@@ -0,0 +1,193 @@
2+title = "Iris Public API"
9+In this document we describe the public interface for Iris. Namely, we describe
10+each `task` that Iris can be `%pass`ed, and which `gift`(s) Iris can `%give` in
15+Much of what Iris does is translating `task`s from other vanes into `card`s
16+meant for Unix via the `%request` and `%cancel-request` `task`s. What this means in practice is that Iris may be `%pass`ed a
17+`task` via some `duct`, which in response Iris then `%give`s a `gift` to Unix
18+via another `duct`. This `gift` will actually be a response to the `%born`
19+`task` that Iris was `%pass`ed when the Urbit was resumed, which came along the
27+Each time you start your Urbit the Arvo kernel calls the `%born` `task` for
28+Iris. This causes Iris to cancel any outstanding http requests and resets all
39+In response to a `%born` `task` Iris `give`s a `%http-response %cancel` `gift`
40+to each outstanding connection.
45+This `task` cancels a previous fetch. Iris knows which request is meant based on the
46+`duct` that the `task` comes on.
48+ We note that `%cancel-request` is also a `gift` that Iris can `%give`.
59+[%cancel-request id=@ud]
61+Receiving this `task` causes Iris to `%give`s a `%cancel-request` `gift` to Unix,
62+which then cancels the request in the runtime. See [Returns to Unix](#returns-to-unix).
64+`id` is obtained via a `(map duct @ud)`, with the `duct` corresponding to one along
65+which the `%cancel-request` `task` came with.
70+`%crud` is called whenever an error involving Iris occurs. It produces a crash
76+[p=@tas q=(list tank)]
79+`p` is the type of error, `q` is the error message.
83+Iris does not `%give` a `gift` in response to a `%crud` `task`, but it does
84+`%slip` Dill a `%flog` `task` instructing it to print the error.
89+The `%receive` `task` is used to receive a response from Unix to an `http-request` that
95+[id=@ud =http-event:http]
98+`id` is the identification number assigned by Iris to the http connection under
99+consideration. `http-event` is a packet that contains a header and data.
103+The response depends on what kind of packet `http-event` is: `%start`,
104+`%continue`, or `%cancel` and whether the `complete` flag is `%.y` or `%.n`.
106+If the packet says to `%start` or `%continue` and `complete=%.n`, Iris will `%give` a
107+`%http-response %progress` `gift`.
109+If the packet says to `%start` or `%continue` and `complete=%.y`, Iris will
110+`%give` a `%http-response %finished` `gift`.
112+If the packet says to `%cancel`, Iris will `%give` a `%http-response %cancel`
113+`gift` in return. The `complete` flag is unused here.
118+`%request` is used to fetch a remote resource. `%request` is also a `gift` Iris
124+[=request:http =outbound-config]
127+A `$request` consists of the following:
128+ - `=method`, the http method, which is one of `CONNECT`, `DELETE`, `GET`,
129+ `HEAD`, `OPTIONS`, `POST`, `PUT`, and `TRACE`.
130+ - `url=@t`, the URL being requested
131+ - `=header-list`, a list of headers to pass with the request,
132+ - `body=(unit octs)`, optional data to include in the request.
134+ A `$outbound-config` contains the number of redirects and retries that Iris
135+ will attempt. By default this is 5 redirects (the recommended limit for the
136+ http standard) and 3 retries.
141+[id=@ud request=request:http]
143+Iris will `%give` a `%request` `gift` to Unix in response to a `%request`
144+`task`. See [Returns to Unix](#returns-to-unix). This `gift`
145+contains the `request` in the original `task` as well as the ID number assigned
146+by Iris for that particular http connection, which is extracted from the input `task`.
151+This `task` is sent by the interpreter to free up memory. It has no effect on Iris.
161+This `task` returns no `gift`s.
166+This `task` informs the vane that the kernel has been upgraded. Iris does not do
167+anything in response to this.
177+This `task` returns no `gift`s.
182+This `task` asks Iris to product a memory usage report.
186+This `task` has no arguments.
190+When Iris is `%pass`ed this `task`, it will `%give` a `%mass` `gift` in response
191+containing Iris' current memory usage.