mirror of
https://github.com/sigilante/global-store.git
synced 2024-11-27 06:03:30 +03:00
Post 1.0.0
This commit is contained in:
parent
b13fdf2544
commit
4169429c39
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2023 Sigilante
|
Copyright (c) 2023 Urbit Foundation
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
88
README.md
88
README.md
@ -1,79 +1,77 @@
|
|||||||
# `%global-store`
|
# `%gs` Global Store
|
||||||
|
|
||||||
_a simple key-value storage solution for ship-global values_
|
_a simple key-value storage solution for ship-global values_
|
||||||
|
|
||||||
_"making people behave like they care about integration by giving them easier inroads" (~rabsef-bicrym)_
|
_"making people behave like they care about integration by giving them easier inroads" (~rabsef-bicrym)_
|
||||||
|
|
||||||
`%global-store` intends to solve the problem of ship-wide configuration and
|
`%gs` intends to solve the problem of ship-wide configuration and
|
||||||
settings without any json compatibility overhead
|
settings without any json compatibility overhead
|
||||||
|
|
||||||
it's simply a map for desks and keys to vases of values.
|
it's simply a map for desks and keys to vases of values.
|
||||||
|
|
||||||
some things you could use it for:
|
some things you could use it for:
|
||||||
|
|
||||||
- [`l10n`](https://github.com/sigilante/l10n) localization settings like
|
- localization settings
|
||||||
preferred language or script or currency
|
- visual preferences (dark mode)
|
||||||
- secret keys (pending urbit security)
|
- secret keys (pending hardened urbit security)
|
||||||
- profile features beyond `%groups`
|
- profile features beyond `%groups`
|
||||||
|
|
||||||
just set and scry
|
just set and scry (or subscribe)
|
||||||
|
|
||||||
###### pokes
|
###### pokes
|
||||||
|
|
||||||
- `[%let =desk]` creates a desk key-value store (kvs)
|
- `%put` - put a value with a key onto a desk's kvs
|
||||||
- `[%lie =desk]` removes a desk kvs
|
- `%del` - delete a key in a desk's kvs (rm)
|
||||||
- `[%put =desk =key =value]` puts a key in a desk's kvs (key is a vase)
|
- `%lop` - delete keys in a desk's kvs (rm -r)
|
||||||
- `[%del =desk =key]` removes a key
|
::
|
||||||
- `[%mode =arena =perm]` sets perms (see below)
|
- `%enroll` - put an arena on the roll
|
||||||
- `[%whitelist =ship =perm]` add a ship to whitelist for perms (see below)
|
- `%unroll` - remove an arena from the roll
|
||||||
- `[%blacklist =ship]` removes a ship from whitelist (so not really a true blacklist)
|
- `%lockdown` - set only self to read-write perms for a desk
|
||||||
- `[%lockdown ~]` removes all perms except yours
|
|
||||||
|
|
||||||
###### peeks
|
###### peeks
|
||||||
|
|
||||||
you can peek for a value at `/[desk]/[key]` which returns a `(unit vase)`
|
- `/x/desk/[desk]`
|
||||||
|
- `/x/desk/key/[desk]/[key]`
|
||||||
you can peek for all of a desk's values at `/[desk]` which returns a
|
- `/x/u/desk/[desk]` existence check
|
||||||
`(unit (map @tas vase))`
|
- `/x/u/desk/key/[desk]/[key]` existence check
|
||||||
|
|
||||||
###### subscriptions
|
###### subscriptions
|
||||||
|
|
||||||
you can subscribe to a value at `/[desk]/[key]` for a gift every time it changes
|
- `/desk/[desk]`
|
||||||
|
- `/desk/key/[desk]/[key]`
|
||||||
you can subscribe to all of a desk's values at `/[desk]` for a gift every time
|
- `/u/desk/[desk]`
|
||||||
any value changes
|
- `/u/desk/key/[desk]/[key]`
|
||||||
|
|
||||||
###### perms
|
###### perms
|
||||||
|
|
||||||
there's not currently a per-agent permissions model altho i'm not averse to that
|
|
||||||
|
|
||||||
right now you can set perms by:
|
right now you can set perms by:
|
||||||
|
|
||||||
1. `our` - always `%w` so you can write (`%w` implies `%r`)
|
- `%moon` - moons if you're a planet
|
||||||
2. `%moon` - by default your team can `%w` write
|
- `%orbit` - moons under same parent (if you're a moon)
|
||||||
3. `roll` - you can add ships to a whitelist to `%r` read or `%w` write
|
- `%kids` - sponsees (azimuth sense)
|
||||||
4. `%public` - or you can let everyone `%r` read
|
- `%public` - free for all
|
||||||
|
- `%ship` - whitelist
|
||||||
|
|
||||||
|
set types:
|
||||||
|
|
||||||
|
- `%r` - read
|
||||||
|
- `%w` - write
|
||||||
|
|
||||||
###### some useful snippets
|
###### some useful snippets
|
||||||
|
|
||||||
```hoon
|
```hoon
|
||||||
=global -build-file /=global-store=/sur/global-store/hoon
|
=gs -build-file /=gs=/sur/gs/hoon
|
||||||
:global-store &global-store-action [%let %example]
|
::
|
||||||
:global-store &global-store-action [%put %example %message !>('hello world')]
|
:gs|put :: :gs|put %desk /key/to noun+!>(42)
|
||||||
:global-store &global-store-action [%put %example %locale !>('en-US-Dsrt')]
|
:gs|del :: :gs|del %desk /key/to
|
||||||
:global-store +dbug
|
:gs|lop :: :gs|lop %desk /key/to
|
||||||
.^((unit (map @tas vase)) %gx /=global-store=/example/noun)
|
::
|
||||||
.^((unit vase) %gx /=global-store=/example/message/noun)
|
:gs|enroll :: :gs|enroll %desk /key/to arena perm
|
||||||
:global-store &global-store-action [%lie %example]
|
:gs|unroll :: :gs|unroll %desk /key/to arena :gs|lockdown :: :gs|lockdown %desk
|
||||||
:global-store +dbug
|
::
|
||||||
|
:gs +dbug
|
||||||
```
|
```
|
||||||
|
|
||||||
###### status (wip ~2023.3.4)
|
###### changelog
|
||||||
|
|
||||||
- [x] main code (pokes, peeks) works
|
- `[1 0 0]` first public release, pokes/peeks/subs
|
||||||
- [ ] test subs
|
|
||||||
- [ ] decide about return marks/units
|
|
||||||
- [ ] write generators to use pokes
|
|
||||||
- [ ] use whitelist for real tho
|
|
||||||
|
|
||||||
- [ ] version `%one` should rework perms to be per-desk instead of global
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
:: /sur/global-store.hoon
|
:: /app/gs.hoon
|
||||||
:::: ~lagrev-nocfep & ~midden-fabler
|
:::: ~lagrev-nocfep & ~midden-fabler
|
||||||
:: Version ~2023.11.9
|
:: Version ~2023.11.9
|
||||||
::
|
::
|
||||||
|
:: GLOBAL STORE
|
||||||
|
::
|
||||||
:: a simple key-value storage solution for ship-global values
|
:: a simple key-value storage solution for ship-global values
|
||||||
:: with a straightforward permissions model
|
:: with a straightforward permissions model
|
||||||
::
|
::
|
||||||
@ -27,12 +29,18 @@
|
|||||||
:: receiving a gift in return
|
:: receiving a gift in return
|
||||||
::
|
::
|
||||||
:: for a value you'll peek to
|
:: for a value you'll peek to
|
||||||
:: /x/desk/[desk] or /x/desk/key/[desk]/[key]
|
:: /x/desk/[desk]
|
||||||
:: or subscribe to /desk/[desk] or /desk/key/[desk]/[key]
|
:: /x/desk/key/[desk]/[key]
|
||||||
|
:: /x/u/desk/[desk]
|
||||||
|
:: /x/u/desk/key/[desk]/[key]
|
||||||
|
::
|
||||||
|
:: or subscribe to
|
||||||
|
:: /desk/[desk]
|
||||||
|
:: /desk/key/[desk]/[key]
|
||||||
::
|
::
|
||||||
:: the advantage of subscribing is that you receive changes to the value
|
:: the advantage of subscribing is that you receive changes to the value
|
||||||
::
|
::
|
||||||
/- *global-store,
|
/- *gs,
|
||||||
update
|
update
|
||||||
/+ dbug,
|
/+ dbug,
|
||||||
default-agent,
|
default-agent,
|
||||||
@ -62,7 +70,7 @@
|
|||||||
|= [=mark =vase]
|
|= [=mark =vase]
|
||||||
^- (quip card _this)
|
^- (quip card _this)
|
||||||
?+ mark (on-poke:def mark vase)
|
?+ mark (on-poke:def mark vase)
|
||||||
%global-store-action
|
%gs-action
|
||||||
=+ !<(act=action vase)
|
=+ !<(act=action vase)
|
||||||
?- -.act
|
?- -.act
|
||||||
%put
|
%put
|
||||||
@ -81,9 +89,10 @@
|
|||||||
(~(del by objs) u.old-hash)
|
(~(del by objs) u.old-hash)
|
||||||
=/ =path [desk.act key.act]
|
=/ =path [desk.act key.act]
|
||||||
:_ this
|
:_ this
|
||||||
:~ [%give %fact ~[/desk/[desk.act]] %update !>(desk+(export-values desk.act))]
|
:~ [%give %fact ~[[%desk desk.act ~]] %update !>(desk+(export-values desk.act))]
|
||||||
[%give %fact ~[/u/desk/key/[desk.act]/[key.act]] %update !>(key+[desk.act key.act &])]
|
[%give %fact ~[[%u %desk desk.act ~]] %update !>(has-desk+[desk.act &])]
|
||||||
[%give %fact ~[/desk/key/[desk.act]/[key.act]] %update !>(value+value.act)]
|
[%give %fact ~[[%u %desk %key desk.act key.act]] %update !>(has-key+[desk.act key.act &])]
|
||||||
|
[%give %fact ~[[%desk %key desk.act key.act]] %update !>(value+value.act)]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
%del
|
%del
|
||||||
@ -95,9 +104,9 @@
|
|||||||
=? objs &(?=(^ hash) =(~ (~(get ju refs) u.hash)))
|
=? objs &(?=(^ hash) =(~ (~(get ju refs) u.hash)))
|
||||||
(~(del by objs) u.hash)
|
(~(del by objs) u.hash)
|
||||||
:_ this
|
:_ this
|
||||||
:~ [%give %fact ~[/desk/[desk.act]] %update !>(desk+(export-values desk.act))]
|
:~ [%give %fact ~[[%desk desk.act ~]] %update !>(desk+(export-values desk.act))]
|
||||||
[%give %fact ~[/u/desk/key/[desk.act]/[key.act]] %update !>(key+[desk.act key.act |])]
|
[%give %fact ~[[%u %desk %key desk.act key.act]] %update !>(has-key+[desk.act key.act |])]
|
||||||
[%give %fact ~[/desk/key/[desk.act]/[key.act]] %update !>(value+~)]
|
[%give %fact ~[[%desk %key desk.act key.act]] %update !>(value+~)]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
%lop
|
%lop
|
||||||
@ -121,11 +130,13 @@
|
|||||||
:: XX update all paths
|
:: XX update all paths
|
||||||
:_ this
|
:_ this
|
||||||
:: return desk empty, all keys empty, all key /u false, kicks
|
:: return desk empty, all keys empty, all key /u false, kicks
|
||||||
:~ [%give %fact ~[/desk/[desk.act]] %update !>(desk+(export-values desk.act))]
|
;: welp
|
||||||
[%give %fact ~[/u/desk/key/[desk.act]/[key.act]] %update !>(key+[desk.act key.act |])]
|
(cull-keys [desk.act key.act])
|
||||||
[%give %fact ~[/desk/key/[desk.act]/[key.act]] %update !>(value+value.act)]
|
(give-updates desk.act)
|
||||||
(give-updates desk.act)
|
(give-kicks desk.act)
|
||||||
(give-kicks desk.act)
|
:~ [%give %fact ~[[%desk desk.act ~]] %update !>(desk+(export-values desk.act))]
|
||||||
|
[%give %fact ~[[%u %desk desk.act ~]] %update !>(has-desk+[desk.act (~(has of store) /[desk.act])])]
|
||||||
|
==
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
%enroll
|
%enroll
|
||||||
@ -216,6 +227,13 @@
|
|||||||
:_ this
|
:_ this
|
||||||
:~ [%give %fact ~ %update !>(value+response)]
|
:~ [%give %fact ~ %update !>(value+response)]
|
||||||
==
|
==
|
||||||
|
:: /u/desk
|
||||||
|
::
|
||||||
|
[%u %desk desk=@ ~]
|
||||||
|
=/ response (~(has of store) /[desk.pole])
|
||||||
|
:_ this
|
||||||
|
:~ [%give %fact ~ %update !>(has-desk+response)]
|
||||||
|
==
|
||||||
:: /u/desk/key
|
:: /u/desk/key
|
||||||
::
|
::
|
||||||
[%u %desk %key desk=@ key=*]
|
[%u %desk %key desk=@ key=*]
|
||||||
@ -223,7 +241,7 @@
|
|||||||
[~ this]
|
[~ this]
|
||||||
=/ response (~(has of store) desk.pole key.pole)
|
=/ response (~(has of store) desk.pole key.pole)
|
||||||
:_ this
|
:_ this
|
||||||
:~ [%give %fact ~ %update !>(key+[desk.pole key.pole response])]
|
:~ [%give %fact ~ %update !>(has-key+[desk.pole key.pole response])]
|
||||||
==
|
==
|
||||||
==
|
==
|
||||||
++ on-agent on-agent:def
|
++ on-agent on-agent:def
|
||||||
@ -302,9 +320,24 @@
|
|||||||
^- (unit card)
|
^- (unit card)
|
||||||
?. &(?=([desk=@ *] pole) =(desk desk.pole))
|
?. &(?=([desk=@ *] pole) =(desk desk.pole))
|
||||||
~
|
~
|
||||||
?: (can-read desk ship)
|
?: (can-read ship pole)
|
||||||
~
|
~
|
||||||
`[%give %kick [pole ~] `ship]
|
`[%give %kick [pole ~] `ship]
|
||||||
|
++ cull-keys
|
||||||
|
|= [=desk =key]
|
||||||
|
^- (list card)
|
||||||
|
%- zing
|
||||||
|
%+ murn ~(val by sup.bowl)
|
||||||
|
|= [=ship =(pole knot)]
|
||||||
|
^- (unit (list card))
|
||||||
|
?. &(?=([desk=@ *] pole) =(desk desk.pole))
|
||||||
|
~
|
||||||
|
?: (can-read ship pole)
|
||||||
|
~
|
||||||
|
:- ~
|
||||||
|
:~ [%give %fact ~[`path`[%u %desk %key desk key]] %update !>(has-key+[desk key |])]
|
||||||
|
[%give %fact ~[`path`[%desk %key desk key]] %update !>(value+~)]
|
||||||
|
==
|
||||||
::
|
::
|
||||||
++ give-updates
|
++ give-updates
|
||||||
|= arg=$@(=desk [=desk =key])
|
|= arg=$@(=desk [=desk =key])
|
||||||
@ -330,23 +363,27 @@
|
|||||||
%- sy
|
%- sy
|
||||||
%+ murn ~(val by sup.bowl)
|
%+ murn ~(val by sup.bowl)
|
||||||
|= [* =(pole knot)]
|
|= [* =(pole knot)]
|
||||||
?. &(?=([desk=@ key=@ ~] pole) =(desk.pole desk))
|
?. &(?=([desk=@ key=*] pole) =(desk.pole desk))
|
||||||
~
|
~
|
||||||
`key.pole
|
`key.pole
|
||||||
::
|
::
|
||||||
++ desk-update
|
++ desk-update
|
||||||
|= =desk
|
|= =desk
|
||||||
^- card
|
^- card
|
||||||
:* %give %fact [[desk ~] ~]
|
:* %give %fact ~[/desk/[desk]]
|
||||||
%update
|
%update
|
||||||
!>(desk+(~(get of store) desk))
|
!>(desk+(export-values desk))
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ value-update
|
++ value-update
|
||||||
|= [=desk =key]
|
|= [=desk =key]
|
||||||
^- card
|
^- card
|
||||||
:* %give %fact [[desk key ~] ~]
|
:* %give %fact ~[:(welp /desk/key /[desk] key)]
|
||||||
%update
|
%update
|
||||||
!>(value+(~(get of store) [desk key]))
|
!>(`^update`[value+(key-to-val desk key)])
|
||||||
==
|
==
|
||||||
|
--
|
||||||
--
|
--
|
||||||
|
|
||||||
|
:: -need.?(%~ [i=/ t=it(/)])
|
||||||
|
:: -have.[[@tas @tas @tas / %~] %~]
|
@ -1,2 +1,2 @@
|
|||||||
:~ %global-store
|
:~ %gs
|
||||||
==
|
==
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
:~ title+'mine'
|
|
||||||
info+'fixme'
|
|
||||||
color+0xff.4400
|
|
||||||
image+'https://freedom-club.sfo2.digitaloceanspaces.com/props/quartus/long-logo/ab_Quartus-05_only.png'
|
|
||||||
version+[0 0 1]
|
|
||||||
website+'https://dalten.org/'
|
|
||||||
license+'REKT'
|
|
||||||
site+/apps/mine
|
|
||||||
==
|
|
@ -1,9 +0,0 @@
|
|||||||
:: :global-store|del %desk /key
|
|
||||||
::
|
|
||||||
/- *global-store
|
|
||||||
:- %say
|
|
||||||
|= $: ^
|
|
||||||
[=desk =key ~]
|
|
||||||
~
|
|
||||||
==
|
|
||||||
[%global-store-action [%del desk key]]
|
|
@ -1,10 +0,0 @@
|
|||||||
:: :global-store|enroll %desk /foo arena perm
|
|
||||||
:: :global-store|enroll %kids /foo [%ship ~zod] `%r
|
|
||||||
::
|
|
||||||
/- *global-store
|
|
||||||
:- %say
|
|
||||||
|= $: ^
|
|
||||||
[=desk =key =arena =perm ~]
|
|
||||||
~
|
|
||||||
==
|
|
||||||
[%global-store-action [%enroll desk key arena perm]]
|
|
@ -1,9 +0,0 @@
|
|||||||
:: :global-store|lockdown %desk
|
|
||||||
::
|
|
||||||
/- *global-store
|
|
||||||
:- %say
|
|
||||||
|= $: ^
|
|
||||||
[=desk ~]
|
|
||||||
~
|
|
||||||
==
|
|
||||||
[%global-store-action [%lockdown desk]]
|
|
@ -1,9 +0,0 @@
|
|||||||
:: :global-store|lop %desk /key
|
|
||||||
::
|
|
||||||
/- *global-store
|
|
||||||
:- %say
|
|
||||||
|= $: ^
|
|
||||||
[=desk =key ~]
|
|
||||||
~
|
|
||||||
==
|
|
||||||
[%global-store-action [%lop desk key]]
|
|
@ -1,9 +0,0 @@
|
|||||||
:: :global-store|put %desk /key noun+!>(42)
|
|
||||||
::
|
|
||||||
/- *global-store
|
|
||||||
:- %say
|
|
||||||
|= $: ^
|
|
||||||
[=desk =key =value ~]
|
|
||||||
~
|
|
||||||
==
|
|
||||||
[%global-store-action [%put desk key value]]
|
|
@ -1,10 +0,0 @@
|
|||||||
:: :global-store|unroll %desk /foo arena
|
|
||||||
:: :global-store|unroll %kids /foo [%ship ~zod]
|
|
||||||
::
|
|
||||||
/- *global-store
|
|
||||||
:- %say
|
|
||||||
|= $: ^
|
|
||||||
[=desk =key =arena ~]
|
|
||||||
~
|
|
||||||
==
|
|
||||||
[%global-store-action [%unroll desk key arena]]
|
|
9
desk/gen/gs/del.hoon
Normal file
9
desk/gen/gs/del.hoon
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
:: :gs|del %desk /key
|
||||||
|
::
|
||||||
|
/- *gs
|
||||||
|
:- %say
|
||||||
|
|= $: ^
|
||||||
|
[=desk =key ~]
|
||||||
|
~
|
||||||
|
==
|
||||||
|
[%gs-action [%del desk key]]
|
10
desk/gen/gs/enroll.hoon
Normal file
10
desk/gen/gs/enroll.hoon
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
:: :gs|enroll %desk /foo arena perm
|
||||||
|
:: :gs|enroll %kids /foo [%ship ~zod] `%r
|
||||||
|
::
|
||||||
|
/- *gs
|
||||||
|
:- %say
|
||||||
|
|= $: ^
|
||||||
|
[=desk =key =arena =perm ~]
|
||||||
|
~
|
||||||
|
==
|
||||||
|
[%gs-action [%enroll desk key arena perm]]
|
9
desk/gen/gs/lockdown.hoon
Normal file
9
desk/gen/gs/lockdown.hoon
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
:: :gs|lockdown %desk
|
||||||
|
::
|
||||||
|
/- *gs
|
||||||
|
:- %say
|
||||||
|
|= $: ^
|
||||||
|
[=desk ~]
|
||||||
|
~
|
||||||
|
==
|
||||||
|
[%gs-action [%lockdown desk]]
|
9
desk/gen/gs/lop.hoon
Normal file
9
desk/gen/gs/lop.hoon
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
:: :gs|lop %desk /key
|
||||||
|
::
|
||||||
|
/- *gs
|
||||||
|
:- %say
|
||||||
|
|= $: ^
|
||||||
|
[=desk =key ~]
|
||||||
|
~
|
||||||
|
==
|
||||||
|
[%gs-action [%lop desk key]]
|
9
desk/gen/gs/put.hoon
Normal file
9
desk/gen/gs/put.hoon
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
:: :gs|put %desk /key noun+!>(42)
|
||||||
|
::
|
||||||
|
/- *gs
|
||||||
|
:- %say
|
||||||
|
|= $: ^
|
||||||
|
[=desk =key =value ~]
|
||||||
|
~
|
||||||
|
==
|
||||||
|
[%gs-action [%put desk key value]]
|
10
desk/gen/gs/unroll.hoon
Normal file
10
desk/gen/gs/unroll.hoon
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
:: :gs|unroll %desk /foo arena
|
||||||
|
:: :gs|unroll %kids /foo [%ship ~zod]
|
||||||
|
::
|
||||||
|
/- *gs
|
||||||
|
:- %say
|
||||||
|
|= $: ^
|
||||||
|
[=desk =key =arena ~]
|
||||||
|
~
|
||||||
|
==
|
||||||
|
[%gs-action [%unroll desk key arena]]
|
@ -1,385 +0,0 @@
|
|||||||
/- *sss
|
|
||||||
/+ *mip
|
|
||||||
::
|
|
||||||
|%
|
|
||||||
++ mk-subs :: Create sub-map.
|
|
||||||
|* [=(lake) paths=mold]
|
|
||||||
-:+6:(da lake paths)
|
|
||||||
::
|
|
||||||
++ mk-pubs :: Create pub-map.
|
|
||||||
|* [=(lake) paths=mold]
|
|
||||||
-:+6:(du lake paths)
|
|
||||||
::
|
|
||||||
++ mk-mar :: Create mar.
|
|
||||||
|* =(lake)
|
|
||||||
|_ =(response:poke lake *)
|
|
||||||
++ grow
|
|
||||||
|%
|
|
||||||
++ noun response
|
|
||||||
--
|
|
||||||
++ grab
|
|
||||||
|%
|
|
||||||
++ noun (response:poke lake *)
|
|
||||||
--
|
|
||||||
++ grad %noun
|
|
||||||
--
|
|
||||||
++ fled :: Like +sped but head is a path.
|
|
||||||
|= vax=vase
|
|
||||||
^- vase
|
|
||||||
:_ q.vax
|
|
||||||
%- ~(play ut p.vax)
|
|
||||||
=- [%wtgr [%wtts - [%& 2]~] [%$ 1]]
|
|
||||||
=/ pax ~| %path-none ;;(path -.q.vax)
|
|
||||||
|- ^- spec
|
|
||||||
?~ pax [%base %null]
|
|
||||||
[%bccl ~[[%leaf %ta -.pax] $(pax +.pax)]]
|
|
||||||
::
|
|
||||||
++ zoom |= =noun ~| %need-path $/sss/;;(path noun)
|
|
||||||
::
|
|
||||||
++ da :: Manage subscriptions.
|
|
||||||
|* [=(lake) paths=mold]
|
|
||||||
=>
|
|
||||||
|%
|
|
||||||
+$ from (on-rock:poke lake paths)
|
|
||||||
+$ into (response:poke lake paths)
|
|
||||||
+$ result (request:poke paths)
|
|
||||||
+$ fail [paths ship dude]
|
|
||||||
+$ flow [=aeon stale=_| fail=_| =rock:lake]
|
|
||||||
+$ subs [%0 (map [ship dude paths] (unit flow))]
|
|
||||||
--
|
|
||||||
|= $: sub=subs
|
|
||||||
=bowl:gall
|
|
||||||
result-type=type
|
|
||||||
on-rock-type=type
|
|
||||||
fail-type=type
|
|
||||||
==
|
|
||||||
=> .(sub +.sub)
|
|
||||||
|%
|
|
||||||
++ surf :: Subscribe to [ship dude path].
|
|
||||||
|= which=[ship dude paths]
|
|
||||||
^- (quip card:agent:gall subs)
|
|
||||||
?+ flow=(~(get by sub) which) `0/sub
|
|
||||||
~ [~[(pine which)] 0/(~(put by sub) which ~)]
|
|
||||||
[~ ~] [~[(pine which)] 0/sub]
|
|
||||||
[~ ~ [* %& * *]] [~[(scry `+(aeon.u.u.flow) which)] 0/sub]
|
|
||||||
==
|
|
||||||
++ quit (corl (lead %0) ~(del by sub)) :: Unsub from [ship dude path].
|
|
||||||
++ read :: See current subscribed states.
|
|
||||||
^- (map [ship dude paths] [stale=? fail=? =rock:lake])
|
|
||||||
%- malt %+ murn ~(tap by sub)
|
|
||||||
|= [key=[ship dude paths] val=(unit flow)]
|
|
||||||
?~ val ~
|
|
||||||
`[key +.u.val]
|
|
||||||
:: :: Check poke-ack for errors.
|
|
||||||
:: :: If an %sss-on-rock poke nacks,
|
|
||||||
++ chit :: that state is flagged as failed.
|
|
||||||
|= [[aeon=term ship=term dude=term path=paths] =sign:agent:gall]
|
|
||||||
^- subs
|
|
||||||
:- %0
|
|
||||||
?> ?=(%poke-ack -.sign)
|
|
||||||
?~ p.sign sub
|
|
||||||
%+ ~(jab by sub) [(slav %p ship) dude path]
|
|
||||||
|= (unit flow)
|
|
||||||
=/ =flow (need +<)
|
|
||||||
?> =(aeon.flow (slav %ud aeon))
|
|
||||||
`flow(fail &)
|
|
||||||
:: :: Check poke-ack for errors.
|
|
||||||
:: :: If a scry request nacks,
|
|
||||||
++ tell :: that state is flagged as stale.
|
|
||||||
|= [[ship=term =dude aeon=term path=paths] =sign:agent:gall]
|
|
||||||
^- (quip card:agent:gall subs)
|
|
||||||
?> ?=(%poke-ack -.sign)
|
|
||||||
?~ p.sign `0/sub
|
|
||||||
=/ current [ship=(slav %p ship) dude=dude path=path]
|
|
||||||
?+ flow=(~(get by sub) current) `0/sub
|
|
||||||
[~ ~ *]
|
|
||||||
=. stale.u.u.flow &
|
|
||||||
:_ 0/(~(put by sub) current u.flow)
|
|
||||||
~[(on-rock-poke current u.u.flow ~)]
|
|
||||||
::
|
|
||||||
[~ ~]
|
|
||||||
:_ 0/(~(del by sub) current) :_ ~
|
|
||||||
:* %pass (zoom surf-fail/aeon/ship/dude/path)
|
|
||||||
%agent [our dap]:bowl
|
|
||||||
%poke %sss-surf-fail fail-type ^- fail
|
|
||||||
[path ship dude]:current
|
|
||||||
==
|
|
||||||
==
|
|
||||||
:: :: Check if we're still interested
|
|
||||||
:: :: in a wave. If no, no-op.
|
|
||||||
:: :: If yes, scry.
|
|
||||||
++ behn :: (See https://gist.github.com/belisarius222/7f8452bfea9b199c0ed717ab1778f35b)
|
|
||||||
|= [ship=term =dude aeon=term path=paths]
|
|
||||||
^- (list card:agent:gall)
|
|
||||||
%- fall :_ ~ %- mole |.
|
|
||||||
=/ ship (slav %p ship)
|
|
||||||
=/ aeon (slav %ud aeon)
|
|
||||||
?: (lte aeon aeon:(fall (~(got by sub) ship dude path) *flow)) ~
|
|
||||||
~[(scry `aeon ship dude path)]
|
|
||||||
::
|
|
||||||
++ apply :: Handle response from publisher.
|
|
||||||
|= res=(response:poke lake paths)
|
|
||||||
^- (quip card:agent:gall subs)
|
|
||||||
%- fall :_ `0/sub %- mole |.
|
|
||||||
=* current [src.bowl dude.res path.res]
|
|
||||||
=/ old=flow (fall (~(got by sub) current) *flow)
|
|
||||||
?- type.res
|
|
||||||
%tomb
|
|
||||||
=/ =flow old(stale &)
|
|
||||||
:_ 0/(~(put by sub) current `flow) :_ ~
|
|
||||||
(on-rock-poke current flow ~)
|
|
||||||
::
|
|
||||||
%yore
|
|
||||||
:_ 0/sub :_ ~
|
|
||||||
(pine src.bowl dude.res path.res)
|
|
||||||
::
|
|
||||||
%nigh
|
|
||||||
:_ 0/sub :_ ~
|
|
||||||
(behn-s25 [dude aeon path]:res)
|
|
||||||
::
|
|
||||||
%scry
|
|
||||||
=/ [wave=(unit wave:lake) =flow]
|
|
||||||
?- what.res
|
|
||||||
%rock ?> (gte aeon.res aeon.old)
|
|
||||||
[~ [aeon.res | | rock.res]]
|
|
||||||
%wave ?> =(aeon.res +(aeon.old))
|
|
||||||
[`wave.res [aeon.res | | (wash:lake rock.old wave.res)]]
|
|
||||||
==
|
|
||||||
:_ 0/(~(put by sub) current `flow)
|
|
||||||
:~ (on-rock-poke current flow wave)
|
|
||||||
(scry `+(aeon.res) src.bowl dude.res path.res)
|
|
||||||
==
|
|
||||||
==
|
|
||||||
::
|
|
||||||
:: Non-public facing arms below
|
|
||||||
::
|
|
||||||
++ behn-s25
|
|
||||||
|= [=dude =aeon path=noun]
|
|
||||||
^- card:agent:gall
|
|
||||||
:* %pass (zoom behn/(scot %p src.bowl)^dude^(scot %ud aeon)^path)
|
|
||||||
%arvo %b %wait (add ~s25 now.bowl)
|
|
||||||
==
|
|
||||||
++ pine |= [ship dude paths] (scry ~ +<)
|
|
||||||
++ scry
|
|
||||||
|= [when=(unit aeon) who=ship which=dude where=paths]
|
|
||||||
^- card:agent:gall
|
|
||||||
=/ when ?~ when ~ (scot %ud u.when)
|
|
||||||
:* %pass (zoom scry-request/(scot %p who)^which^when^where)
|
|
||||||
%agent [who which]
|
|
||||||
%poke %sss-to-pub :- result-type ^- result
|
|
||||||
[where dap.bowl ^when]
|
|
||||||
==
|
|
||||||
++ on-rock-poke
|
|
||||||
|= [[=ship =dude path=paths] flow wave=(unit wave:lake)]
|
|
||||||
^- card:agent:gall
|
|
||||||
:* %pass (zoom on-rock/(scot %ud aeon)^(scot %p ship)^dude^path)
|
|
||||||
%agent [our dap]:bowl
|
|
||||||
%poke %sss-on-rock on-rock-type ^- from
|
|
||||||
[path ship dude stale fail rock wave]
|
|
||||||
==
|
|
||||||
--
|
|
||||||
++ du :: Manage publications.
|
|
||||||
|* [=(lake) paths=mold]
|
|
||||||
=>
|
|
||||||
|%
|
|
||||||
+$ into (request:poke paths)
|
|
||||||
+$ result (response:poke lake paths)
|
|
||||||
+$ rule [rocks=_1 waves=_5] :: Retention policy
|
|
||||||
+$ tide
|
|
||||||
$: rok=((mop aeon rock:lake) gte)
|
|
||||||
wav=((mop aeon wave:lake) lte)
|
|
||||||
rul=rule
|
|
||||||
mem=(mip ship dude @da)
|
|
||||||
==
|
|
||||||
+$ buoy
|
|
||||||
$: tid=$~(*tide $@(aeon tide))
|
|
||||||
alo=(unit (set ship))
|
|
||||||
==
|
|
||||||
+$ pubs [%0 (map paths buoy)]
|
|
||||||
--
|
|
||||||
|= [pub=pubs =bowl:gall result-type=type]
|
|
||||||
=> .(pub +.pub)
|
|
||||||
=* rok ((on aeon rock:lake) gte)
|
|
||||||
=* wav ((on aeon wave:lake) lte)
|
|
||||||
|%
|
|
||||||
++ rule :: Set new retention policy.
|
|
||||||
|= [path=paths =^rule]
|
|
||||||
^- pubs
|
|
||||||
:- %0
|
|
||||||
%+ ~(jab by pub) path
|
|
||||||
|= =buoy
|
|
||||||
?@ tid.buoy buoy
|
|
||||||
buoy(tid (form tid.buoy(rul rule)))
|
|
||||||
::
|
|
||||||
++ wipe :: Create new rock and wipe rest.
|
|
||||||
|= path=paths
|
|
||||||
^- pubs
|
|
||||||
:- %0
|
|
||||||
%+ ~(jab by pub) path
|
|
||||||
|= =buoy
|
|
||||||
?@ tid.buoy buoy
|
|
||||||
%* . buoy(tid (form tid.buoy(rul [0 1])))
|
|
||||||
rul.tid rul.tid.buoy
|
|
||||||
wav.tid ~
|
|
||||||
==
|
|
||||||
++ give :: Give a wave on a path.
|
|
||||||
|= [path=paths =wave:lake]
|
|
||||||
^- (quip card:agent:gall pubs)
|
|
||||||
?~ ((soft ^path) path) ~| %need-path !!
|
|
||||||
=/ buoy (~(gut by pub) path *buoy)
|
|
||||||
=? buoy ?=(@ tid.buoy)
|
|
||||||
%*(. buoy(tid *tide) rok.tid (put:rok ~ +(tid.buoy) *rock:lake))
|
|
||||||
?> ?=(^ tid.buoy)
|
|
||||||
=* tide tid.buoy
|
|
||||||
=/ next=aeon +((latest tide))
|
|
||||||
:- %+ murn ~(tap bi mem.tide)
|
|
||||||
|= [=ship =dude =@da]
|
|
||||||
?: (lth da now.bowl) ~
|
|
||||||
`(send scry/wave/wave ship dude next path)
|
|
||||||
:- %0
|
|
||||||
%+ ~(put by pub) path
|
|
||||||
=/ last=[=aeon =rock:lake] (fall (pry:rok rok.tide) *[key val]:rok)
|
|
||||||
=. wav.tide (put:wav wav.tide next wave)
|
|
||||||
=. mem.tide ~
|
|
||||||
?. =(next (add aeon.last waves.rul.tide)) buoy
|
|
||||||
buoy(tid (form tide))
|
|
||||||
::
|
|
||||||
++ fork :: Fork a pub into an empty path.
|
|
||||||
|= [from=paths to=paths]
|
|
||||||
^- pubs
|
|
||||||
:- %0
|
|
||||||
?< (~(has by pub) to)
|
|
||||||
(~(put by pub) to (~(got by pub) from))
|
|
||||||
::
|
|
||||||
++ copy :: Fork a sub into an empty path.
|
|
||||||
|= [sub=_(mk-subs lake *) from=[ship dude *] to=paths]
|
|
||||||
^- pubs
|
|
||||||
:- %0
|
|
||||||
?< (~(has by pub) to)
|
|
||||||
%+ ~(put by pub) to
|
|
||||||
%* . *$<(aeon buoy)
|
|
||||||
rok.tid (put:rok ~ [aeon rock]:(need (~(got by +:sub) from)))
|
|
||||||
==
|
|
||||||
::
|
|
||||||
++ perm :: Change permissions with gate.
|
|
||||||
|= [where=(list paths) diff=$-((unit (set ship)) (unit (set ship)))]
|
|
||||||
^- pubs
|
|
||||||
%+ edit where
|
|
||||||
|= =buoy
|
|
||||||
=/ new=_alo.buoy (diff alo.buoy)
|
|
||||||
?@ tid.buoy buoy(alo new)
|
|
||||||
%= buoy
|
|
||||||
alo new
|
|
||||||
mem.tid ?~ new mem.tid.buoy
|
|
||||||
%. mem.tid.buoy
|
|
||||||
~(int by (malt (turn ~(tap in u.new) (late *(map @ @)))))
|
|
||||||
==
|
|
||||||
++ public (curr perm _~) :: Make list of paths public.
|
|
||||||
++ secret (curr perm _`~) :: Make list of paths secret.
|
|
||||||
:: :: Block ships from paths.
|
|
||||||
++ block :: No-ops on public paths.
|
|
||||||
|= [who=(list ship) whence=(list paths)]
|
|
||||||
^- pubs
|
|
||||||
%+ perm whence
|
|
||||||
|= old=(unit (set ship))
|
|
||||||
?~ old ~ `(~(dif in u.old) (sy who))
|
|
||||||
:: :: Allow ships to paths.
|
|
||||||
++ allow :: Any public paths will no-op.
|
|
||||||
|= [who=(list ship) where=(list paths)]
|
|
||||||
^- pubs
|
|
||||||
%+ perm where
|
|
||||||
|= old=(unit (set ship))
|
|
||||||
?~ old ~ `(~(gas in u.old) who)
|
|
||||||
:: :: Kill a list of paths, i.e. tell
|
|
||||||
++ kill :: subs to not expect updates.
|
|
||||||
(curr edit |=(=buoy buoy(tid (latest tid.buoy))))
|
|
||||||
:: :: Reopen list of killed paths.
|
|
||||||
++ read :: See current published states.
|
|
||||||
^- (map paths [allowed=(unit (set ship)) =rock:lake])
|
|
||||||
%- malt %+ murn ~(tap by pub)
|
|
||||||
|= [path=paths =buoy]
|
|
||||||
^- (unit [paths (unit (set ship)) rock:lake])
|
|
||||||
?@ tide=tid.buoy ~
|
|
||||||
:^ ~ path alo.buoy =< rock
|
|
||||||
=/ snap=[=aeon =rock:lake] (fall (pry:rok rok.tide) *[key val]:rok)
|
|
||||||
%+ roll (tap:wav (lot:wav wav.tide `aeon.snap ~))
|
|
||||||
|= [[=aeon =wave:lake] =_snap]
|
|
||||||
?. =(aeon +(aeon.snap)) snap
|
|
||||||
[aeon (wash:lake rock.snap wave)]
|
|
||||||
::
|
|
||||||
++ apply :: Handle request from subscriber.
|
|
||||||
|= req=(request:poke paths)
|
|
||||||
^- (quip card:agent:gall pubs)
|
|
||||||
=/ =buoy (~(gut by pub) path.req *buoy)
|
|
||||||
?< &(?=(^ alo.buoy) !(~(has in u.alo.buoy) src.bowl))
|
|
||||||
?@ tid.buoy
|
|
||||||
:_ 0/pub :_ ~
|
|
||||||
(send tomb/~ src.bowl dude.req tid.buoy path.req)
|
|
||||||
?~ when.req
|
|
||||||
=/ last (fall (pry:rok rok.tid.buoy) *[=key =val]:rok)
|
|
||||||
:_ 0/pub :_ ~
|
|
||||||
(send scry/rock/val.last src.bowl dude.req key.last path.req)
|
|
||||||
?^ dat=(get:wav wav.tid.buoy u.when.req)
|
|
||||||
:_ 0/pub :_ ~
|
|
||||||
(send scry/wave/u.dat src.bowl [dude u.when path]:req)
|
|
||||||
?: %+ lte u.when.req
|
|
||||||
key::(fall (ram:wav wav.tid.buoy) (pry:rok rok.tid.buoy) [=key val]:wav)
|
|
||||||
:_ 0/pub :_ ~
|
|
||||||
(send yore/~ src.bowl [dude u.when path]:req)
|
|
||||||
?> =(u.when.req +((latest tid.buoy)))
|
|
||||||
:- ~[(send nigh/~ src.bowl [dude u.when path]:req)]
|
|
||||||
:- %0
|
|
||||||
%+ ~(put by pub) path.req
|
|
||||||
%= buoy
|
|
||||||
mem.tid (~(put bi mem.tid.buoy) src.bowl dude.req (add ~s25 now.bowl))
|
|
||||||
==
|
|
||||||
::
|
|
||||||
:: Non-public facing arms below
|
|
||||||
::
|
|
||||||
++ send
|
|
||||||
|= [payload=_|3:*(response:poke lake paths) =ship =dude =aeon path=paths]
|
|
||||||
^- card:agent:gall
|
|
||||||
=* mark (cat 3 %sss- name:lake)
|
|
||||||
:* %pass (zoom scry-response/(scot %p ship)^dude^(scot %ud aeon)^path)
|
|
||||||
%agent [ship dude]
|
|
||||||
%poke mark result-type ^- (response:poke lake paths)
|
|
||||||
[path dap.bowl aeon payload]
|
|
||||||
==
|
|
||||||
++ latest
|
|
||||||
|= =$@(aeon tide)
|
|
||||||
^- aeon
|
|
||||||
?@ tide tide
|
|
||||||
%+ max (fall (bind (pry:rok rok.tide) head) 0)
|
|
||||||
(fall (bind (ram:wav wav.tide) head) 0)
|
|
||||||
::
|
|
||||||
++ edit
|
|
||||||
|= [ps=(list paths) edit=$-(buoy buoy)]
|
|
||||||
^- pubs
|
|
||||||
:- %0
|
|
||||||
%- ~(rep in (sy ps))
|
|
||||||
|= [path=paths =_pub]
|
|
||||||
%- fall :_ pub %- mole |.
|
|
||||||
(~(jab by pub) path edit)
|
|
||||||
::
|
|
||||||
++ form
|
|
||||||
|= =tide
|
|
||||||
^+ tide
|
|
||||||
=/ max-rock=[=aeon =rock:lake] (fall (pry:rok rok.tide) *[key val]:rok)
|
|
||||||
=/ max-wave (fall (bind (ram:wav wav.tide) head) 0)
|
|
||||||
=. rok.tide
|
|
||||||
%+ gas:rok +<-:gas:rok
|
|
||||||
%- tab:rok :_ [~ +(rocks.rul.tide)]
|
|
||||||
?: ?| =(waves.rul.tide 0)
|
|
||||||
(lth max-wave (add aeon.max-rock waves.rul.tide))
|
|
||||||
==
|
|
||||||
rok.tide
|
|
||||||
%+ put:rok rok.tide
|
|
||||||
%+ roll (tab:wav wav.tide `aeon.max-rock max-wave)
|
|
||||||
|: [*[now=aeon =wave:lake] `[prev=aeon =rock:lake]`max-rock]
|
|
||||||
~| %aeon-awry
|
|
||||||
?> =(now +(prev))
|
|
||||||
[now (wash:lake rock wave)]
|
|
||||||
~| %rock-zero
|
|
||||||
tide(wav (lot:wav wav.tide (bind (ram:rok rok.tide) |=([r=@ *] (dec r))) ~))
|
|
||||||
--
|
|
||||||
--
|
|
@ -1,3 +1,3 @@
|
|||||||
/- *global-store
|
/- *gs
|
||||||
/+ sss
|
/+ sss
|
||||||
(mk-mar:sss action)
|
(mk-mar:sss action)
|
@ -1,3 +1,3 @@
|
|||||||
/- *global-store
|
/- *gs
|
||||||
/+ sss
|
/+ sss
|
||||||
(mk-mar:sss update)
|
(mk-mar:sss update)
|
@ -1,4 +1,4 @@
|
|||||||
:: /sur/global-store.hoon
|
:: /sur/gs.hoon
|
||||||
:::: ~lagrev-nocfep & ~midden-fabler
|
:::: ~lagrev-nocfep & ~midden-fabler
|
||||||
:: Version ~2023.11.9
|
:: Version ~2023.11.9
|
||||||
::
|
::
|
||||||
@ -34,7 +34,8 @@
|
|||||||
::
|
::
|
||||||
+$ update
|
+$ update
|
||||||
$% [%desk (map key value)]
|
$% [%desk (map key value)]
|
||||||
[%key (trel desk key ?)]
|
[%has-desk (pair desk ?)]
|
||||||
|
[%has-key (trel desk key ?)]
|
||||||
[%value p=(unit value)]
|
[%value p=(unit value)]
|
||||||
==
|
==
|
||||||
--
|
--
|
@ -1,43 +0,0 @@
|
|||||||
|%
|
|
||||||
++ lake
|
|
||||||
|$ [rock wave]
|
|
||||||
$_ ^?
|
|
||||||
|%
|
|
||||||
++ name *term
|
|
||||||
+$ rock ^rock
|
|
||||||
+$ wave ^wave
|
|
||||||
++ wash |~ [rock wave] *rock
|
|
||||||
--
|
|
||||||
+$ aeon @ud
|
|
||||||
+$ dude dude:agent:gall
|
|
||||||
+$ what ?(%rock %wave)
|
|
||||||
++ poke
|
|
||||||
|%
|
|
||||||
++ request
|
|
||||||
|* paths=mold
|
|
||||||
$: path=paths
|
|
||||||
=dude
|
|
||||||
when=(unit aeon)
|
|
||||||
==
|
|
||||||
++ response
|
|
||||||
|* [=(lake) paths=mold]
|
|
||||||
$: path=paths
|
|
||||||
=dude
|
|
||||||
=aeon
|
|
||||||
$% [type=?(%nigh %yore %tomb) ~]
|
|
||||||
$: type=%scry
|
|
||||||
$% [what=%rock =rock:lake]
|
|
||||||
[what=%wave =wave:lake]
|
|
||||||
== == == ==
|
|
||||||
++ on-rock
|
|
||||||
|* [=(lake) paths=mold]
|
|
||||||
$: path=paths
|
|
||||||
src=ship
|
|
||||||
from=dude
|
|
||||||
stale=?
|
|
||||||
fail=?
|
|
||||||
=rock:lake
|
|
||||||
wave=(unit wave:lake)
|
|
||||||
==
|
|
||||||
--
|
|
||||||
--
|
|
@ -1,4 +1,4 @@
|
|||||||
/- *global-store
|
/- *gs
|
||||||
|%
|
|%
|
||||||
++ name %update
|
++ name %update
|
||||||
+$ rock (unit value)
|
+$ rock (unit value)
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
:: /tests/global-store.hoon
|
:: /tests/gs.hoon
|
||||||
:::: ~lagrev-nocfep
|
:::: ~lagrev-nocfep
|
||||||
:: Version ~2023.7.28
|
:: Version ~2023.7.28
|
||||||
::
|
::
|
||||||
/- gs=global-store
|
/- gs=gs
|
||||||
/+ *test, *mip
|
/+ *test, *mip
|
||||||
/= agent /app/global-store
|
/= agent /app/gs
|
||||||
|%
|
|%
|
||||||
:: Build an example bowl manually.
|
:: Build an example bowl manually.
|
||||||
::
|
::
|
||||||
++ bowl
|
++ bowl
|
||||||
|= run=@ud
|
|= run=@ud
|
||||||
^- bowl:gall
|
^- bowl:gall
|
||||||
:* [~zod ~zod %global-store] :: (our src dap)
|
:* [~zod ~zod %gs] :: (our src dap)
|
||||||
[~ ~] :: (wex sup)
|
[~ ~] :: (wex sup)
|
||||||
[run `@uvJ`(shax run) *time [~zod %global-store ud+run]]
|
[run `@uvJ`(shax run) *time [~zod %gs ud+run]]
|
||||||
:: (act eny now byk)
|
:: (act eny now byk)
|
||||||
==
|
==
|
||||||
:: Build a reference state mold.
|
:: Build a reference state mold.
|
||||||
@ -28,7 +28,7 @@
|
|||||||
|%
|
|%
|
||||||
++ test-add-single-desk
|
++ test-add-single-desk
|
||||||
=| run=@ud
|
=| run=@ud
|
||||||
=^ move agent (~(on-poke agent (bowl run)) %global-store-action !>([%let %surf]))
|
=^ move agent (~(on-poke agent (bowl run)) %gs-action !>([%let %surf]))
|
||||||
=+ !<(state=state-zero on-save:agent)
|
=+ !<(state=state-zero on-save:agent)
|
||||||
%+ expect-eq
|
%+ expect-eq
|
||||||
!> :* %zero
|
!> :* %zero
|
||||||
@ -39,8 +39,8 @@
|
|||||||
!> state
|
!> state
|
||||||
++ test-add-two-desks
|
++ test-add-two-desks
|
||||||
=| run=@ud
|
=| run=@ud
|
||||||
=^ move agent (~(on-poke agent (bowl run)) %global-store-action !>([%let %surf]))
|
=^ move agent (~(on-poke agent (bowl run)) %gs-action !>([%let %surf]))
|
||||||
=^ move agent (~(on-poke agent (bowl run)) %global-store-action !>([%let %turf]))
|
=^ move agent (~(on-poke agent (bowl run)) %gs-action !>([%let %turf]))
|
||||||
=+ !<(state=state-zero on-save:agent)
|
=+ !<(state=state-zero on-save:agent)
|
||||||
%+ expect-eq
|
%+ expect-eq
|
||||||
=| sto=store:gs
|
=| sto=store:gs
|
||||||
@ -54,9 +54,9 @@
|
|||||||
!> state
|
!> state
|
||||||
++ test-delete-desk
|
++ test-delete-desk
|
||||||
=| run=@ud
|
=| run=@ud
|
||||||
=^ move agent (~(on-poke agent (bowl run)) %global-store-action !>([%let %surf]))
|
=^ move agent (~(on-poke agent (bowl run)) %gs-action !>([%let %surf]))
|
||||||
=^ move agent (~(on-poke agent (bowl run)) %global-store-action !>([%let %turf]))
|
=^ move agent (~(on-poke agent (bowl run)) %gs-action !>([%let %turf]))
|
||||||
=^ move agent (~(on-poke agent (bowl run)) %global-store-action !>([%lie %surf]))
|
=^ move agent (~(on-poke agent (bowl run)) %gs-action !>([%lie %surf]))
|
||||||
=+ !<(state=state-zero on-save:agent)
|
=+ !<(state=state-zero on-save:agent)
|
||||||
%+ expect-eq
|
%+ expect-eq
|
||||||
=| sto=store:gs
|
=| sto=store:gs
|
||||||
@ -71,10 +71,10 @@
|
|||||||
!> state
|
!> state
|
||||||
++ test-add-values-to-desk
|
++ test-add-values-to-desk
|
||||||
=| run=@ud
|
=| run=@ud
|
||||||
=^ move agent (~(on-poke agent (bowl run)) %global-store-action !>([%let %home]))
|
=^ move agent (~(on-poke agent (bowl run)) %gs-action !>([%let %home]))
|
||||||
=^ move agent (~(on-poke agent (bowl run)) %global-store-action !>([%put %home %city 'Champaign']))
|
=^ move agent (~(on-poke agent (bowl run)) %gs-action !>([%put %home %city 'Champaign']))
|
||||||
=^ move agent (~(on-poke agent (bowl run)) %global-store-action !>([%put %home %state 'Illinois']))
|
=^ move agent (~(on-poke agent (bowl run)) %gs-action !>([%put %home %state 'Illinois']))
|
||||||
=^ move agent (~(on-poke agent (bowl run)) %global-store-action !>([%put %home %zip '61801']))
|
=^ move agent (~(on-poke agent (bowl run)) %gs-action !>([%put %home %zip '61801']))
|
||||||
=+ !<(state=state-zero on-save:agent)
|
=+ !<(state=state-zero on-save:agent)
|
||||||
%+ expect-eq
|
%+ expect-eq
|
||||||
=| sto=store:gs
|
=| sto=store:gs
|
||||||
@ -90,12 +90,12 @@
|
|||||||
!> state
|
!> state
|
||||||
++ test-delete-values-in-desk
|
++ test-delete-values-in-desk
|
||||||
=| run=@ud
|
=| run=@ud
|
||||||
=^ move agent (~(on-poke agent (bowl run)) %global-store-action !>([%let %home]))
|
=^ move agent (~(on-poke agent (bowl run)) %gs-action !>([%let %home]))
|
||||||
=^ move agent (~(on-poke agent (bowl run)) %global-store-action !>([%put %home %city 'Champaign']))
|
=^ move agent (~(on-poke agent (bowl run)) %gs-action !>([%put %home %city 'Champaign']))
|
||||||
=^ move agent (~(on-poke agent (bowl run)) %global-store-action !>([%put %home %state 'Illinois']))
|
=^ move agent (~(on-poke agent (bowl run)) %gs-action !>([%put %home %state 'Illinois']))
|
||||||
=^ move agent (~(on-poke agent (bowl run)) %global-store-action !>([%put %home %zip '61801']))
|
=^ move agent (~(on-poke agent (bowl run)) %gs-action !>([%put %home %zip '61801']))
|
||||||
=^ move agent (~(on-poke agent (bowl run)) %global-store-action !>([%del %home %city]))
|
=^ move agent (~(on-poke agent (bowl run)) %gs-action !>([%del %home %city]))
|
||||||
=^ move agent (~(on-poke agent (bowl run)) %global-store-action !>([%del %home %zip]))
|
=^ move agent (~(on-poke agent (bowl run)) %gs-action !>([%del %home %zip]))
|
||||||
=+ !<(state=state-zero on-save:agent)
|
=+ !<(state=state-zero on-save:agent)
|
||||||
%+ expect-eq
|
%+ expect-eq
|
||||||
=| sto=store:gs
|
=| sto=store:gs
|
||||||
@ -109,10 +109,10 @@
|
|||||||
!> state
|
!> state
|
||||||
++ test-set-perms
|
++ test-set-perms
|
||||||
=| run=@ud
|
=| run=@ud
|
||||||
=^ move agent (~(on-poke agent (bowl run)) %global-store-action !>([%mode %public %r]))
|
=^ move agent (~(on-poke agent (bowl run)) %gs-action !>([%mode %public %r]))
|
||||||
=^ move agent (~(on-poke agent (bowl run)) %global-store-action !>([%mode %whitelist %w]))
|
=^ move agent (~(on-poke agent (bowl run)) %gs-action !>([%mode %whitelist %w]))
|
||||||
=^ move agent (~(on-poke agent (bowl run)) %global-store-action !>([%mode %team %w]))
|
=^ move agent (~(on-poke agent (bowl run)) %gs-action !>([%mode %team %w]))
|
||||||
=^ move agent (~(on-poke agent (bowl run)) %global-store-action !>([%mode %me %w]))
|
=^ move agent (~(on-poke agent (bowl run)) %gs-action !>([%mode %me %w]))
|
||||||
=+ !<(state=state-zero on-save:agent)
|
=+ !<(state=state-zero on-save:agent)
|
||||||
%+ expect-eq
|
%+ expect-eq
|
||||||
=| per=perms:gs
|
=| per=perms:gs
|
||||||
@ -130,11 +130,11 @@
|
|||||||
::++ test-blacklist
|
::++ test-blacklist
|
||||||
++ test-lockdown
|
++ test-lockdown
|
||||||
=| run=@ud
|
=| run=@ud
|
||||||
=^ move agent (~(on-poke agent (bowl run)) %global-store-action !>([%mode %public %r]))
|
=^ move agent (~(on-poke agent (bowl run)) %gs-action !>([%mode %public %r]))
|
||||||
=^ move agent (~(on-poke agent (bowl run)) %global-store-action !>([%mode %whitelist %w]))
|
=^ move agent (~(on-poke agent (bowl run)) %gs-action !>([%mode %whitelist %w]))
|
||||||
=^ move agent (~(on-poke agent (bowl run)) %global-store-action !>([%mode %team %w]))
|
=^ move agent (~(on-poke agent (bowl run)) %gs-action !>([%mode %team %w]))
|
||||||
=^ move agent (~(on-poke agent (bowl run)) %global-store-action !>([%mode %me %w]))
|
=^ move agent (~(on-poke agent (bowl run)) %gs-action !>([%mode %me %w]))
|
||||||
=^ move agent (~(on-poke agent (bowl run)) %global-store-action !>([%lockdown ~]))
|
=^ move agent (~(on-poke agent (bowl run)) %gs-action !>([%lockdown ~]))
|
||||||
=+ !<(state=state-zero on-save:agent)
|
=+ !<(state=state-zero on-save:agent)
|
||||||
%+ expect-eq
|
%+ expect-eq
|
||||||
=| per=perms:gs
|
=| per=perms:gs
|
||||||
|
Loading…
Reference in New Issue
Block a user