5insert_anchor_links = "right"
10Graph Store is a gall implementation of a tree with additional virtual edges by allowing nodes to reference other nodes. It is most comparable to modern NoSQL databases in structure, though it allows for schemas to be written in the form of marks. It is used as the backend for an increasing number of Landscape applications, and is considered to be best used for social data.
14`graphs` is a map of `resource` to `marked-graph`
16`resource` is a pair of ship and term which is where the graph is hosted and the name of the resource. Every graph is it's own resource.
18`marked-graph` is a pair of `graph` and `(unit mark)`. The semantics of a graph are defined by the mark. This is just for validating the structure of the graph.
20`graph` is a `mop`, a mold builder for order map, of an atom and a `node`.
22`node` is a pair of `post` and `children`.
24`post` is defined in `sur/post`. It contains:
31 contents=(list content)
38Most of these elements are self explanatory.
40`contents` is a `list` of `content` where `content` is a tagged union of text, url, code, or reference. This is where the contents of a publish post or an entry from links would be stored.
42`hash` is a `sham` hash of `validated-portion` which includes the parent hash, author, time sent, and contents.
44`signatures` is a set of `signature` which is used to cryptographically sign graph-store messages.
46When interacting with `graph-store` you will need to create an `update`
48`update` is a tagged union that currently only has one option
50`[%0 p=time q=update-0]`
52The reason this is a union is to serve as future proofing for version changes.
54An `update-0` can either be logged in the case of adding/removing nodes or signatures, or non-logged as in the case of adding/removing a graph. This logging refers to if this action adds an entry to the update log that is used to synchronize state between ships.
56Below is an excerpt of `sur/graph-store.hoon` at the time of writing, showing the definition of `logged-update-0` and `update-0` which should now be readable.
60 $% [%add-nodes =resource nodes=(map index node)]
61 [%remove-nodes =resource indices=(set index)]
62 [%add-signatures =uid =signatures]
63 [%remove-signatures =uid =signatures]
68 [%add-graph =resource =graph mark=(unit mark)]
69 [%remove-graph =resource]
71 [%add-tag =term =resource]
72 [%remove-tag =term =resource]
74 [%archive-graph =resource]
75 [%unarchive-graph =resource]
76 [%run-updates =resource =update-log]
78 :: NOTE: cannot be sent as pokes
81 [%tags tags=(set term)]
82 [%tag-queries =tag-queries]
89Graph Store can be poked with a `graph-update`, which can:
90 - add and remove a graph
92 `[%add-graph =resource =graph mark=(unit mark)]`
94 `[%remove-graph =resource]`
96 - add and remove a node to a graph
98 `[%add-nodes =resource nodes=(map index node)]`
100 `[%remove-nodes =resource indices=(set index)]`
102 - add and remove signatures
104 `[%add-signatures =uid =signatures]`
106 `[%remove-signatures =uid =signatures]`
108 - add and remove tags
110 `[%add-tag =term =resource]`
112 `[%remove-tag =term =resource]`
114 - archive and unarchive a graph
116 `[%archive-graph =resource]`
118 `[%unarchive-graph =resource]`
122What follows is a summary of the scrys available in graph-store
131 `[%x %tag-queries ~]`
133- Fetch a specific graph by resource
136- Archive a specific graph by resource
137 `[%x %archive @ @ ~]`
139- Fetch a subset of the graph by resource and start and end indices
140 `[%x %graph-subset @ @ @ @ ~]`
142- Select a node from a graph by resource and index
145- Fetch a subset of the children of a node by resource, index, and start and end indices
146 `[%x %node-children-subset @ @ @ @ @ *]`
148- Fetch a subset of the update log by resource and start and end indices
149 `[%x %update-log-subset @ @ @ @ ~]`
151- Fetch the update log by resource
152 `[%x %update-log @ @ ~]`
154- Fetch the time of the last entry of the update log
155 `[%x %peek-update-log @ @ ~]`
159There are marks in `mar/graph/validator` that are worth reviewing. They are each short enough to read quickly. They are used to validate the shapes of various nouns to be stored in the graph-store.
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list