-
Notifications
You must be signed in to change notification settings - Fork 3
/
library.hoon
50 lines (50 loc) · 2.07 KB
/
library.hoon
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/- *resource, store=graph-store
|%
+$ comment cord
+$ book
$:
title=cord
isbn=cord
:: TODO fulltext=cord ?
==
::
:: networking datastructures.
:: the following are for tracking who to send updates to
:: not for access control. (for that look at `policies`)
+$ prim (jug @tas atom) :: for a given library name, what indexes does the reader want to hear about?
+$ readers (map ship prim) :: given a ship, what are the libraries and books per library that it cares about?
:: only we can poke ourselves with a command
+$ command
$% [%create-library library-name=@tas =policy]
[%remove-library library-name=@tas]
[%add-book library-name=@tas =book]
[%revise-book library-name=@tas top=@ new-book=book] :: XX if we had to, we could use a separate "book-diff" type instead of =book but it's not necessary
[%remove-book library-name=@tas top=@]
:: the following commands originate from your own library proxy to request a foreign library on your behalf
[%request-library rid=resource]
[%request-book rid=resource top=@]
==
::
:: anyone can poke us with an action, incl. ourselves
+$ action
$% [%add-comment library-name=@tas top=@ =comment] :: anyone can add if they are allowed
[%remove-comment library-name=@tas =index:store] :: anyone can remove their own comment
[%get-book library-name=@tas book-index=atom] :: someone else wants to now get the data for a book and hear about its updates. we should only ever hear this from a foreign library-proxy and never us ourself
:: scry wrappers
[%get-libraries ~]
[%get-books library-name=@tas]
==
::
:: poke-backs to scry wrappers
+$ response
$% [%available-libraries libraries=(set @tas)]
[%available-books library-name=@tas book-indexes=(set @)]
==
::
+$ policies (map @tas policy)
+$ policy
$% [%open ~] :: any ship is allowed
[%children ~] :: any children (i.e. moons) are allowed
[%whitelist ships=(set ship)] :: any ships in the provided set are allowed
==
--