add +fork and +copy

This commit is contained in:
~wicrum-wicrun 2023-04-18 18:40:02 +02:00
parent fcaf2f50aa
commit b6b80718a9
2 changed files with 28 additions and 0 deletions

View File

@ -257,6 +257,16 @@
=. pub-sum (live:du-sum [%sum %foo ~]~)
~& > "pub-sum is: {<read:du-sum>}"
`this
::
%fork-log
=. pub-log (fork:du-log !<([[%log *] [%log *]] vase))
~& > "pub-log is: {<read:du-log>}"
`this
::
%copy-log
=. pub-log (copy:du-log sub-log [our dap [%log ~]]:bowl !<([%log *] vase))
~& > "pub-log is: {<read:du-log>}"
`this
::
:: This uses `+rule:du` in order to set a new retention policy for a state
:: published on a particular path. The arguments here are:

View File

@ -202,6 +202,7 @@
=* rok ((on aeon rock:lake) gte)
=* wav ((on aeon wave:lake) lte)
|%
::
++ rule :: Set new retention policy.
|= [path=paths =^rule]
^- pubs
@ -241,6 +242,23 @@
?. =(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