dm-hook: migrate state

This commit is contained in:
Liam Fitzgerald 2021-05-04 16:08:08 +10:00
parent 357ba972d6
commit cb1bfc07c8
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB

View File

@ -31,10 +31,35 @@
++ on-init
:_ this
:_ ~
=/ dms=(list resource)
%+ skim ~(tap in get-keys:gra)
|=([ship name=term] ?=(^ (rush name ;~(pfix (jest 'dm--') (star next)))))
|^
%+ poke-our:pass %graph-store
%+ update:cg:gra now.bowl
:+ %add-graph [our.bowl %inbox]
[*graph:store `%graph-validator-dm %.n]
[graph `%graph-validator-dm %.n]
::
++ dm-parser
;~(pfix (jest 'dm--') fed:ag)
::
++ counterparty
|= rid=resource
=/ =ship (rash name.rid dm-parser)
?. =(our.bowl ship) ship
entity.rid
::
++ graph
%+ roll dms
|= [rid=resource =graph:store]
=/ =ship (counterparty rid)
=| =post:store
=: author.post our.bowl
index.post [ship ~]
time-sent.post now.bowl
==
(put:orm:store graph `@`ship [%& post] %graph graph)
--
::
++ on-save !>(state)
++ on-load