github.com/slspeek/camlistore_namedsearch@v0.0.0-20140519202248-ed6f70f7721a/website/content/docs/schema/permanode (about)

     1  <h1>Permanodes</h1>
     2  
     3  <p>
     4    Permanodes are how Camlistore models mutable data on top of an
     5    immutable, content-addressable datastore. The data is modeled using
     6    nodes with two camliTypes: <code>permanode</code> and <code>claim</code>.
     7  </p>
     8  
     9  <h2 id="permanode">Permanode</h2>
    10  <p>
    11    A permanode is an anchor from which you build mutable objects.  To
    12    serve as a reliable (consistently nameable) object, it must have no
    13    mutable state itself. In fact, a permanode is really just a
    14    <a href="/gw/doc/json-signing/json-signing.txt">signed</a> random
    15    number.
    16  </p>
    17  <pre>
    18  {"camliVersion": 1,
    19   "camliType": "permanode",
    20  
    21   // Required.  Any random string, to force the digest of this
    22   // node to be unique.  Note that the date in the ASCII-armored
    23   // GPG JSON signature will already help it be unique, so this
    24   // doesn't need to be a great random.
    25   "random": "615e05c68c8411df81a2001b639d041f"
    26  
    27  <a href="/gw/doc/json-signing/json-signing.txt">&lt;REQUIRED-JSON-SIGNATURE&gt;</a>}
    28  </pre>
    29  
    30  <h2 id="claim">Claim</h2>
    31  <p>
    32    A claim is any signed JSON schema blob. One common use is modifying
    33    "attributes" on a permanode. The state of a permanode is the result
    34    of combining all attribute-modifying claims which reference it, in
    35    order. Claim nodes look something like this:
    36  </p>
    37  <pre>
    38  {"camliVersion": 1,
    39   "camliType": "claim",
    40   "camliSigner": "....",
    41   "claimDate": "2010-07-10T17:20:03.9212Z", // redundant with data in ascii armored "camliSig",
    42                                             // but required. more legible. takes precedence over
    43                                             // any date inferred from camliSig
    44   "permaNode": "sha1-xxxxxxx",        // what is being modified
    45   "claimType": "set-attribute",
    46   "attribute": "camliContent",
    47   "value": "sha1-yyyyyyy",
    48   "camliSig": .........}
    49  </pre>
    50  <p>
    51    All claims must be <a href="/gw/doc/json-signing/json-signing.txt">signed</a>.
    52  <p>
    53    The anagrammatical property <code>claimType</code> defines what the
    54    claim does, and is one of the following:
    55  </p>
    56  <ul>
    57    <li>
    58      <code>add-attribute</code>: adds a value to a multi-valued attribute
    59      (e.g. "tag")
    60    </li>
    61  
    62    <li>
    63      <code>set-attribute</code>: set a single-valued attribute. equivalent
    64      to "del-attribute" of "attribute" and then add-attribute.
    65    </li>
    66  
    67    <li>
    68      <code>del-attribute</code>: deletes all values of "attribute", if no
    69      "value" given, or just the provided "value" if multi-valued
    70    </li>
    71  
    72    <li>
    73      <code>multi</code>: atomically do multiple add/set/del from above on
    74      potentially different permanodes. looks like:
    75      <pre>
    76     {"camliVersion": 1,
    77      "camliType": "claim",
    78      "claimType": "multi",
    79      "claimDate": "2013-02-24T17:20:03.9212Z",
    80      "claims": [
    81           {"claimType": "set-attribute",
    82            "permanode": "sha1-xxxxxx",
    83            "attribute": "foo",
    84            "value": "fooValue"},
    85           {"claimType": "add-attribute",
    86            "permanode": "sha1-yyyyy",
    87            "attribute": "tag",
    88            "value": "funny"}
    89      ],
    90      "camliSig": .........}
    91      </pre>
    92    </li>
    93  </ul>
    94  
    95  <h2 id="attributes">Attributes</h2>
    96  
    97  <p>
    98    A permanode can have any attribute you like, but here are the ones
    99    that currently mean something to Camlistore:
   100  </p>
   101  <ul>
   102    <li>
   103      <code>tag</code>: A set of zero or more keywords (or phrases) indexed
   104      completely, for searching by tag. No HTML.
   105    </li>
   106    <li>
   107      <code>title</code>: A name given to the permanode. No HTML.
   108    </li>
   109    <li>
   110      <code>description</code>: An account of the permanode. It may include but is
   111      not limited to: an abstract, a table of contents, or a free-text
   112      account of the resource. No HTML.
   113    </li>
   114    <li>
   115      <code>camliContent</code>: A reference to another blob. If a permanode
   116      has this attribute, it's considered a pointer to its camliContent
   117      value.
   118    </li>
   119    <li>
   120      <code>camliMember</code>: A reference to another permanode. This
   121      indicates that the referenced permanode is a dynamic set, and
   122      we're a part of it.
   123    </li>
   124    <li>
   125      <code>camliPath*</code>: camliPath attributes are set on permanodes
   126      which represent dynamic directories. If a permanode has attributes:
   127      <pre>
   128      camliPath:dir2 = $blobref_dir2_permandode
   129      camliPath:bar.txt = $blobref_bartxt_permanode
   130      </pre>
   131      It will appear as a directory containing "dir2" and
   132      "bar.txt".
   133      <br>
   134      These are used by a few things, including the web UI, the
   135      "publish" code (declaring you want a photo at a URL and then the
   136      HTTP front end resolving each directory link in
   137      http://myhostname.com/pics/x/y/x/funny.jpg), and the FUSE
   138      read/write filesystem code.
   139    </li>
   140    <li>
   141      <code>camliRoot</code>: A root name for the permanode. This will cause it to
   142      show up as a named folder in the FUSE filesystem under <code>roots/</code>.
   143      Creating a directory in <code>roots/</code> will cause a new permanode to be
   144      created with this attr set. You can also browse roots in the web UI.
   145    </li>
   146  </ul>