pill: add azimuth snapshot

This commit is contained in:
yosoyubik 2021-12-07 16:13:39 +01:00
parent d08ab43f3a
commit 81eb6ae247
7 changed files with 26 additions and 31 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0394295b16a0709e30e6a01006310ea52a7da2396dd6b0632689b9f3334a6cee
size 26210958
oid sha256:8388d1c8e9f1a9bfceeab27b86387ecd9fc5f31d5c1f405e1b1017e35c795217
size 26315069

View File

@ -8,7 +8,7 @@
dbug
:: Generally don't update the snapshot until we have clay tombstoning.
::
/* state-naive %naive /app/azimuth/state/naive
/* snap %azimuth /app/azimuth/state/azimuth
:: To update, run from dojo:
:: -azimuth-snap-state %default 'state'
::
@ -18,8 +18,8 @@
:: */app/azimuth/logs/eth-logs &eth-logs l
:: -azimuth-snap-logs %default 'state'
::
=/ snap=snap-state state-naive
=/ last-snap number.id.snap
=/ snap=snap-state snap
=/ last-snap=@ number.id.snap
::
=, jael
|%
@ -246,9 +246,7 @@
%history (welp logs.state loglist.diff)
%logs (welp logs.state loglist.diff)
==
:: =? nas.state ?=(%history -.diff) *^state:naive :: should go
=^ effects state (run-logs:do loglist.diff)
::
:_ this
%+ weld
(event-update:do effects)
@ -406,6 +404,7 @@
=/ args=vase !>
:+ %watch /[dap.bowl]
^- config:eth-watcher
:* url.state =(%czar (clan:title our.bowl)) refresh ~h30
(max launch.net ?:(=(net.state %default) +(last-snap) 0))
~[azimuth.net]
~[naive.net]

View File

@ -1,4 +1,4 @@
:: naive state
:: /app/azimuth state snapshot
::
/- *dice
/+ naive
@ -15,7 +15,7 @@
++ grow
|%
++ mime
[/application/x-naive (as-octs:mimes:html (jam snap))]
[/application/octet-stream (as-octs:mimes:html (jam snap))]
--
++ grad %mime
--

View File

@ -1,4 +1,5 @@
:: Creates a snapshop of the naive state and its indices (owners and sposnors)
:: Creates a snapshot of the azimuth state and its indices
:: (owners and sposnors) from a list of ethereum logs
::
/- spider, *dice
/+ strand,
@ -59,9 +60,9 @@
leaf+"owners: {<~(wyt by owners)>}"
==
::
=/ =path /app/azimuth/[name]/naive
=/ =cage naive+!>([%0 id nas owners sponsors])
=/ =path /app/azimuth/[name]/azimuth
=/ =cage azimuth+!>([%0 id nas owners sponsors])
=/ =task [%info %base %& [path %ins cage]~]
=/ =card [%pass /next %arvo %c task]
;< ~ bind:m (send-raw-card:strandio card)
(pure:m !>('naive logs processed'))
(pure:m !>('azimuth logs processed'))

View File

@ -1,12 +1,6 @@
:: =e -build-file %/lib/ethereum/hoon
:: =n -build-file %/lib/naive/hoon
:: =d -build-file %/sur/dice/hoon
:: =l .^((list event-log:rpc:e) %gx /=azimuth=/logs/noun)
:: =nas .^(^state:n %gx /=azimuth=/nas/noun)
:: =own .^(owners:d %gx /=azimuth=/own/noun)
:: =spo .^(sponsors:d %gx /=azimuth=/spo/noun)
:: =block-id =+ last=(rear l) [block-hash block-number]:(need mined.last)
:: */app/azimuth/state/naive &naive [block-id nas own spo]
:: Creates a snapshot of the azimuth state and its indices
:: (owners and sposnors) from scrying /app/azimuth
::
::
/- spider, *dice
/+ strand, strandio, naive, ethereum, dice
@ -36,9 +30,9 @@
leaf+"owners: {<~(wyt by owners)>}"
==
::
=/ =path /app/azimuth/[name]/naive
=/ =cage naive+!>([%0 id nas owners sponsors])
=/ =path /app/azimuth/[name]/azimuth
=/ =cage azimuth+!>([%0 id nas owners sponsors])
=/ =task [%info %base %& [path %ins cage]~]
=/ =card [%pass /next %arvo %c task]
;< ~ bind:m (send-raw-card:strandio card)
(pure:m !>('naive state saved'))
(pure:m !>('azimuth state saved'))

View File

@ -1,5 +1,6 @@
:: |pill: helper functions for making pills
::
/- *dice
^?
|%
::
@ -90,7 +91,7 @@
::
++ file-ovum2 |=(p=path `unix-event`[//arvo what/(user-files p)])
::
:: +user-files: all userspace hoon files
:: +user-files: all userspace hoon files, and azimuth snapshot
::
++ user-files
|= bas=path
@ -117,12 +118,12 @@
=/ lon .^(arch %cy pax)
=? hav ?=(^ fil.lon)
::
:: install only hoon files for now
:: install only hoon files and azimuth snapshot for now
::
?. ?=([%hoon *] tyl)
hav
:_ hav
[(flop `path`t.tyl) hoon/.^(@t %cx pax)]
?+ tyl hav
[%hoon *] [(flop `path`t.tyl) hoon/.^(@t %cx pax)]^hav
[%azimuth *] [(flop `path`t.tyl) mime/.^(snap-state %cx pax)]^hav
==
::
=/ all ~(tap by dir.lon)
|- ^+ hav