From cb1bfc07c8fc81459874ba8c3d3c089069e9dd8d Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Tue, 4 May 2021 16:08:08 +1000 Subject: [PATCH] dm-hook: migrate state --- pkg/arvo/app/dm-hook.hoon | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/pkg/arvo/app/dm-hook.hoon b/pkg/arvo/app/dm-hook.hoon index 35e108cc5b..4c72c3f30a 100644 --- a/pkg/arvo/app/dm-hook.hoon +++ b/pkg/arvo/app/dm-hook.hoon @@ -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