Grow Only Hash Object

A Grow Only Hash Object (GOHO) uses the basic tenants of a Grow-Only Set and the immutable nature of the IPFS DAG to create a merkle-tree that can be assembled into an object. The rules for order-of-precedence have yet to be established.

Simplified Example

Leaf Node 1

{
  "path": "foo/bars",
  "action": "append",
  "value": "zap"
}

Leaf Node 2

{
  "path": "foo/bars",
  "action": "append",
  "value": "baz"
}

Leaf Node 3

{
  "path": "uuid",
  "action": "set",
  "value": "2A9F076D-77CB-44DF-B6EA-03FBDBF42EB5"
}

The result of merging the leaf nodes of this merkle-tree will result in this hash (in JSON notation)

{
  "uuid": "2A9F076D-77CB-44DF-B6EA-03FBDBF42EB5",
  "foo": {
    "bars": [ "zap", "baz" ]
  }
}

Actions

set will set the value at the specified path. If the same path is set multiple times, the results may be unpredictable.

append will treat the path like a set and append the value. If the same value is appended multiple times, it will appear in the object multiple times. To prevent duplicates, set the idempotentKey to the same value, this will append only unique values to the set.

Idempotent Append 1

{
  "path": "foo/bars",
  "action": "append",
  "value": "baz",
  "idempotentKey": "abc"
}

Idempotent Append 2

{
  "path": "foo/bars",
  "action": "append",
  "value": "baz",
  "idempotentKey": "abc"
}

The result of merging the leaf nodes of this merkle-tree will result in this hash (in JSON notation)

{
  "foo": {
    "bars": [ "baz" ]
  }
}