mirror of https://github.com/perkeep/perkeep.git
141 lines
4.5 KiB
Plaintext
141 lines
4.5 KiB
Plaintext
<h1>Permanodes</h1>
|
|
|
|
<p>
|
|
Permanodes are how Camlistore models mutable data on top of an
|
|
immutable, content-addressable datastore. The data is modeled using
|
|
nodes with two camliTypes: <tt>permanode</tt> and <tt>claim</tt>.
|
|
</p>
|
|
|
|
<h2 id="permanode">Permanode</h2>
|
|
<p>
|
|
A permanode is an anchor from which you build mutable objects. To
|
|
serve as a reliable (consistently nameable) object, it must have no
|
|
mutable state itself. In fact, a permanode is really just a
|
|
<a href="/gw/doc/json-signing/json-signing.txt">signed</a> random
|
|
number.
|
|
</p>
|
|
<pre>
|
|
{"camliVersion": 1,
|
|
"camliType": "permanode",
|
|
|
|
// Required. Any random string, to force the digest of this
|
|
// node to be unique. Note that the date in the ASCII-armored
|
|
// GPG JSON signature will already help it be unique, so this
|
|
// doesn't need to be a great random.
|
|
"random": "615e05c68c8411df81a2001b639d041f"
|
|
|
|
<a href="/gw/doc/json-signing/json-signing.txt"><REQUIRED-JSON-SIGNATURE></a>}
|
|
</pre>
|
|
|
|
<h2 id="claim">Claim</h2>
|
|
<p>
|
|
A claim is any signed JSON schema blob. One common use is modifying
|
|
"attributes" on a permanode. The state of a permanode is the result
|
|
of combining all attribute-modifying claims which reference it, in
|
|
order. Claim nodes look something like this:
|
|
</p>
|
|
<pre>
|
|
{"camliVersion": 1,
|
|
"camliType": "claim",
|
|
"camliSigner": "....",
|
|
"claimDate": "2010-07-10T17:20:03.9212Z", // redundant with data in ascii armored "camliSig",
|
|
// but required. more legible. takes precedence over
|
|
// any date inferred from camliSig
|
|
"permaNode": "sha1-xxxxxxx", // what is being modified
|
|
"claimType": "set-attribute",
|
|
"attribute": "camliContent",
|
|
"value": "sha1-yyyyyyy",
|
|
"camliSig": .........}
|
|
</pre>
|
|
<p>
|
|
All claims must be <a href="/gw/doc/json-signing/json-signing.txt">signed</a>.
|
|
<p>
|
|
The anagrammatical property <tt>claimType</tt> defines what the
|
|
claim does, and is one of the following:
|
|
</p>
|
|
<ul>
|
|
<li>
|
|
<tt>add-attribute</tt>: adds a value to a multi-valued attribute
|
|
(e.g. "tag")
|
|
</li>
|
|
|
|
<li>
|
|
<tt>set-attribute</tt>: set a single-valued attribute. equivalent
|
|
to "del-attribute" of "attribute" and then add-attribute.
|
|
</li>
|
|
|
|
<li>
|
|
<tt>del-attribute</tt>: deletes all values of "attribute", if no
|
|
"value" given, or just the provided "value" if multi-valued
|
|
</li>
|
|
|
|
<li>
|
|
<tt>multi</tt>: atomically do multiple add/set/del from above on
|
|
potentially different permanodes. looks like:
|
|
<pre>
|
|
{"camliVersion": 1,
|
|
"camliType": "claim",
|
|
"claimType": "multi",
|
|
"claimDate": "2013-02-24T17:20:03.9212Z",
|
|
"claims": [
|
|
{"claimType": "set-attribute",
|
|
"permanode": "sha1-xxxxxx",
|
|
"attribute": "foo",
|
|
"value": "fooValue"},
|
|
{"claimType": "add-attribute",
|
|
"permanode": "sha1-yyyyy",
|
|
"attribute": "tag",
|
|
"value": "funny"}
|
|
],
|
|
"camliSig": .........}
|
|
</pre>
|
|
</li>
|
|
</ul>
|
|
|
|
<h2 id="attributes">Attributes</h2>
|
|
|
|
<p>
|
|
A permanode can have any attribute you like, but here are the ones
|
|
that currently mean something to Camlistore:
|
|
</p>
|
|
<ul>
|
|
<li>
|
|
<tt>tag</tt>: a set of zero or more keywords (or phrases) indexed
|
|
completely, for searching by tag. No HTML.
|
|
</li>
|
|
<li>
|
|
<tt>title</tt>: A name given to the permanode. No HTML.
|
|
</li>
|
|
<li>
|
|
<tt>description</tt>: An account of the permanode. It may include but is
|
|
not limited to: an abstract, a table of contents, or a free-text
|
|
account of the resource. No HTML.
|
|
</li>
|
|
<li>
|
|
<tt>camliContent</tt>: A reference to another blob. If a permanode
|
|
has this attribute, it's considered a pointer to its camliContent
|
|
value.
|
|
</li>
|
|
<li>
|
|
<tt>camliMember</tt>: A reference to another permanode. This
|
|
indicates that the referenced permanode is a dynamic set, and
|
|
we're a part of it.
|
|
</li>
|
|
<li>
|
|
<tt>camliPath:*</tt>: camliPath attributes are set on permanodes
|
|
which represent dynamic directories. If a permanode has attributes:
|
|
<pre>
|
|
camliPath:dir2 = $blobref_dir2_permandode
|
|
camliPath:bar.txt = $blobref_bartxt_permanode
|
|
</pre>
|
|
It will appear as a directory containing "dir2" and
|
|
"bar.txt".
|
|
<br>
|
|
These are used by a few things, including the website UI, the
|
|
"publish" code (declaring you want a photo at a URL and then the
|
|
HTTP front end resolving each directory link in
|
|
http://myhostname.com/pics/x/y/x/funny.jpg), and the FUSE
|
|
read/write filesystem code.
|
|
</li>
|
|
</ul>
|