| ERISHELL(1) | General Commands Manual | ERISHELL(1) |
erishell - ERIS language evaluator
erishell is a utility instructed by a language
specific to ERIS storage interactions.
The language aligns to the minimalist concatenative model of Joy. The most fundamental concepts within the language are stacks and programs. A stack is a collection of stacks and programs. Programs take a stack as input and produce a stack as output.
Programs may contain spaces and the parser will not split tokens containing whitespace if they are enclosed by the single-quote character ‘'’. The single-quote may be escaped with another single-quote: “'x''y'” parses to “x'y”.
The parser does not parse stacks and does not recognize [ or ].
For compatibility with the execlineb parser the
empty-string program “” creates a stack out of immediately
preceding programs that are prefixed with the ASCII space character (0x20)
with leading space character removed. By this rule the arguments
'0' ' 1 ' 2' '' would evaluate to
0 [1 2].
Documentation of the builtin programs follows. The syntax of program descriptions are INPUT | OUTPUT where the program described is at the the top (right side) of INPUT and the effect of the program is to replace INPUT with OUTPUT.
A B and- | C
Pop sets A and B then push the intersection set C. Set intersection is provided for completeness and seldom used. Use or- for the more common union of sets.
P A badger- |
S
Pop path P and set of allowed operations A then push a store backed by a BadgerDB database at that path. Unix only. BadgerDB
P A bolt- | S
Pop path P and set of allowed operations A then push a store backed by the Bolt database at that path. BoltdDB
buffer- | B
Push a memory buffer that is readable and writable.
B F cache- | B F
C
Push store C that gets blocks first from F and any missed blocks are then gotten from B and put to F.
S R cbor-decode- |
S
Pop read stream R and deserialise CBOR encoded blocks from it into store S. See CBOR Serialization of ERIS Encoded Content.
W cbor-encode- | W
S
Push store S that receives blocks and serialises them as CBOR to the stream W. See CBOR Serialization of ERIS Encoded Content.
R cbor-parse-caps- |
C Pop CBOR read stream R then
push the set of parsed ERIS read capabilities.
X close- |
Pop X and close according to its local semantics.
S O coap- | S
E
Pop set of operations O then push a local CoAP endpoint that services remote CoAP requests using the store S as allowed by O. Endpoint E is usable as a store and will service local requests using remote peers. If operations O is the null- set then S is not used. There are no means to control what operations can be made to and from CoAP peers other than limiting what operations peers can make on the store below and by what requests are made to CoAP as a store on the stack above. Create multiple CoAP endpoints to implement multiple policies. See ERIS over CoAP.
E coap-discover-link- |
E
Configure CoAP endpoint E to discover peers using the CoAP link-scope multicast address. This does not listen on the multicast address and can therefore be used while the multicast address is already in use. Use this for client endpoints that do not provide storage instead of coap-listen-link-.
E F coap-listen-link- |
E
Pop network interface pattern F then configure CoAP endpoint E to listen for and discover peers at the multicast link address on interfaces matching E. Use this for CoAP endpoints that provide storage service instead of coap-discover-link-.
E U coap-listen- |
E
Pop URL U then configure the CoAP endpoint E to listen at the specified URL. The URL must contain either a port number or a schema.
E U coap-peer- |
E
Pop URL U then add a to CoAP endpoint E a peer at the URL. The URL must contain either a port number or a schema.
convergent- |
[convergent]
W R copy- | W
Pop read stream R and copy the entire stream to write stream W.
S C decode - | S
R
Pop read capability C and push read stream R that decodes from store S.
P A dirstore- |
S
Pop path P and set of allowed operations A then push store S that puts and gets from P.
discard- | S
Push an ERIS store that discard any block put to it and fails to get anything.
S C P dumpfs- |
S
Pop the file-system path P and the read capability C then dump the ERIS-FS tree for which the capability corresponds to that path from the store S.
X dup- | X X
Duplicate the top of the stack.
S R O encode- | S
C
Pop option set O, read stream
R, encode it to store S, and
push read capability C. If the option set contains
‘convergent’ then encoding will be
non-unique. If the option set contains
‘erislink’ then the read capability is
serialised as an ERIS link held in a temporary buffer.
erislink- |
[erislink]
Push the erislink option set used by encode- and mkfs-. See ERIS link files.
X error- |
Pop X and raise it as an error.
N fd- | X
Pop natural number and push a stream that reads or writes to that file descriptor.
S P O fuse- | S
F
Pop options O and mountpoint path P then serve FUSE there from store S and push F which is closeable. The options set is for forwards compability and no options are presently recognized. Linux only.
get- | [get]
Push the set of the ‘get’
program as a stack. Can be combined with put
as ‘get- put- or-’. Equivalent to
‘get singleton-’.
halt- |
Halt the evaluation of incoming programs and revert to a previous program stream.
help- |
[…]
Push the set of all names bound to programs.
U http-client- |
S
Pop URL U then push a store that requests blocks over HTTP from that URL. Prefer CoAP. The URL must contain either a port number or a schema.
S O http- | S
H
Pop option set O then push an HTTP server backed by store S. The options set is for forwards compability and no options are presently recognized. See ERIS over HTTP.
H C P http-bind-fs- |
H
Pop request pattern P and ERIS-FS read capability C then bind a handler that services request for P from file-system C at HTTP server H
H U http-listen- |
H
Pop URL U then bind HTTP server H to it. The URL must contain either a port number or a schema.
id- |
Identity function.
X log- |
Pop and log X.
B memory- | S
Pop natural number of bits B and push a store that holds blocks in memory where blocks are indexed by the first B bits of the block reference. The approximate effective capacity of the store is 2^(B-1).
multiplexer- |
M
Push an empty store multiplexer. Add stores with multiplex-.
M S multiplex- |
M
Pop store S then add it to multiplexer M.
S P O mkfs- | S
C
Pop option set O, file-system paths
P, encode it to store S, and
push read capability C. If the option set contains
‘convergent’ then encoding will be
non-unique. If the option set contains
‘erislink’ then the read capability is
serialised as an ERIS link held in a temporary buffer. See
ERIS-FS: A
format for encoding file systems.
null- | []
Push the null set.
A B or- | C
Pop sets A and B then push the union set C.
P A pogreb- |
S
Pop path P and set of allowed operations A then push a store backed by the pogreb database at that path. Available on Unix and Plan 9. Pogreb.
X pop- |
Pop the stop of the stack. Progams that represent a stateful background task like stores and servers continue to run after being popped. The close- program is run against them automatically before termination.
put- | [put]
Push the set of the ‘put’
program as a stack. Can be combined with get
as ‘put- get- or-’. Equivalent to
‘put singleton-’.
repl- | ...
Suspend execution of the main stack then read and evaluate programs from stdin while printing results to stdout. The halt- program resumes the main stack.
X Y Z rolldown- | Y Z
X
X Y Z rollup- | Z X
Y
X Y Z rotate- | Z Y
X
X singleton- |
[X]
Pop X and push singleton set of X. Combine this with the or- program to build sets of mulitple elements.
S N srv- | ...
Pop the name N and post a 9P service channel at /srv/N backed by store S and a command channel at /srv/N.cmd. Execution of the main stack is suspended and programs are read from the command channel until the halt- program is evaluated. The main stack is then resumed with result of the command channel. ‘halt’ is aliased to halt- for compatibility reasons.
ERIS-FS can be attached by read capbability using the command
mount -C /srv/eris /n/eris
urn:eris:B4A...NHIcon -C /srv/eris.cmdPlan 9 only.
S X store-copy- |
S
Pop store X and copy all blocks to store S.
S L store-trace- | S
T
Pop label L and push a store that labels and logs all operations at store S.
Y X swap- | X
Y
wait- |
Wait for a background task to complete. Use this to run
erishell as a server.
Encode an ERIS URN:
#!/bin/sh echo -n 'Hail ERIS!' | erishell discard- 0 fd- null- encode- swap- close-
Encode an ERIS link file:
#!/usr/bin/env -S execlineb -P redirfd -r 3 test.dat redirfd -w 4 test.dat.eris erishell discard- 3 fd- convergent- erislink- or- encode- 4 fd- swap- copy- close- close-
Open and close a pogreb store so that basic consistency checks are run on the database:
/var/cache/eris.pogreb put- pogreb-
close-Open a database, encode from standard input, log the capability, then listen for CoAP peers.
/tmp/eris.pogreb get- put- or- 0 fd-
null- encode- log- get- coap- .* coap-listen-link- wait-Encode content on stdin to CBOR serialisation on stdout:
1 fd- cbor-encode- 0 fd- convergent-
encode- swap- close- swap- close-Decode CBOR serialisation from stdin to a pogreb database:
/var/cache/eris put- pogreb- 0 fd-
cbor-decode-Encode an ERIS-FS and then parse the read capabilities within:
8 memory- ./ convergent- mkfs-
decode- cbor-parse-caps-Serve an open link-scope store on wired-ethernet devices:
16 memory- get- put- or- coap- eth.*
coap-listen-link-Serve 9P backed by CoAP and a local cache:
erishell \ 'create a temporary pogreb database' log- \ /tmp/pogreb put- get- or- pogreb- \ 'push a CoAP endpoint that can get blocks from the database' log- \ get- coap- 'connect to a peer to GET from' log- \ eris.example.org:5683 coap-peer- \ 'put the local DB as a cache in front of CoAP' log \ swap- cache- \ 'announce /srv/eris using the composed stores' log- \ eris srv-
Fish function to stream into VLC:
function eris-vlc --wraps=vlc --argument-names urn
if test -z $TMPDIR
set -f TMPDIR /tmp
end
erishell \
$TMPDIR/eris.db get- put- or- pogreb- \
get- coap- \
coap-discover-link- \
eris.example.org coap-peer- \
swap- cache- \
$urn decode- \
1 fd- swap- copy- \
| vlc -
end
Transparent ERIS decoding at /n/eris:
/var/cache/eris get- pogreb- /n/eris
null- fuse- wait-Serve a static website:
erishell \ 'connect to another HTTP server for blocks' log- \ other-peer.example.org http-client- \ 'cache blocks in memory' log- \ 8 memory- cache- \ 'create an HTTP server backed by the block cache' log- \ null- http- \ 'bind an ERIS-FS to the root of virtual-host' log- \ urn:eris:B4A6A4PX75EZ4T4TBGSTQPLRNSKO7UD2EQIH6NLXBBDPECKP4IE2R74TFN5SV66JD7N52SCZ5O533P42XPQVJZMMVEEWT2IX3RYFU2NWBE \ vhost.example.org/ http-bind-fs- \ 'listen for clients' log- \ 0.0.0.0:80 http-listen- \ [::]:80 http-listen- \ 'serve clients' log- \ wait-
Create an HTP server backed by CoAP and local storage then interactively add storage and a CoAP peer.
$ erishell \ 'create a multiplexer' log- \ multiplexer- \ 'create a CoAP endpoint that serves the multiplexer' log- \ get- coap- \ 'swap the multiplexer for CoAP' log-\ swap- \ 'use the multiplexer as a cache in front of CoAP' log- \ cache- \ 'create an HTTP server that serves from the cache' log- \ null- http- \ 'pop the cache and bring CoAP and the multiplexer up' log- \ swap- pop- rollup- \ 'enter REPL' log- \ repl- \ erishell# 'add database store to multiplexer' log- erishell# /tmp/store get- put- or- pogreb- multiplex- erishell# swap- erishell# 'add CoAP peer' log- erishell# coap://eris.example.org coap-peer-
Copy a Badger store to a Pogreb store.
./eris.pogreb get- put- or- pogreb-
./eris.badger get- badger- store-copy-erishell was preceded by the eris-go(1) utility. eris-go was awkward to use. A refactor was made using an internal configuration model which could be declared as JSON and the command-line interface redesigned according to the Command Line Interface Guidelines, https://clig.dev/.
The CLIG brought eris-go close to the heavenly aspirations of UX,
but those whose thirst for arcane power condemed the interface as stupid and
limiting. In a fit of inarticulate rage, they cast the implementation into
the abyss of primordial semantic forms and it was reborn as
erishell.
Emery “hell is other peoples' tools” Hemingway