From 87f689f443bb8f7f8d38416cf1888badba9920a8 Mon Sep 17 00:00:00 2001 From: Philip Monk Date: Mon, 21 Oct 2019 15:41:28 -0700 Subject: [PATCH] custody: add more types --- bin/solid.pill | 4 +- pkg/arvo/gen/azimuth-tracker/watch.hoon | 8 +- pkg/arvo/gen/sql.hoon | 3 +- pkg/arvo/imp/custody.hoon | 30 ------ pkg/arvo/lib/csv.hoon | 3 + pkg/arvo/lib/custody.hoon | 123 ++++++++++++++++++++++-- pkg/arvo/sys/vane/gall.hoon | 6 +- 7 files changed, 129 insertions(+), 48 deletions(-) delete mode 100644 pkg/arvo/imp/custody.hoon diff --git a/bin/solid.pill b/bin/solid.pill index 399b0220e..2bb344428 100644 --- a/bin/solid.pill +++ b/bin/solid.pill @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:466901e624c1515a69a63a7cd11fab0afffeb6caef18ac640f8de44b555f3a00 -size 16472260 +oid sha256:45626297d4766e10dcee72b28655691ffc917f72855c9a0ea0f00caf9f2d4e48 +size 16651919 diff --git a/pkg/arvo/gen/azimuth-tracker/watch.hoon b/pkg/arvo/gen/azimuth-tracker/watch.hoon index 66b83473c..e67e28969 100644 --- a/pkg/arvo/gen/azimuth-tracker/watch.hoon +++ b/pkg/arvo/gen/azimuth-tracker/watch.hoon @@ -1,7 +1,3 @@ -=> |% - +$ config - [url=@ta =from=number:block:able:jael] - -- :- %say -|= [* config ~] -[%azimuth-tracker-poke %watch config] +|= [* [url=@ta ~] ~] +[%azimuth-tracker-poke %watch url] diff --git a/pkg/arvo/gen/sql.hoon b/pkg/arvo/gen/sql.hoon index d4be42561..16d03e920 100644 --- a/pkg/arvo/gen/sql.hoon +++ b/pkg/arvo/gen/sql.hoon @@ -1,4 +1,5 @@ -/+ *custody, *csv +/+ *custody, + *csv |= [=key=path =loc=path] %. ~ %- print-rows diff --git a/pkg/arvo/imp/custody.hoon b/pkg/arvo/imp/custody.hoon deleted file mode 100644 index dc42bd88d..000000000 --- a/pkg/arvo/imp/custody.hoon +++ /dev/null @@ -1,30 +0,0 @@ -/- spider -/+ *threadio, *azimuth, *custody, *csv -=, thread=thread:libthread -^- imp:spider -|= =bowl:mall -=/ m (thread ,~) -^- form:m -=/ url 'http://eth-mainnet.urbit.org:8545' -=/ key-path /=home/(scot %da now.bowl)/keys/txt -=/ loc-path /=home/(scot %da now.bowl)/locations/txt -=/ vases=(list vase) - %+ select - !, *hoon - (need ship.left) - %^ join - (load:keys key-path) - (load:locations loc-path) - !, *hoon - ?& !=(~ ship.left) - =(location.left location.right) - =(%master role.left) - == -=/ ships (turn vases |=(=vase !<(ship vase))) -|- ^- form:m -=* loop $ -?~ ships - (pure:m) -;< =point:azimuth bind:m (fetch-point url i.ships) -%- (slog >[i.ships owner.own.point]< ~) -loop(ships t.ships) diff --git a/pkg/arvo/lib/csv.hoon b/pkg/arvo/lib/csv.hoon index 560dd5149..8022cdff8 100644 --- a/pkg/arvo/lib/csv.hoon +++ b/pkg/arvo/lib/csv.hoon @@ -1,3 +1,6 @@ +:: Parse CSV files with a known schema, then perform queries on the +:: results. +:: |% ++ text %+ cook diff --git a/pkg/arvo/lib/custody.hoon b/pkg/arvo/lib/custody.hoon index 389feb03b..37f5f4705 100644 --- a/pkg/arvo/lib/custody.hoon +++ b/pkg/arvo/lib/custody.hoon @@ -34,7 +34,7 @@ :: +$ shard @udshard +$ copy ?(%a %b %c) - +$ physical-form ?(%usb %dvd %paper) + +$ physical-form ?(%usb %dvd %paper %ledger) ++ parsers :~ text:csv (punt fed) @@ -59,8 +59,9 @@ (rash (of-wain:format .^(wain %cx path)) parse) :: ++ load - |= =path + |= now=@da ^- (list vase) + =/ =path /=home/(scot %da now)/keys/txt (turn (load-forms path) |=(=form !>(form))) -- :: @@ -72,6 +73,7 @@ description=@t =physical-location == + :: +$ location @tlocation +$ physical-location @tphysicallocation ++ parsers @@ -93,12 +95,121 @@ (rash (of-wain:format .^(wain %cx path)) parse) :: ++ load - |= =path + |= now=@da ^- (list vase) + =/ =path /=home/(scot %da now)/locations/txt (turn (load-forms path) |=(=form !>(form))) -- :: -++ policies !! -++ galaxies !! -++ ships !! +++ galaxies + =< form + |% + +$ form + $: =ship + =policy:policies + == + :: + ++ parsers + :~ fed + text:csv + == + :: + ++ parse + %+ cook + |* arg=* + ^- (list form) + arg + (parse:csv parsers) + :: + ++ load-forms + |= =path + ^- (list form) + (rash (of-wain:format .^(wain %cx path)) parse) + :: + ++ load + |= now=@da + ^- (list vase) + =/ =path /=home/(scot %da now)/galaxies/txt + (turn (load-forms path) |=(=form !>(form))) + -- +:: +++ ships + =< form + |% + +$ form + $: =ship + note=@t + == + :: + ++ parsers + :~ fed + text:csv + == + :: + ++ parse + %+ cook + |* arg=* + ^- (list form) + arg + (parse:csv parsers) + :: + ++ load-forms + |= =path + ^- (list form) + (rash (of-wain:format .^(wain %cx path)) parse) + :: + ++ load + |= now=@da + ^- (list vase) + =/ =path /=home/(scot %da now)/ships/txt + (turn (load-forms path) |=(=form !>(form))) + -- +:: +++ policies + =< form + |% + +$ form + $: =policy + =lockup + provenance=@t + description=@t + usage=@t + == + :: + +$ policy @tpolicy + +$ lockup + $? %'1+4' + %'0+2' + %'0+1' + %'0+3' + %'0+1/3' + %'0' + == + :: + ++ parsers + :~ text:csv + (parse-enum lockup) + text:csv + text:csv + text:csv + == + :: + ++ parse + %+ cook + |* arg=* + ^- (list form) + arg + (parse:csv parsers) + :: + ++ load-forms + |= =path + ^- (list form) + (rash (of-wain:format .^(wain %cx path)) parse) + :: + ++ load + |= now=@da + ^- (list vase) + =/ =path /=home/(scot %da now)/policies/txt + (turn (load-forms path) |=(=form !>(form))) + -- -- diff --git a/pkg/arvo/sys/vane/gall.hoon b/pkg/arvo/sys/vane/gall.hoon index 1191243d8..cf893d422 100644 --- a/pkg/arvo/sys/vane/gall.hoon +++ b/pkg/arvo/sys/vane/gall.hoon @@ -406,9 +406,9 @@ :: :: you'd think this would send an ack for the diff :: that caused this pump. it would, but we already - :: sent it when we got the diff in +mo-handle-sys. then - :: we'd have to save the network duct and connect it - :: to this returning pump. + :: sent it when we got the diff in +mo-handle-sys-rep. + :: then we'd have to save the network duct and connect + :: it to this returning pump. :: mo-core ::