on master help sign in
working through vanes
commit6f8cb1e6256c0fe658005539ce8767a6be9fbf65 authorGalen Wolfe-Pauly <mailroom@office-for.com> dateTue 16 Feb 2016, 21:12 (11 years ago) parent3eb13b8
12 files changed+243−117
docs/system/arvo.md+150 docs/system/arvo/ames.md+3−5 docs/system/arvo/ames/commentary.md+1−1 docs/system/arvo/behn.md+21 docs/system/arvo/clay.md+3−5 docs/system/arvo/dill.md+4−6 docs/system/arvo/eyre.md+3−8 docs/system/arvo/ford.md+19−36 docs/system/arvo/gall.md+21−50 docs/system/hoon.md+9 docs/system/hoon/runes.md−6 docs/system/nock.md+9
docs/system/arvo.mdnew file+150
@@ -0,0 +1,150 @@
1+---
2+sort: 3
3+---
4+
5+arvo
6+====
7+
8+Our operating system.
9+
10+arvo is composed of modules called vanes:
11+
12+<list dataPreview="true"></list>
13+
14+<hr></hr>
15+
16+At a high level `%arvo` takes a mess of unix io events and turns them
17+into something clean and structured for the programmer.
18+
19+`%arvo` is designed to avoid the usual state of complex event networks:
20+event spaghetti. We keep track of every event's cause so that we have a
21+clear causal chain for every computation. At the bottom of every chain
22+is a unix io event, such as a network request, terminal input, file
23+sync, or timer event. We push every step in the path the request takes
24+onto the chain until we get to the terminal cause of the computation.
25+Then we use this causal stack to route results back to the caller.
26+
27+`++ducts`
28+---------
29+
30+The `%arvo` causal stack is called a `++duct`. This is represented
31+simply as a list of paths, where each path represents a step in the
32+causal chain. The first element in the path is the first letter of
33+whichever vane handled that step in the computation, or the empty span
34+for unix.
35+
36+Here's a duct that was recently observed in the wild:
37+
38+ ~[
39+ /g/a/~zod/4_shell_terminal/u/time
40+ /g/a/~zod/shell_terminal/u/child/4/main
41+ /g/a/~zod/terminal/u/txt
42+ /d/term-mess
43+ //term/1
44+ ]
45+
46+This is the duct the timer vane receives when "timer" sample app asks
47+the timer vane to set a timer. This is also the duct over which the
48+response is produced at the specified time. Unix sent a terminal
49+keystroke event (enter), and arvo routed it to %dill(our terminal),
50+which passed it on to the %gall app terminal, which sent it to shell,
51+its child, which created a new child (with process id 4), which on
52+startup asked the timer vane to set a timer.
53+
54+The timer vane saves this duct, so that when the specified time arrives
55+and unix sends a wakeup event to the timer vane, it can produce the
56+response on the same duct. This response is routed to the place we
57+popped off the top of the duct, i.e. the time app. This app produces the
58+text "ding", which falls down to the shell, which drops it through to
59+the terminal. Terminal drops this down to dill, which converts it into
60+an effect that unix will recognize as a request to print "ding" to the
61+screen. When dill produces this, the last path in the duct has an
62+initial element of the empty span, so this is routed to unix, which
63+applies the effects.
64+
65+This is a call stack, with a crucial feature: the stack is a first-class
66+citizen. You can respond over a duct zero, one, or many times. You can
67+save ducts for later use. There are definitely parallels to Scheme-style
68+continuations, but simpler and with more structure.
69+
70+Making Moves
71+------------
72+
73+If ducts are a call stack, then how do we make calls and produce
74+results? Arvo processes "moves" which are a combination of message data
75+and metadata. There are two types of moves. A `%pass` move is analogous
76+to a call:
77+
78+ [duct %pass return-path=path vane-name=@tD data=card]
79+
80+Arvo pushes the return path (preceded by the first letter of the vane
81+name) onto the duct and sends the given data, a card, to the vane we
82+specified. Any response will come along the same duct with the path
83+`return-path`.
84+
85+A `%give` move is analogous to a return:
86+
87+ [duct %give data=card]
88+
89+Arvo pops the top path off the duct and sends the given card back to the
90+caller.
91+
92+Vanes
93+-----
94+
95+As shown above, we use arvo proper to route and control the flow of
96+moves. However, arvo proper is rarely directly responsible for
97+processing the event data that directly causes the desired outcome of a
98+move. This event data is contained within a card, which is simply a
99+`(pair term noun)`. Instead, arvo proper passes the card off to one of
100+its vanes, which each present an interface to clients for a particular
101+well-defined, stable, and general-purpose piece of functionality.
102+
103+As of this writing, we have seven vanes, which each provide the
104+following services:
105+
106+- `%ames` name of both our network and the vane that communicates over
107+ it
108+- `%clay` version-controlled, referentially- transparent, and global
109+ filesystem
110+- `%dill` terminal driver. Unix sends keyboard events to `%dill` from
111+ either the console or telnet, and `%dill` produces terminal output.
112+- `%eyre` http server. Unix sends http messages to `%eyre`, and
113+ `%eyre` produces http messages in response
114+- `%ford` handles resources and publishing
115+- `%gall` manages our userspace applications.. `%gall` keeps state and
116+ manages subscribers
117+- `%time` a simple timer
118+
119+Cards
120+-----
121+
122+Cards are the vane-specific portion of a move. Each vane defines a
123+protocol for interacting with other vanes (via arvo) by defining four
124+types of cards: kisses, gifts, notes, and signs.
125+
126+When one vane is `%pass`ed a card in its `++kiss`, arvo activates the
127+`++call` gate with the card as its argument. To produce a result, the
128+vane `%give`s one of the cards defined in its `++gift`. If the vane
129+needs to request something of another vane, it `%pass`es it a `++note`
130+card. When that other vane returns a result, arvo activates the `++take`
131+gate of the initial vane with one of the cards defined in its `++sign`.
132+
133+In other words, there are only four ways of seeing a move: (1) as a
134+request seen by the caller, which is a ++note. (2) that same request as
135+seen by the callee, a `++kiss`. (3) the response to that first request
136+as seen by the callee, a `++gift`. (4) the response to the first request
137+as seen by the caller, a `++sign`.
138+
139+When a `++kiss` card is passed to a vane, arvo calls its `++call` gate,
140+passing it both the card and its duct. This gate must be defined in
141+every vane. It produces two things in the following order: a list of
142+moves and a possibly-modified copy of its context. The moves are used to
143+interact with other vanes, while the new context allows the vane to save
144+its state. The next time arvo activates the vane it will have this
145+context as its subject.
146+
147+This overview has detailed how to pass a card to a particular vane. To
148+see the cards each vane can be `%pass`ed as a `++kiss` or return as a
149+`++gift` (as well as the semantics tied to them), each vane's public
150+interface is explained in detail in its respective overview.
docs/system/arvo/ames.md+3−5
@@ -1,4 +1,6 @@
1−<div class="short">
1+---
2+sort: 1
3+---
24
35`%ames`
46=======
@@ -22,8 +24,4 @@ routing is handled entirely in `%ames`. Finally, the actual `%ames`
2224protocol itself, including how to route incoming packets to the correct
2325vane or app, is defined in `%ames`.
2426
25−</div>
26−
27−<hr>
28−</hr>
2927<list></list>
docs/system/arvo/ames/commentary.md+1−1
@@ -1812,4 +1812,4 @@ XXX
18121812 ++ name ,[p=@t q=(unit ,@t) r=(unit ,@t) s=@t] :: first mid/nick last
18131813
18141814This is the given name, possible middle name/initial, possible nickname,
1815−and surname of a user.
1815+and surname of a user.
docs/system/arvo/behn.mdnew file+21
@@ -0,0 +1,21 @@
1+---
2+sort: 2
3+---
4+
5+`%behn`
6+=======
7+
8+Our simple timer.
9+
10+It allows vanes and applications to set and timer events, which are
11+managed in a simple priority queue. `%behn` produces effects to start
12+the unix timer, and when the requested `%behn` passes, unix sends wake
13+events to `%behn`, which time routes back to original sender. We don't
14+guarantee that a timer event will happen at exactly the `%behn` it was
15+set for, or even that it'll be particularly close. A timer event is a
16+request to not be woken until after the given time.
17+
18+`%eyre` uses `%behn` for timing out sessions, and `%clay` uses `%behn`
19+for keeping track of time-specified file requests. `%ames` should
20+probably use `%behn` to keep track of things like network timeouts and
21+retry timing, but it currently uses its own alarm system.
docs/system/arvo/clay.md+3−5
@@ -1,4 +1,6 @@
1−<div class="short">
1+---
2+sort: 3
3+---
24
35`%clay`
46=======
@@ -20,8 +22,4 @@ zuse. Second is the write, query, and subscription logic. Finally, there
2022is the logic for communicating requests to, and receiving requests from,
2123foreign ships.
2224
23−</div>
24−
25−------------------------------------------------------------------------
26−
2725<list></list>
docs/system/arvo/dill.md+4−6
@@ -1,4 +1,6 @@
1−<div class="short">
1+---
2+sort: 4
3+---
24
35`%dill`
46=======
@@ -20,8 +22,4 @@ password), which duct to produce effects on, and so forth. Second, it
2022handles terminal events, keystroke by keystroke. Most characters are
2123simply pushed onto the buffer and blitted to the screen, but some
2224characters, including control-modified keys, arrow keys, etc. require
23−special handling. Most of the readline functionality is in `%dill`.
24−
25−</div>
26−
27−------------------------------------------------------------------------
25+special handling. Most of the readline functionality is in `%dill`.
docs/system/arvo/eyre.md+3−8
@@ -1,4 +1,6 @@
1−<div class="short">
1+---
2+sort: 5
3+---
24
35`%eyre`
46=======
@@ -16,10 +18,6 @@ essentially stateless, like functional publishing with `%ford`.
1618Additionally, there's a fairly significant component that handles
1719`%gall` messaging and subscriptions, which must be stateful.
1820
19−</div>
20−
21−------------------------------------------------------------------------
22−
2321HTTP Methods
2422============
2523
@@ -57,7 +55,4 @@ Unsubscribe from stream `[stream]` on a foreign Urbit.
5755urb.js
5856======
5957
60−
61−<hr>
62−</hr>
6358<list></list>
docs/system/arvo/ford.md+19−36
@@ -1,4 +1,7 @@
1−<div class="short">
1+---
2+sort: 6
3+---
4+
25
36`%ford`
47=======
@@ -19,16 +22,10 @@ while `%gall` uses `%ford` to control the execution of applications.
1922`%clay` is intended to use `%ford` to managed marked data, but this is
2023not yet reality.
2124
22−</div>
23−
24−------------------------------------------------------------------------
25−
2625<list></list>
2726
28−------------------------------------------------------------------------
29−
3027Cards
31−=====
28+-----
3229
3330`%ford` accepts just one card, `%exec`. This is misleading, however,
3431since there are fourteen different `silk`s that may be used with it. In
@@ -39,90 +36,76 @@ dependencies.
3936Silks may autocons, so that the product of a cell of silks is a cell of
4037the product of the two silks.
4138
42−`%bake`
43−================
39+### `%bake`
4440
4541Tries to functionally produce the file at a given beam with the given
4642mark and heel. It fails if there is no way to translate at this level.
4743
48−`%boil`
49−================
44+### `%boil`
5045
5146Functionally produces the file at a given beam with the given mark and
5247heel. If there is no way to translate at this beam, we pop levels off
5348the stack and attempt to bake there until we find a level we can bake.
5449This should almost always be called instead of `%bake`.
5550
56−`%call`
57−================
51+### `%call`
5852
5953Slams the result of one silk against the result of another.
6054
61−`%cast`
62−================
55+### `%cast`
6356
6457Translates the given silk to the given mark, if possible. This is one of
6558the critical and fundamental operations of ford.
6659
67−`%diff`
68−================
60+### `%diff`
6961
7062Diffs the two given silks (which must be of the same mark), producing a
7163cage of the mark specified in `++mark` in `++grad` for the mark of the
7264two silks.
7365
74−`%done`
75−================
66+### `%done`
7667
7768Produces exactly its input. This is rarely used on its own, but many
7869silks are recursively defined in terms of other silks, so we often need
7970a silk that simply produces its input. A monadic return, if you will.
8071
81−`%dude`
82−================
72+### `%dude`
8373
8474Computes the given silk with the given tank as part of the stack trace
8575if there is an error.
8676
87−`%dune`
88−================
77+### `%dune`
8978
9079Produces an error if the cage is empty. Otherwise, it produces the value
9180in the unit.
9281
93−`%mute`
94−================
82+### `%mute`
9583
9684Takes a silk and a list of changes to make to the silk. At each wing in
9785the list we put the value of the associated silk.
9886
99−`%pact`
100−================
87+### `%pact`
10188
10289Applies the second silk as a patch to the first silk. The second silk
10390must be of the mark specified in `++mark` in `++grad` for the mark of
10491the first silk.
10592
106−`%plan`
107−================
93+### `%plan`
10894
10995Performs a structured assembly directly. This is not generally directly
11096useful because several other silks perform supersets of this
11197functionality. We don't usually have naked hoods outside ford.
11298
113−`%reef`
114−================
99+### `%reef`
115100
116101Produces a core containing the entirety of zuse and hoon, suitable for
117102running arbitrary code against. The mark is `%noun`.
118103
119−`%ride`
120−================
104+### `%ride`
121105
122106Slaps a twig against a subject silk. The mark of the result is `%noun`.
123107
124−`%vale`
125−================
108+### `%vale`
126109
127110Validates untyped data from a ship against a given mark. This is an
128111extremely useful function.
docs/system/arvo/gall.md+21−50
@@ -1,4 +1,7 @@
1−<div class="short">
1+---
2+sort: 7
3+---
4+
25
36`%gall`
47=======
@@ -20,27 +23,19 @@ applications. Eyre exposes `%gall`'s interface over http, and ames does
2023the same over the ames network. `%gall` uses ford to compile and run the
2124applications.
2225
23−</div>
24−
25−------------------------------------------------------------------------
26−
2726Cards
28−=====
27+-----
2928
3029`%gall` accepts the following cards. The first three are the most
3130commonly used, while the others are primarily used internally.
3231
33−`%mess`
34−================
32+### `%mess`
3533
3634Sends a message to an app. This will result in a call to the app's
3735`++poke` arm. The response is exactly one of a `%nice` if the action
3836succeeded or a `%mean` if not.
3937
40−------------------------------------------------------------------------
41−
42−`%show`
43−================
38+### `%show`
4439
4540Subscribes to a stream from an app. This will result in a call to the
4641app's either `++peek` or `++peer` arm. The first response will always be
@@ -51,36 +46,26 @@ either a differntial or full update to the data stream. There may be a
5146`%mean`, which indicates that the subscription has been canceled and no
5247more responses will be received along this stream.
5348
54−------------------------------------------------------------------------
5549
56−`%nuke`
57−================
50+### `%nuke`
5851
5952Unsubscribes the current duct from its stream. This receives a response
6053of either a `%nice` or a `%mean`. Note that a response of `%nice` does
6154not imply that the current duct was in fact subscribed to any stream.
6255
63−------------------------------------------------------------------------
64−
65−`%init`
66−================
56+### `%init`
6757
6858Initializes a ship's apps. This should be called exactly once for each
6959ship on the pier. This produces no moves in response.
7060
71−------------------------------------------------------------------------
72−
73−`%sire`
74−================
61+### `%sire`
7562
7663Instantiates a child app. The app will be at path `[p parent-path]`, and
7764it will be an instance of the `q` app. The only response will be `%gone`
7865when the child dies.
7966
80−------------------------------------------------------------------------
8167
82−`%rote`
83−================
68+### `%rote`
8469
8570Signifies a remote request from ames. `r` should be of type `rook`. This
8671how an app on a foreign ship may send a `%mess`, `%show`, or `%nuke`
@@ -90,10 +75,8 @@ should use `%rote` and `%roth` is ames. Formally, the response is either
9075a `%nice` or a `%mean`, which ames uses to give a positive or negative
9176ack. A logical response comes by passing a `%roth` card.
9277
93−------------------------------------------------------------------------
9478
95−`%roth`
96−================
79+### `%roth`
9780
9881Gives the response received from a remote request. `r` should be of type
9982`roon`. This is how an app responds to a foreign request with a `%rush`,
@@ -102,10 +85,8 @@ Gives the response received from a remote request. `r` should be of type
10285need to acknowledge these responses since they're really independent
10386one-way messages.
10487
105−------------------------------------------------------------------------
10688
107−`%wipe`
108−================
89+### `%wipe`
10990
11091Wipes the given app from memory. This is generally considered a hack,
11192but it is sometimes useful during development to wipe the state of an
@@ -113,10 +94,8 @@ app. We don't guarantee that this actually completely wipes the app.
11394Generally, you want to use a `%cide` card if you actually want to kill
11495an app. This gives no response.
11596
116−------------------------------------------------------------------------
11797
118−`%cide`
119−================
98+### `%cide`
12099
121100Kills an app and all its children. Even though it's not technically a
122101part of `%gall`'s interface since it's not in `++kiss` and can't be
@@ -124,38 +103,30 @@ called from the outside, it's worth mentioning `%cide`, which may be
124103called from within `%gall` apps. It should call `++part` to allow the
125104app any last words. This gives no response.
126105
127−------------------------------------------------------------------------
128−
129106Service Gates
130−=============
107+-------------
131108
132−[`++poke`]()
133−============
109+### `++poke`
134110
135111Handles incoming messages. Most commonly with an associated `%logo`. For
136112example `++poke-json` handles an incoming JSON request from `%eyre`.
137113
138−[`++peer`]()
139−============
114+### `++peer`
140115
141116Handles incoming subscriptions.
142117
143−[`++pull`]()
144−============
118+### `++pull`
145119
146120Handles dropping subscribers.
147121
148−[`++pour`]()
149−============
122+### `++pour`
150123
151124Handles responses to `%pass` moves.
152125
153−[`++park`]()
154−============
126+### `++park`
155127
156128Save state on update.
157129
158−[`++prep`]()
159−============
130+### `++prep`
160131
161132Load state on update.
docs/system/hoon.mdnew file+9
@@ -0,0 +1,9 @@
1+---
2+sort: 2
3+---
4+
5+# `hoon`
6+
7+Hoon is our programming language.
8+
9+<list></list>
docs/system/hoon/runes.md−6
@@ -1,5 +1,3 @@
1−<div class="short">
2−
31Runes
42=====
53
@@ -12,10 +10,6 @@ find documentation on each individual category, follow these links:
1210
1311<list></list>
1412
15−<search/>
16−
17−</div>
18−
1913------------------------------------------------------------------------
2014
2115Introduction
docs/system/nock.mdnew file+9
@@ -0,0 +1,9 @@
1+---
2+sort: 1
3+---
4+
5+# `nock`
6+
7+Nock is our virtual machine. For an in-depth exploration of Nock, see the [Nock Tutorial](/docs/deep-dives). This reference steps through the requisite definitions and each step of the Nock function.
8+
9+<list></list>