From dbeed2d723bb668f7d326cd32b9630b55347e7e2 Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Mon, 18 Apr 2016 15:15:35 -0700 Subject: [PATCH] hood save/load mechanism --- app/hood.hoon | 7 +++++++ gen/hood/load.hoon | 16 ++++++++++++++++ gen/hood/save.hoon | 14 ++++++++++++++ lib/womb.hoon | 6 ++++++ 4 files changed, 43 insertions(+) create mode 100644 gen/hood/load.hoon create mode 100644 gen/hood/save.hoon diff --git a/app/hood.hoon b/app/hood.hoon index 0e8c53549..116d444ea 100644 --- a/app/hood.hoon +++ b/app/hood.hoon @@ -72,6 +72,12 @@ ~? ?=(^ saw) [%kiln-overload-lame u.saw] [~ +>] :: +++ poke-hood-load + |= dat/hood-part + ?> =(our src) + ~& loaded+-.dat + [~ %_(+> lac (~(put by lac) -.dat dat))] +:: ++ coup-drum-phat (wrap take-coup-phat):from-drum ++ coup-helm-hi (wrap coup-hi):from-helm ++ diff-sole-effect-drum-phat (wrap diff-sole-effect-phat):from-drum @@ -136,6 +142,7 @@ ++ poke-kiln-unmount (wrap poke-unmount):from-kiln ++ poke-kiln-unsync (wrap poke-unsync):from-kiln ++ poke-womb-invite (wrap poke-invite):from-womb +++ poke-womb-save (wrap poke-save):from-womb ++ poke-womb-obey (wrap poke-obey):from-womb ++ poke-womb-claim (wrap poke-claim):from-womb ++ poke-womb-do-claim (wrap poke-do-claim):from-womb diff --git a/gen/hood/load.hoon b/gen/hood/load.hoon new file mode 100644 index 000000000..e4e88c685 --- /dev/null +++ b/gen/hood/load.hoon @@ -0,0 +1,16 @@ +:: +:::: /hoon/load/hood/gen + :: +/? 310 +/+ womb +:: +:::: + !: +:- %say +|= $: {now/@da eny/@uvI byk/beak} + {{dap/term $~} $~} + == +^- {$hood-load ?(part:womb)} +?+ dap ~|(unknown-backup+dap !!) + $womb [%hood-load .^(part:womb %cx (tope byk /womb-part/bak/hood/app))] +== diff --git a/gen/hood/save.hoon b/gen/hood/save.hoon new file mode 100644 index 000000000..6a86f06b1 --- /dev/null +++ b/gen/hood/save.hoon @@ -0,0 +1,14 @@ +:: +:::: /hoon/save/hood/gen + :: +/? 310 +:: +:::: + !: +:- %say +|= $: {now/@da eny/@uvI byk/beak} + {{dap/term $~} $~} + == +?+ dap ~|(unknown-backup+dap !!) + $womb [%womb-save (tope byk /womb-part/bak/hood/app)] +== diff --git a/lib/womb.hoon b/lib/womb.hoon index cc162142f..ea76bc540 100644 --- a/lib/womb.hoon +++ b/lib/womb.hoon @@ -110,6 +110,7 @@ |% :: arvo structures ++ card :: $% {$flog wire flog} :: + {$info wire @p @tas nori} :: fs write (backup) :: {$wait $~} :: delay acknowledgment {$poke wire pear} :: app RPC {$next wire p/ring} :: update private key @@ -503,6 +504,11 @@ ?> =(our src) :: me only .(boss who) :: +++ poke-save :: write backup + |= pax/path + =< abet + (emit %info /backup [our (foal pax [%womb-part !>(`part`+:abet)])]) +:: ++ poke-rekey :: extend will |= $~ =< abet