@@ -23,7 +23,7 @@ state is persistent.
23In a more traditional OS, everything in RAM can be erased at any
23In a more traditional OS, everything in RAM can be erased at any
24time by power failure, and is always erased on reboot. Thus, a
24time by power failure, and is always erased on reboot. Thus, a
25primary purpose of a filesystem is to ensure files persist across
25primary purpose of a filesystem is to ensure files persist across
26−power failures and reboots. In Arvo, both power failures and
26+power failures and reboots. In Arvo, both power failures and
27reboots are special cases of suspending computation, which is
27reboots are special cases of suspending computation, which is
28done safely since our event log is already persistent. Therefore,
28done safely since our event log is already persistent. Therefore,
29Clay is not needed in Arvo for persistence. Why, then, do we have a
29Clay is not needed in Arvo for persistence. Why, then, do we have a
@@ -37,7 +37,7 @@ tree. It is easy and intuitive to read from and write to a
37filesystem tree.
37filesystem tree.
39Second, Clay has a distributed revision-control system baked into
39Second, Clay has a distributed revision-control system baked into
40−it. Traditional filesystems are not revision controlled, so
40+it. Traditional filesystems are not revision controlled, so
41userspace software -- such as git -- is written on top of them to
41userspace software -- such as git -- is written on top of them to
42do so. Clay natively provides the same functionality as modern
42do so. Clay natively provides the same functionality as modern
43DVCSes, and more.
43DVCSes, and more.
@@ -101,25 +101,25 @@ the topmost commit is always numbered, and every numbered commit
101is an ancestor of every later numbered commit.
101is an ancestor of every later numbered commit.
103There are three ways to refer to particular commits in the
103There are three ways to refer to particular commits in the
104−revision history. Firstly, one can use the revision number.
104+revision history. Firstly, one can use the revision number.
105Secondly, one can use any absolute time between the one numbered
105Secondly, one can use any absolute time between the one numbered
106commit and the next (inclusive of the first, exclusive of the
106commit and the next (inclusive of the first, exclusive of the
107second). Thirdly, every `desk` has a `map` of labels to revision
107second). Thirdly, every `desk` has a `map` of labels to revision
108numbers. These labels may be used to refer to specific commits.
108numbers. These labels may be used to refer to specific commits.
110Additionally, Clay is a global filesystem, so data on other urbits
110Additionally, Clay is a global filesystem, so data on other urbits
111−is easily accessible the same way as data on our local urbit. In
111+is easily accessible the same way as data on our local urbit. In
112general, the path to a particular revision of a `desk` is
112general, the path to a particular revision of a `desk` is
113−`/~urbit-name/desk-name/revision`. Thus, to get `/try/readme/md`
113+`/~urbit-name/desk-name/revision`. Thus, to get `/try/readme/md`
114from revision 5 of the home `desk` on `~sampel-sipnym`, we refer to
114from revision 5 of the home `desk` on `~sampel-sipnym`, we refer to
115−`/~sampel-sipnym/home/5/try/readme/md`. Clay's namespace is thus
115+`/~sampel-sipnym/home/5/try/readme/md`. Clay's namespace is thus
116global and referentially transparent.
116global and referentially transparent.
118### A Typed Filesystem
118### A Typed Filesystem
120Since Clay is a general filesystem for storing data of arbitrary
120Since Clay is a general filesystem for storing data of arbitrary
121types, in order to revision control correctly it needs to be
121types, in order to revision control correctly it needs to be
122−aware of types all the way through. Traditional revision control
122+aware of types all the way through. Traditional revision control
123does an excellent job of handling source code, so for source code
123does an excellent job of handling source code, so for source code
124we act very similar to traditional revision control. The
124we act very similar to traditional revision control. The
125challenge is to handle other data similarly well.
125challenge is to handle other data similarly well.
@@ -145,7 +145,7 @@ branches and merged at will.
145Suppose Alice is tasked with touching up a picture, improving the
145Suppose Alice is tasked with touching up a picture, improving the
146color balance, adjusting the contrast, and so forth, while Bob
146color balance, adjusting the contrast, and so forth, while Bob
147has the job of cropping the picture to fit where it's needed and
147has the job of cropping the picture to fit where it's needed and
148−adding textual overlay. Without type-aware revision control,
148+adding textual overlay. Without type-aware revision control,
149these changes must be made serially, requiring Alice and Bob to
149these changes must be made serially, requiring Alice and Bob to
150explicitly coordinate their efforts. With type-aware revision
150explicitly coordinate their efforts. With type-aware revision
151control, these operations may be performed in parallel, and then
151control, these operations may be performed in parallel, and then
@@ -168,87 +168,11 @@ different sentences may be flagged as a conflict. In general,
168prose should be diffed by sentence, not by line.
168prose should be diffed by sentence, not by line.
170As far as we are aware, Clay is the first generalized,
170As far as we are aware, Clay is the first generalized,
171−type-aware revision control system. We'll go into the workings
171+type-aware revision control system. We'll go into the workings
172of this system in some detail.
172of this system in some detail.
176−Central to a typed filesystem is the idea of types. In Clay, we
176+Central to a typed filesystem is the idea of file types. In Clay, we
177−call these `mark`s. A `mark` is a file that defines a type,
177+call these `mark`s. See the [Marks](/docs/arvo/clay/marks/marks)
178−conversion routines to and from the `mark`, and diff, patch, and
178+section for more details.
181−For example, a `%txt` mark may be a list of lines of text, and it
182−may include conversions to `%mime` to allow it to be serialized
183−and sent to a browser or to the Unix filesystem. It will also
184−include Hunt-McIlroy diff, patch, and merge algorithms.
186−A `%json` `mark` would be defined as a JSON object in the code, and
187−it would have a parser to convert from `%txt` and a printer to
188−convert back to `%txt`. The diff, patch, and merge algorithms are
189−fairly straightforward for JSON, though they're very different
192−More formally, a `mark` is a core with three [arms](/docs/glossary/arm/): `+grab`,
193−`+grow`, and `+grad`. In `+grab` is a series of functions to
194−convert from other `mark`s to the given `mark`. In `+grow` is a
195−series of functions to convert from the given `mark` to other
196−`mark`s. In `+grad` is `+diff`, `+pact`, `+join`, and `+mash`, and
199−The types are as follows, in an informal pseudocode:
203− ++ mime: <mime> -> <mark-type>
204− ++ txt: <txt> -> <mark-type>
207− ++ mime: <mark-type> -> <mime>
208− ++ txt: <mark-type> -> <txt>
211− ++ form: <mark-type>
212− ++ diff: (<mark-type>, <mark-type>) -> <diff-type>
213− ++ pact: (<mark-type>, <diff-type>) -> <mark-type>
214− ++ join: (<diff-type>, <diff-type>) -> <diff-type> or NULL
215− ++ mash: (<diff-type>, <diff-type>) -> <diff-type>
218−These types are basically what you would expect. Not every `mark`
219−has each of these functions defined -- all of them are optional
222−In general, for a particular `mark`, the `+grab` and `+grow` entries
223−(if they exist) should be inverses of each other.
225−In `+grad`, `+diff` takes two instances of a `mark` and produces a diff of them
226−whose `mark` is given by `+form`. `+pact` takes an instance of a `mark` and
227−patches it with the given diff. `+join` takes two diffs and attempts to merge
228−them into a single diff. If there are conflicts, it produces null. `+mash` takes
229−two diffs and forces a merge, annotating any conflicts.
231−In general, if `+diff` called with A and B produces diff D, then
232−`+pact` called with A and D should produce B. Also, if `+join`
233−of two diffs does not produce null, then `+mash` of the same
234−diffs should produce the same result.
236−Alternately, instead of `+diff`, `+pact`, `+join`, and
237−`+mash`, a `mark` can provide the same functionality by defining
238−`+grad` to be the name of another `mark` to which we wish to
239−delegate the revision control responsibilities. Then, before
240−running any of those functions, Clay will convert to the other
241−`mark`, and convert back afterward. For example, the `%hoon` `mark`
242−is revision-controlled in the same way as `%txt`, so its `+grad`
243−is simply `++ grad %txt`. Of course, `+txt` must be defined in
244−`+grow` and `+grab` as well.
246−Every file in Clay has a `mark`, and that `mark` must have a
247−fully-functioning `+grad`. `Mark`s are used for more than just
248−Clay, and other `mark`s don't need a `+grad`, but if a piece of
249−data is to be saved to Clay, we must know how to revision-control
252−Additionally, if a file is to be synced out to Unix, then it must
253−have conversion routines to and from the `%mime` `mark`.