The anchor pattern implemented in terms of
The anchor pattern predates the path crate.
It is conceptually:
- A two level Path tree
- Each level of the path is defined as strings not binary data
- The top level is the “type” and the second level is the “text”
- The second level is optional as
An anchor can only be 1 or 2 levels deep as “type” and “text”.
This is the root of the
Simple string interface to simple string based paths. a.k.a “the anchor pattern” that predates paths by a few years.
Attempt to get an anchor by its hash. Returns None if the hash doesn’t point to an anchor. We can’t do anything fancy like ensure the anchor if not exists because we only have a hash.
Returns every entry hash in a vector from the second level of an anchor. Uses the string argument to build the path from the root. Hashes are sorted in the same way that paths sort children.
Old version of holochain that anchors was designed for had two part link tags but now link tags are a single array of bytes, so to get an external interface that is somewhat backwards compatible we need to rebuild the anchors from the paths serialized into the links and then return them.
Returns every entry hash in a vector from the root of an anchor. Hashes are sorted in the same way that paths sort children.