Merge pull request #4087 from urbit/philip/testnet-pr

Merge philip/testnet back into na-release/candidate
This commit is contained in:
Philip Monk 2020-12-05 23:23:49 -08:00 committed by GitHub
commit 068f551e6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
46 changed files with 1429 additions and 104 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a2626da031efd3b1b7e743b86d62f959ea54274bf779d9dfb6fcd44dfc118092
size 2711173
oid sha256:1ddcdd98af2befa672da7bbf74ba5170cd5b079f2fb75deb24685608da6a29c8
size 2841752

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:80f25c7953348649f4151c43b03a8025abf458054c66c110839c4c4388c53d06
size 7345051
oid sha256:ae42d143088198dea06be473b43450c1478c094e19f69e79305e63da1c49a832
size 9581384

View File

@ -75,13 +75,15 @@
++ jael-update
|= =udiffs:point
^- (list card:agent:gall)
:- [%give %fact ~[/] %azimuth-udiffs !>(udiffs)]
|- ^- (list card:agent:gall)
?~ udiffs
~
=/ =path /(scot %p ship.i.udiffs)
:* [%give %fact ~[/] %azimuth-udiff !>(i.udiffs)]
[%give %fact ~[path] %azimuth-udiff !>(i.udiffs)]
:: Should really give all diffs involving each ship at the same time
::
:- [%give %fact ~[path] %azimuth-udiffs !>(~[i.udiffs])]
$(udiffs t.udiffs)
==
::
++ start
|= [state=app-state our=ship dap=term]
@ -158,7 +160,7 @@
%- jael-update
?- -.diff
%history (event-logs-to-udiffs loglist.diff)
%log (event-logs-to-udiffs event-log.diff ~)
%logs (event-logs-to-udiffs loglist.diff)
%disavow [*ship id.diff %disavow ~]~
==
::

View File

@ -4,7 +4,7 @@
::
/- inv=invite-store, *metadata-store, *group-store, hook=chat-hook, view=chat-view, *group
/+ default-agent, verb, dbug, store=chat-store, group-store, grpl=group,
resource
resource, *migrate
~% %chat-hook-top ..is ~
|%
+$ card card:agent:gall
@ -302,6 +302,10 @@
::
%chat-hook-action
(poke-chat-hook-action:cc !<(action:hook vase))
::
%import
?> (team:title our.bol src.bol)
(poke-import:cc q.vase)
==
[cards this]
::
@ -350,8 +354,28 @@
==
::
++ on-leave on-leave:def
++ on-peek on-peek:def
++ on-arvo on-arvo:def
++ on-peek
|= =path
^- (unit (unit cage))
?+ path (on-peek:def path)
[%x %export ~]
``noun+!>(state)
==
::
++ on-arvo
|= [=wire =sign-arvo]
^- (quip card _this)
?. ?=([%try-rejoin @ @ *] wire)
(on-arvo:def wire sign-arvo)
=/ nack-count=@ud (slav %ud i.t.wire)
=/ who=@p (slav %p i.t.t.wire)
=/ pax t.t.t.wire
?> ?=([%b %wake *] sign-arvo)
~? ?=(^ error.sign-arvo)
"behn errored in backoff timers, continuing anyway"
:_ this
[(try-rejoin:cc who pax +(nack-count))]~
::
++ on-fail on-fail:def
--
::
@ -610,6 +634,32 @@
==
==
::
++ poke-import
|= arc=*
^- (quip card _state)
=/ sty=state-10
:* %10
(remake-map ;;((tree [path ship]) +<.arc))
;;(? +>-.arc)
(remake-map ;;((tree [path ?]) +>+.arc))
==
:_ sty
%+ turn ~(tap by synced.sty)
|= [=path =ship]
^- card
=/ watch-path=^path [%mailbox path]
?: =(our.bol ship)
=/ store-wire=wire [%store path]
[%pass store-wire %agent [our.bol %chat-store] %watch watch-path]
(try-rejoin ship watch-path 0)
::
++ try-rejoin
|= [who=@p pax=path nack-count=@ud]
^- card
=/ =wire
[%try-rejoin (scot %ud nack-count) (scot %p who) pax]
[%pass wire %agent [who %chat-hook] %watch pax]
::
++ watch-synced
|= pax=path
^- (list card)
@ -764,6 +814,9 @@
|= wir=wire
^- (quip card _state)
?+ wir !!
[%try-rejoin @ @ *]
$(wir t.t.t.wir)
::
[%groups ~] [~[watch-groups] state]
::
[%store @ *]
@ -838,6 +891,13 @@
?> ?=(^ chat)
(migrate-listen t.chat)
[~ state]
::
[%try-rejoin @ *]
=/ nack-count=@ud (slav %ud i.t.wir)
=/ wakeup=@da
(add now.bol (mul ~s1 (bex (min 19 nack-count))))
:_ state
[%pass wir %arvo %b %wait wakeup]~
==
::
++ chat-poke

View File

@ -2,7 +2,7 @@
::
:: data store that holds linear sequences of chat messages
::
/+ store=chat-store, default-agent, verb, dbug, group-store
/+ store=chat-store, default-agent, verb, dbug, group-store, *migrate
~% %chat-store-top ..is ~
|%
+$ card card:agent:gall
@ -92,6 +92,7 @@
%json (poke-json:cc !<(json vase))
%chat-action (poke-chat-action:cc !<(action:store vase))
%noun [~ (poke-noun:cc !<(admin-action vase))]
%import (poke-import:cc q.vase)
==
[cards this]
::
@ -139,6 +140,9 @@
?~ mailbox
~
``noun+!>(config.u.mailbox)
::
[%x %export ~]
``noun+!>(state)
==
::
++ on-agent on-agent:def
@ -235,6 +239,12 @@
[(weld message-moves read-moves) state]
==
::
++ poke-import
|= arc=*
^- (quip card _state)
=/ sty=state-3 [%3 (remake-map ;;((tree [path mailbox:store]) +.arc))]
[~ sty]
::
++ handle-create
|= =action:store
^- (quip card _state)

View File

@ -7,7 +7,14 @@
*metadata-hook,
*metadata-store,
*group
/+ *contact-json, default-agent, dbug, group-store, verb, resource, grpl=group
/+ *contact-json,
default-agent,
dbug,
group-store,
verb,
resource,
grpl=group,
*migrate
~% %contact-hook-top ..is ~
|%
+$ card card:agent:gall
@ -131,6 +138,10 @@
::
%contact-hook-action
(poke-hook-action:cc !<(contact-hook-action vase))
::
%import
?> (team:title our.bol src.bol)
(poke-import:cc q.vase)
==
[cards this]
::
@ -169,8 +180,27 @@
==
::
++ on-leave on-leave:def
++ on-peek on-peek:def
++ on-arvo on-arvo:def
++ on-peek
|= =path
^- (unit (unit cage))
?+ path (on-peek:def path)
[%x %export ~]
``noun+!>(state)
==
++ on-arvo
|= [=wire =sign-arvo]
^- (quip card _this)
?. ?=([%try-rejoin @ @ *] wire)
(on-arvo:def wire sign-arvo)
=/ nack-count=@ud (slav %ud i.t.wire)
=/ who=@p (slav %p i.t.t.wire)
=/ pax t.t.t.wire
?> ?=([%b %wake *] sign-arvo)
~? ?=(^ error.sign-arvo)
"behn errored in backoff timers, continuing anyway"
:_ this
[(try-rejoin:cc who pax +(nack-count))]~
::
++ on-fail on-fail:def
--
::
@ -259,6 +289,27 @@
==
==
::
++ poke-import
|= arc=*
^- (quip card _state)
=/ sty=state-three
[%3 (remake-map ;;((tree [path ship]) +<.arc)) ;;(? +>.arc)]
:_ sty
%+ turn ~(tap by synced.sty)
|= [=path =ship]
^- card
=/ contact-path [%contacts path]
?: =(our.bol ship)
[%pass contact-path %agent [our.bol %contact-store] %watch contact-path]
(try-rejoin ship contact-path 0)
::
++ try-rejoin
|= [who=@p pax=path nack-count=@ud]
^- card
=/ =wire
[%try-rejoin (scot %ud nack-count) (scot %p who) pax]
[%pass wire %agent [who %contact-hook] %watch pax]
::
++ watch-contacts
|= pax=path
^- (list card)
@ -281,6 +332,13 @@
^- (quip card _state)
?~ saw
[~ state]
?: ?=([%try-rejoin @ *] wir)
=/ nack-count=@ud (slav %ud i.t.wir)
=/ wakeup=@da
(add now.bol (mul ~s1 (bex (min 19 nack-count))))
:_ state
[%pass wir %arvo %b %wait wakeup]~
::
?> ?=(^ wir)
[~ state(synced (~(del by synced) t.wir))]
::
@ -294,6 +352,9 @@
|= wir=wire
^- (list card)
?+ wir !!
[%try-rejoin @ @ *]
$(wir t.t.t.wir)
::
[%inv ~]
[%pass /inv %agent [our.bol %invite-store] %watch /invitatory/contacts]~
::

View File

@ -2,7 +2,7 @@
::
:: data store that holds group-based contact data
::
/+ *contact-json, default-agent, dbug
/+ *contact-json, default-agent, dbug, *migrate
|%
+$ card card:agent:gall
+$ versioned-state
@ -122,7 +122,11 @@
=^ cards state
?+ mark (on-poke:def mark vase)
::%json (poke-json:cc !<(json vase))
%contact-action (poke-contact-action:cc !<(contact-action vase))
%contact-action
(poke-contact-action:cc !<(contact-action vase))
::
%import
(poke-import:cc q.vase)
==
[cards this]
::
@ -169,6 +173,9 @@
?~ contacts
~
``noun+!>((~(get by u.contacts) ship))
::
[%x %export ~]
``noun+!>(state)
==
::
++ on-agent on-agent:def
@ -197,6 +204,15 @@
%edit (handle-edit +.action)
==
::
++ poke-import
|= arc=*
^- (quip card _state)
=/ sty=state-three
:- %3
%- remake-map-of-map
;;((tree [path (tree [ship contact])]) +.arc)
[~ sty]
::
++ handle-create
|= =path
^- (quip card _state)

View File

@ -394,24 +394,26 @@
=/ rel-number (sub number.dog 30)
=/ numbers=(list number:block) ~(tap in ~(key by pending-logs.dog))
=. numbers (sort numbers lth)
|- ^- (quip card watchdog)
=^ logs=(list event-log:rpc:ethereum) dog
|- ^- (quip event-log:rpc:ethereum watchdog)
?~ numbers
`dog
?: (gth i.numbers rel-number)
$(numbers t.numbers)
=^ cards-1 dog
=^ rel-logs-1 dog
=/ =loglist (~(get ja pending-logs.dog) i.numbers)
=. pending-logs.dog (~(del by pending-logs.dog) i.numbers)
?~ loglist
`dog
=. history.dog [loglist history.dog]
[loglist dog]
=^ rel-logs-2 dog $(numbers t.numbers)
[(weld rel-logs-1 rel-logs-2) dog]
:_ dog
%+ turn loglist
|= =event-log:rpc:ethereum
^- card
[%give %fact [%logs path]~ %eth-watcher-diff !>([%log event-log])]
=^ cards-2 dog $(numbers t.numbers)
[(weld cards-1 cards-2) dog]
?~ logs
~
^- (list card:agent:gall)
[%give %fact [%logs path]~ %eth-watcher-diff !>([%logs logs])]~
--
::
++ on-arvo
@ -461,7 +463,7 @@
:_ dog(running `[now.bowl new-tid])
=/ args
:^ ~ `new-tid %eth-watcher
!>(`watchpup`[- number pending-logs blocks]:dog)
!>([~ `watchpup`[- number pending-logs blocks]:dog])
:~ (watch-spider path our.bowl /thread-result/[new-tid])
(poke-spider path our.bowl %spider-start !>(args))
==

View File

@ -5,7 +5,7 @@
/- glob
/+ default-agent, verb, dbug
|%
++ hash 0v5.0umdn.af5hq.bp84b.66eao.q0b98
++ hash 0v6.cmrce.5ass7.5gfqi.7c8cg.mdo7n
+$ state-0 [%0 hash=@uv glob=(unit (each glob:glob tid=@ta))]
+$ all-states
$% state-0

View File

@ -1,7 +1,8 @@
:: graph-store [landscape]
::
::
/+ store=graph-store, sigs=signatures, res=resource, default-agent, dbug
/+ store=graph-store, sigs=signatures, res=resource, default-agent, dbug,
*migrate
~% %graph-store-top ..is ~
|%
+$ card card:agent:gall
@ -218,6 +219,7 @@
?+ mark (on-poke:def mark vase)
%graph-update (graph-update !<(update:store vase))
%noun (debug !<(debug-input vase))
%import (poke-import q.vase)
==
[cards this]
::
@ -612,6 +614,151 @@
%graph ^$(graph p.children.node)
==
==
::
++ poke-import
|= arc=*
^- (quip card _state)
|^
=/ sty=state-2 [%2 (remake-network ;;(tree-network +.arc))]
:_ sty
%+ turn ~(tap by graphs.sty)
|= [rid=resource:store =marked-graph:store]
^- card
?: =(our.bowl entity.rid)
=/ =cage [%push-hook-action !>([%add rid])]
[%pass / %agent [our.bowl %graph-push-hook] %poke cage]
(try-rejoin rid 0)
::
+$ tree-network
$: graphs=tree-graphs
tag-queries=(tree [term (tree resource:store)])
update-logs=tree-update-logs
archive=tree-graphs
validators=(tree ^mark)
==
+$ tree-graphs (tree [resource:store tree-marked-graph])
+$ tree-marked-graph [p=tree-graph q=(unit ^mark)]
+$ tree-graph (tree [atom tree-node])
+$ tree-node [post=tree-post children=tree-internal-graph]
+$ tree-internal-graph
$~ [%empty ~]
$% [%graph p=tree-graph]
[%empty ~]
==
+$ tree-update-logs (tree [resource:store tree-update-log])
+$ tree-update-log (tree [time tree-logged-update])
+$ tree-logged-update
$: %0
p=time
$= q
$% [%add-nodes =resource:store nodes=(tree [index:store tree-node])]
[%remove-nodes =resource:store indices=(tree index:store)]
[%add-signatures =uid:store signatures=tree-signatures]
[%remove-signatures =uid:store signatures=tree-signatures]
==
==
+$ tree-signatures (tree signature:store)
+$ tree-post
$: author=ship
=index:store
time-sent=time
contents=(list content:store)
hash=(unit hash:store)
signatures=tree-signatures
==
::
++ remake-network
|= t=tree-network
^- network:store
:* (remake-graphs graphs.t)
(remake-jug tag-queries.t)
(remake-update-logs update-logs.t)
(remake-graphs archive.t)
(remake-set validators.t)
==
::
++ remake-graphs
|= t=tree-graphs
^- graphs:store
%- remake-map
(~(run by t) remake-marked-graph)
::
++ remake-marked-graph
|= t=tree-marked-graph
^- marked-graph:store
[(remake-graph p.t) q.t]
::
++ remake-graph
|= t=tree-graph
^- graph:store
%+ gas:orm *graph:store
%+ turn ~(tap by t)
|= [a=atom tn=tree-node]
^- [atom node:store]
[a (remake-node tn)]
::
++ remake-internal-graph
|= t=tree-internal-graph
^- internal-graph:store
?: ?=(%empty -.t)
[%empty ~]
[%graph (remake-graph p.t)]
::
++ remake-node
|= t=tree-node
^- node:store
:- (remake-post post.t)
(remake-internal-graph children.t)
::
++ remake-update-logs
|= t=tree-update-logs
^- update-logs:store
%- remake-map
(~(run by t) remake-update-log)
::
++ remake-update-log
|= t=tree-update-log
^- update-log:store
=/ ulm ((ordered-map time logged-update:store) gth)
%+ gas:ulm *update-log:store
%+ turn ~(tap by t)
|= [=time tlu=tree-logged-update]
^- [^time logged-update:store]
[time (remake-logged-update tlu)]
::
++ remake-logged-update
|= t=tree-logged-update
^- logged-update:store
:+ %0 p.t
?- -.q.t
%add-nodes
:- %add-nodes
:- resource.q.t
%- remake-map
(~(run by nodes.q.t) remake-node)
::
%remove-nodes
[%remove-nodes resource.q.t (remake-set indices.q.t)]
::
%add-signatures
[%add-signatures uid.q.t (remake-set signatures.q.t)]
::
%remove-signatures
[%remove-signatures uid.q.t (remake-set signatures.q.t)]
==
::
++ remake-post
|= t=tree-post
^- post:store
t(signatures (remake-set signatures.t))
--
::
++ try-rejoin
|= [rid=resource:store nack-count=@]
^- card
=/ res-path (en-path:res rid)
=/ wire [%try-rejoin (scot %ud nack-count) res-path]
[%pass wire %agent [entity.rid %graph-push-hook] %watch resource+res-path]
--
::
++ on-peek
@ -668,6 +815,9 @@
:+ %0
now.bowl
[%add-graph [ship term] `graph:store`p.u.result q.u.result %.y]
::
[%x %export ~]
``noun+!>(state)
::
[%x %graph-subset @ @ @ @ ~]
=/ =ship (slav %p i.t.t.path)
@ -792,9 +942,38 @@
=* validator i.t.wire
=/ =rave:clay [%next %b [%da now.bowl] /[validator]]
[%pass wire %arvo %c %warp our.bowl [%home `rave]]~
::
[%try-rejoin @ *]
=/ rid=resource:store (de-path:res t.t.wire)
=/ nack-count (slav %ud i.t.wire)
?> ?=([%b %wake *] sign-arvo)
~? ?=(^ error.sign-arvo)
"behn errored in backoff timers, continuing anyway"
=/ new=^wire [%try-rejoin (scot %ud +(nack-count)) t.t.wire]
:_ this
[%pass new %agent [entity.rid %graph-push-hook] %watch resource+t.t.wire]~
==
::
++ on-agent on-agent:def
++ on-agent
|= [=wire =sign:agent:gall]
^- (quip card _this)
?. ?=([%try-rejoin @ *] wire)
(on-agent:def wire sign)
?. ?=(%watch-ack -.sign)
[~ this]
=/ rid=resource:store (de-path:res t.t.wire)
?~ p.sign
=/ =cage [%pull-hook-action !>([%add entity.rid rid])]
:_ this
:~ [%pass / %agent [our.bowl %graph-pull-hook] %poke cage]
[%pass wire %agent [entity.rid %graph-push-hook] %leave ~]
==
=/ nack-count=@ud (slav %ud i.t.wire)
=/ wakeup=@da
(add now.bowl (mul ~s1 (bex (min 19 nack-count))))
:_ this
[%pass wire %arvo %b %wait wakeup]~
::
++ on-leave on-leave:def
++ on-fail on-fail:def
--

View File

@ -29,8 +29,8 @@
:: Modify the group. Further documented in /sur/group-store.hoon
::
::
/- *group
/+ store=group-store, default-agent, verb, dbug, resource
/- *group, *contact-view
/+ store=group-store, default-agent, verb, dbug, resource, *migrate
|%
+$ card card:agent:gall
::
@ -169,6 +169,8 @@
?(%group-update %group-action)
(poke-group-update:gc !<(update:store vase))
::
%import
(poke-import:gc q.vase)
==
[cards this]
::
@ -212,10 +214,42 @@
(slav %p i.t.t.t.t.t.t.path)
?~ rid ~
``noun+!>((peek-group-join u.rid ship))
::
[%x %export ~]
``noun+!>(state)
==
::
++ on-agent on-agent:def
++ on-arvo on-arvo:def
++ on-agent
|= [=wire =sign:agent:gall]
^- (quip card _this)
?. ?=([%try-rejoin @ *] wire)
(on-agent:def wire sign)
?> ?=(%poke-ack -.sign)
=/ rid=resource (de-path:resource t.t.wire)
?~ p.sign
=/ =cage
[%pull-hook-action !>([%add entity.rid rid])]
:_ this
[%pass / %agent [our.bowl %group-pull-hook] %poke cage]~
=/ nack-count=@ud (slav %ud i.t.wire)
=/ wakeup=@da
(add now.bowl (mul ~s1 (bex (min 19 nack-count))))
:_ this
[%pass wire %arvo %b %wait wakeup]~
::
++ on-arvo
|= [=wire =sign-arvo]
^- (quip card _this)
?. ?=([%try-rejoin @ *] wire)
(on-arvo:def wire sign-arvo)
=/ =resource (de-path:resource t.t.wire)
=/ nack-count=@ud (slav %ud i.t.wire)
?> ?=([%b %wake *] sign-arvo)
~? ?=(^ error.sign-arvo)
"behn errored in backoff timers, continuing anyway"
:_ this
[(try-rejoin:gc resource +(nack-count))]~
::
++ on-fail on-fail:def
--
::
@ -224,7 +258,7 @@
|= rid=resource
^- (unit group)
(~(get by groups) rid)
::
++ peek-group-join
|= [rid=resource =ship]
=/ ugroup
@ -245,6 +279,76 @@
==
==
::
++ poke-import
|= arc=*
^- (quip card _state)
|^
=/ sty=state-one
[%1 (remake-groups ;;((tree [resource tree-group]) +.arc))]
:_ sty
%+ roll ~(tap by groups.sty)
|= [[rid=resource grp=group] out=(list card)]
?: =(entity.rid our.bol)
%+ weld out
%+ roll ~(tap in members.grp)
|= [recipient=@p out=(list card)]
?: =(recipient our.bol)
out
:_ out
%- poke-contact
:* %invite rid recipient
(crip "Rejoin disconnected group {<entity.rid>}/{<name.rid>}")
==
:_ out
(try-rejoin rid 0)
::
++ remake-groups
|= grps=(tree [resource tree-group])
^- ^groups
%- remake-map
(~(run by grps) remake-group)
::
++ remake-group
|= grp=tree-group
^- group
%= grp
members (remake-set members.grp)
tags (remake-jug tags.grp)
policy (remake-policy policy.grp)
==
::
+$ tree-group
$: members=(tree ship)
tags=(tree [tag (tree ship)])
policy=tree-policy
hidden=?
==
::
+$ tree-policy
$% [%invite pending=(tree ship)]
[%open ban-ranks=(tree rank:title) banned=(tree ship)]
==
::
++ remake-policy
|= pl=tree-policy
^- policy
?- -.pl
%invite [%invite (remake-set pending.pl)]
%open [%open (remake-set ban-ranks.pl) (remake-set banned.pl)]
==
--
::
++ try-rejoin
|= [rid=resource nack-count=@ud]
^- card
=/ =cage
:- %group-update
!> ^- update:store
[%add-members rid (sy our.bol ~)]
=/ =wire
[%try-rejoin (scot %ud nack-count) (en-path:resource rid)]
[%pass wire %agent [entity.rid %group-push-hook] %poke cage]
::
++ poke-group-update
|= =update:store
^- (quip card _state)
@ -516,6 +620,11 @@
|= =action:store
^- card
[%pass / %agent [our.bol %group-store] %poke %group-action !>(action)]
::
++ poke-contact
|= act=contact-view-action
^- card
[%pass / %agent [our.bol %contact-view] %poke %contact-view-action !>(act)]
:: +send-diff: update subscribers of new state
::
:: We only allow subscriptions on /groups

View File

@ -1,6 +1,6 @@
:: invite-store [landscape]
/- store=invite-store
/+ res=resource, default-agent, dbug
/+ res=resource, default-agent, dbug, *migrate
|%
+$ card card:agent:gall
+$ versioned-state
@ -102,9 +102,19 @@
=^ cards state
?+ mark (on-poke:def mark vase)
%invite-action (poke-invite-action !<(action:store vase))
%import (poke-import q.vase)
==
[cards this]
::
++ poke-import
|= arc=*
^- (quip card _state)
=/ sty=state-1
:- %1
%- remake-map-of-map
;;((tree [term (tree [serial:store invite:store])]) +.arc)
[~ sty]
::
++ poke-invite-action
|= =action:store
^- (quip card _state)
@ -205,5 +215,7 @@
:^ ~ ~ %noun
!> ^- (unit invite:store)
(~(get by invitatory) serial)
::
[%x %export ~] ``noun+!>(state)
==
--

View File

@ -24,6 +24,6 @@
<div id="portal-root"></div>
<script src="/~landscape/js/channel.js"></script>
<script src="/~landscape/js/session.js"></script>
<script src="/~landscape/js/bundle/index.2e81ebfd000b4945c3fe.js"></script>
<script src="/~landscape/js/bundle/index.649a8f56804ea2cb643c.js"></script>
</body>
</html>

View File

@ -17,10 +17,10 @@
::
++ export-app
|= [app=@tas our=@p now=@da]
.^(@ %gx /(scot %p our)/[app]/(scot %da now)/export/noun)
.^(* %gx /(scot %p our)/[app]/(scot %da now)/export/noun)
++ export-all
|= [our=@p now=@da]
^- (list [@tas @])
^- (list [@tas *])
%+ turn
^- (list @tas)
:~ %group-store
@ -31,7 +31,6 @@
%invite-store
%chat-store
%chat-hook
%publish
%graph-store
==
|= app=@tas
@ -60,8 +59,18 @@
=/ request-line (parse-request-line url.request.inbound-request)
=/ site (flop site.request-line)
::
=/ body=@t q:(need body.request.inbound-request)
?: =('#import_' (end [3 8] body))
~& %import-all
=/ by-app ;;((list [@tas *]) (cue (rsh [3 8] body)))
:_ this
%+ weld (give-simple-payload:app eyre-id not-found:gen)
%+ turn by-app
|= [app=@tas data=*]
^- card:agent:gall
[%pass /import-all %agent [our.bowl app] %poke %import !>(data)]
=/ jon=json
(need (de-json:html q:(need body.request.inbound-request)))
(need (de-json:html body))
=/ com=command:lens
(json:grab:lens-mark jon)
::
@ -94,13 +103,14 @@
(json-response:gen jon)
::
%import-all
~& %import-all
=/ enc (de:base64 base64-jam.source.com)
?~ enc !!
=/ by-app ;;((list [@tas @]) (cue q.u.enc))
=/ by-app ;;((list [@tas *]) (cue q.u.enc))
:_ this
%+ weld (give-simple-payload:app eyre-id not-found:gen)
%+ turn by-app
|= [app=@tas data=@]
|= [app=@tas data=*]
^- card:agent:gall
[%pass /import-all %agent [our.bowl app] %poke %import !>(data)]
==

View File

@ -6,7 +6,7 @@
:: /group/%group-path all updates related to this group
::
/- *metadata-store, *metadata-hook
/+ default-agent, dbug, verb, grpl=group
/+ default-agent, dbug, verb, grpl=group, *migrate
~% %metadata-hook-top ..is ~
|%
+$ card card:agent:gall
@ -51,9 +51,30 @@
`this
::
++ on-leave on-leave:def
++ on-peek on-peek:def
++ on-arvo on-arvo:def
++ on-peek
|= =path
^- (unit (unit cage))
?+ path (on-peek:def path)
[%x %export ~]
``noun+!>(state)
==
::
++ on-arvo
|= [=wire =sign-arvo]
^- (quip card _this)
?. ?=([%try-rejoin @ @ *] wire)
(on-arvo:def wire sign-arvo)
=/ nack-count=@ud (slav %ud i.t.wire)
=/ who=@p (slav %p i.t.t.wire)
=/ pax t.t.t.wire
?> ?=([%b %wake *] sign-arvo)
~? ?=(^ error.sign-arvo)
"behn errored in backoff timers, continuing anyway"
:_ this
[(try-rejoin:hc who pax +(nack-count))]~
::
++ on-fail on-fail:def
::
++ on-poke
|= [=mark =vase]
^- (quip card _this)
@ -65,6 +86,12 @@
::
%metadata-action
[(poke-action:hc !<(metadata-action vase)) this]
::
%import
?> (team:title our.bowl src.bowl)
=^ cards state
(poke-import:hc q.vase)
[cards this]
==
::
++ on-watch
@ -166,6 +193,26 @@
!=(i.path '~')
--
::
++ poke-import
|= arc=*
^- (quip card _state)
=/ sty=state-one
[%1 (remake-map ;;((tree [group-path ship]) +.arc))]
:_ sty
%+ murn ~(tap by synced.sty)
|= [=group-path =ship]
?: =(ship our.bowl)
~
=/ =path [%group group-path]
`(try-rejoin ship path 0)
::
++ try-rejoin
|= [who=@p pax=path nack-count=@ud]
^- card
=/ =wire
[%try-rejoin (scot %ud nack-count) (scot %p who) pax]
[%pass wire %agent [who %metadata-hook] %watch pax]
::
++ watch-group
|= =path
^- (list card)
@ -240,7 +287,11 @@
|= wir=wire
^- (quip card _state)
:_ state
|-
?+ wir !!
[%try-rejoin @ @ *]
$(wir t.t.t.wir)
::
[%updates ~]
[%pass /updates %agent [our.bowl %metadata-store] %watch /updates]~
::
@ -255,6 +306,14 @@
++ watch-ack
|= [wir=wire saw=(unit tang)]
^- (quip card _state)
?: ?=([%try-rejoin @ *] wir)
?~ saw
[~ state]
=/ nack-count=@ud (slav %ud i.t.wir)
=/ wakeup=@da
(add now.bowl (mul ~s1 (bex (min 19 nack-count))))
:_ state
[%pass wir %arvo %b %wait wakeup]~
?> ?=(^ wir)
[~ ?~(saw state state(synced (~(del by synced) t.wir)))]
::

View File

@ -24,7 +24,7 @@
:: /group/%group-path associations for group
::
/- *metadata-store, *metadata-hook
/+ *metadata-json, default-agent, verb, dbug, resource
/+ *metadata-json, default-agent, verb, dbug, resource, *migrate
|%
+$ card card:agent:gall
+$ base-state-0
@ -278,6 +278,7 @@
?+ mark (on-poke:def mark vase)
%metadata-action
(poke-metadata-action:mc !<(metadata-action vase))
::
%noun
=/ val=(each [%cleanup path] tang)
(mule |.(!<([%cleanup path] vase)))
@ -296,6 +297,9 @@
[app-name.r group app-path.r]
==
out
::
%import
(poke-import:mc q.vase)
==
[cards this]
::
@ -350,6 +354,9 @@
=/ app=term i.t.t.path
=/ app-path=^path t.t.t.path
``noun+!>((~(get by resource-indices) app app-path))
::
[%x %export ~]
``noun+!>(state)
==
::
++ on-leave on-leave:def
@ -368,6 +375,31 @@
%remove (handle-remove group-path.act resource.act)
==
::
++ poke-import
|= arc=*
^- (quip card _state)
|^
=/ sty=state-6
[%6 (remake-metadata ;;(tree-metadata +.arc))]
[~ sty]
::
+$ tree-metadata
$: associations=(tree [[group-path md-resource] metadata])
group-indices=(tree [group-path (tree md-resource)])
app-indices=(tree [app-name (tree [group-path app-path])])
resource-indices=(tree [md-resource (tree group-path)])
==
::
++ remake-metadata
|= tm=tree-metadata
^- base-state-1
:* (remake-map associations.tm)
(remake-jug group-indices.tm)
(remake-jug app-indices.tm)
(remake-jug resource-indices.tm)
==
--
::
++ handle-add
|= [=group-path =md-resource =metadata]
^- (quip card _state)

View File

@ -0,0 +1,45 @@
/+ *ph-util
:- %say
|= $: [now=@da eny=@uv bec=beak]
[who=@p ~]
~
==
|^
:- %noun
(export-all who)
::
++ export-app
|= [who=ship agent=term]
=/ aqua-pax=path
:~ %i
(scot %p who)
%gx
(scot %p who)
agent
(scot %da now)
%export
%noun
%noun
==
~| agent
%- need
(scry-aqua (unit *) p.bec now aqua-pax)
::
++ export-all
|= who=ship
%+ turn
^- (list @tas)
:~ %group-store
%metadata-store
%metadata-hook
%contact-store
%contact-hook
%invite-store
%chat-store
%chat-hook
%graph-store
==
|= app=@tas
[app (export-app who app)]
::
--

View File

@ -1,3 +1,4 @@
/+ version
=, clay
=, space:userlib
=, format
@ -108,9 +109,11 @@
++ on-peek
|= =path
^- (unit (unit cage))
?. ?=([%x %kiln %ota ~] path)
[~ ~]
``noun+!>(ota)
?+ path [~ ~]
[%x %kiln %ota ~] ``noun+!>(ota)
[%x %kiln %our ~] ``noun+!>(our)
[%x %kiln %base-hash ~] ``noun+!>((base-hash:version our now))
==
::
++ poke-commit
|= [mon=kiln-commit auto=?]

19
pkg/arvo/lib/migrate.hoon Normal file
View File

@ -0,0 +1,19 @@
|%
++ remake-set
|* s=(tree)
(sy ~(tap in s))
::
++ remake-map
|* m=(tree)
(my ~(tap by m))
::
++ remake-jug
|* j=(tree [* (tree)])
%- remake-map
(~(run by j) remake-set)
::
++ remake-map-of-map
|* mm=(tree [* (tree)])
%- remake-map
(~(run by mm) remake-map)
--

View File

@ -341,4 +341,20 @@
?: =(warped (need (scry-aqua:util (unit @) our now aqua-pax)))
(pure:m ~)
loop
::
:: Turns poke into a dojo command
::
++ poke-app
|= [=ship app=term =mark data=*]
=/ m (strand ,~)
^- form:m
=/ command=tape ":{(trip app)} &{(trip mark)} {<data>}"
(send-events (dojo:util ship command))
::
++ dojo-thread
|= [=ship ted=term =mark data=*]
=/ m (strand ,~)
^- form:m
=/ command=tape "-{(trip ted)} &{(trip mark)} {<data>}"
(send-events (dojo:util ship command))
--

View File

@ -228,6 +228,7 @@
=. inner-state
on-save:og
!>(state)
::
++ on-poke
|= [=mark =vase]
^- [(list card:agent:gall) agent:gall]

View File

@ -670,12 +670,16 @@
::
++ start-thread
|= file=term
(start-thread-with-args file *vase)
::
++ start-thread-with-args
|= [file=term args=vase]
=/ m (strand ,tid:spider)
^- form:m
;< =bowl:spider bind:m get-bowl
=/ tid
(scot %ta (cat 3 (cat 3 'strand_' file) (scot %uv (sham file eny.bowl))))
=/ poke-vase !>([`tid.bowl `tid file *vase])
=/ poke-vase !>([`tid.bowl `tid file args])
;< ~ bind:m (poke-our %spider %spider-start poke-vase)
;< ~ bind:m (sleep ~s0) :: wait for thread to start
(pure:m tid)

View File

@ -0,0 +1,12 @@
/- *contact-view
|_ act=contact-view-action
++ grad %noun
++ grow
|%
++ noun act
--
++ grab
|%
++ noun contact-view-action
--
--

15
pkg/arvo/mar/import.hoon Normal file
View File

@ -0,0 +1,15 @@
=, mimes:html
|_ non=*
++ grab
|%
++ noun *
++ mime
|= [* p=octs]
(cue q.p)
--
++ grow
|%
++ mime [/application/x-urb-import (as-octs (jam non))]
--
++ grad %mime
--

View File

@ -0,0 +1,12 @@
/- *metadata-hook
|_ act=metadata-hook-action
++ grad %noun
++ grow
|%
++ noun act
--
++ grab
|%
++ noun metadata-hook-action
--
--

View File

@ -46,9 +46,9 @@
$% :: %history: full event log history, oldest first
::
[%history =loglist]
:: %log: newly added log
:: %logs: newly added logs
::
[%log =event-log:rpc:ethereum]
[%logs =loglist]
:: %disavow: forget logs
::
:: this is sent when a reorg happens that invalidates

View File

@ -1,4 +1,4 @@
!: :: %gall, agent execution
:: :: %gall, agent execution
!? 163
::
::::

View File

@ -97,8 +97,6 @@
$% $>(%init vane-task) :: report install
== == == ::
:: ::
+$ peer-sign [=ship =udiff:point] ::
:: ::
+$ sign :: in result $<-
$~ [%a %done ~] ::
$% $: %a ::
@ -313,7 +311,7 @@
(~(gas by points) spon-points)
=. +>.$
%- curd =< abet
(public-keys:~(feel su hen our now pki etn) %full points)
(public-keys:~(feel su hen our now pki etn) pos.zim.pki %full points)
::
:: start subscriptions
::
@ -451,7 +449,7 @@
~& [%not-our-moon ship.tac]
+>.$
%- curd =< abet
(~(new-event su hen our now pki etn) [ship udiff]:tac)
(~(new-event su hen our now pki etn) [ship udiff]~:tac)
::
:: rotate web login code
::
@ -544,7 +542,7 @@
[%a %boon *]
=+ ;; [%public-keys-result =public-keys-result] payload.hin
%- curd =< abet
(public-keys:~(feel su hen our now pki etn) public-keys-result)
(public-keys:~(feel su hen our now pki etn) pos.zim.pki public-keys-result)
::
[%a %lost *]
:: TODO: better error handling
@ -587,9 +585,9 @@
%fact
?> ?=([@ *] tea)
=* app i.tea
=/ =peer-sign ;;(peer-sign q.q.cage.p.+>.hin)
=+ ;;(=udiffs:point q.q.cage.p.+>.hin)
%- curd =< abet
(~(new-event su hen our now pki etn) peer-sign)
(~(new-event su hen our now pki etn) udiffs)
==
==
:: :: ++curd:of
@ -716,13 +714,17 @@
==
::
++ new-event
|= [=a=ship =a=udiff:point]
|= =udiffs:point
^+ this-su
=/ a-point=point (~(gut by pos.zim.pki) a-ship *point)
=/ a-diff=(unit diff:point) (udiff-to-diff:point a-udiff a-point)
?~ a-diff
=/ original-pos pos.zim.pki
|- ^+ this-su
?~ udiffs
this-su
(public-keys:feel %diff a-ship u.a-diff)
=/ a-point=point (~(gut by pos.zim.pki) ship.i.udiffs *point)
=/ a-diff=(unit diff:point) (udiff-to-diff:point udiff.i.udiffs a-point)
=? this-su ?=(^ a-diff)
(public-keys:feel original-pos %diff ship.i.udiffs u.a-diff)
$(udiffs t.udiffs)
::
++ subscribers-on-ship
|= =ship
@ -837,7 +839,7 @@
:: Update public-keys
::
++ public-keys
|= =public-keys-result
|= [original=(map ship point) =public-keys-result]
^+ ..feel
?: ?=(%full -.public-keys-result)
=/ pointl=(list [who=ship =point])
@ -845,12 +847,14 @@
|- ^+ ..feel
?~ pointl
..feel(pos.zim (~(uni by pos.zim) points.public-keys-result))
:: if changing rift upward, then signal a breach
:: if changing rift upward and we already had keys for them,
:: then signal a breach
::
=? ..feel
=/ point
(~(get by pos.zim) who.i.pointl)
?& ?=(^ point)
?& (~(has by original) who.i.pointl)
?=(^ point)
(gth rift.point.i.pointl rift.u.point)
==
=. ..feel
@ -879,10 +883,12 @@
=/ a-diff=diff:point diff.public-keys-result
=/ maybe-point (~(get by pos.zim) who)
=/ =point (fall maybe-point *point)
:: if changing rift upward, then signal a breach
:: if changing rift upward and we already had keys for them, then
:: signal a breach
::
=? ..feel
?& ?=(^ maybe-point)
?& (~(has by original) who)
?=(^ maybe-point)
?=(%rift -.a-diff)
(gth to.a-diff rift.point)
==

View File

@ -7963,7 +7963,7 @@
:: # constants
::
:: contract addresses
++ contracts ropsten-contracts
++ contracts mainnet-contracts
++ mainnet-contracts
|%
:: azimuth: data contract

View File

@ -9,7 +9,7 @@
::
|= args=vase
|^
=+ !<(pup=watchpup args)
=+ !<([~ pup=watchpup] args)
=/ m (strand:strandio ,vase)
^- form:m
;< =latest=block bind:m (get-latest-block:ethio url.pup)

View File

@ -0,0 +1,22 @@
/- spider
/+ *ph-io
=, strand=strand:spider
^- thread:spider
|= arg=vase
=+ !<(who=(list @p) arg)
=/ m (strand ,vase)
;< ~ bind:m start-simple
=? who ?=(~ who) ~[~zod ~bus ~web]
|-
=* loop $
?~ who
:: ;< ~ bind:m (send-hi ~zod ~bus)
:: ;< ~ bind:m (send-hi ~zod ~web)
:: ;< ~ bind:m (send-hi ~bus ~zod)
:: ;< ~ bind:m (send-hi ~bus ~web)
:: ;< ~ bind:m (send-hi ~web ~zod)
:: ;< ~ bind:m (send-hi ~web ~bus)
(pure:m *vase)
;< ~ bind:m (breach-aqua i.who)
;< ~ bind:m (init-ship i.who)
loop(who t.who)

View File

@ -0,0 +1,61 @@
::
:: warning: using this thread will clobber aqua's currently active piers
::
/- spider, *aquarium
/+ *ph-io
=, strand=strand:spider
=>
|%
++ commit
|= [our=@p now=@da ships=(list @p)]
^- (list aqua-event)
%+ turn ships
|= her=@p
:+ %event her
=/ paths .^((list path) %ct /(scot %p our)/home/(scot %da now))
=/ mod=mode:clay
%+ murn paths
|= pat=path
^- (unit [path (unit mime)])
?. =((snag (dec (lent pat)) pat) %hoon)
~
=/ clay-pax=path (weld /(scot %p our)/home/(scot %da now) pat)
=/ file [/text/plain (as-octs:mimes:html .^(@ %cx clay-pax))]
`[pat `file]
:- //sync/0v1n.2m9vh
[%into %home | mod]
::
++ restore-fleet
|= label=term
^- (list aqua-event)
[%restore-snap label]~
::
++ snap-fleet
|= [label=term ships=(list @p)]
^- (list aqua-event)
[%snap-ships label ships]~
--
^- thread:spider
|= arg=vase
=+ !<(fleets=(list term) arg)
=/ m (strand ,vase)
;< ~ bind:m start-simple
=/ ships=(list @p) ~[~zod ~bus ~web]
;< =bowl:spider bind:m get-bowl
=/ commit-events (commit our.bowl now.bowl ships)
|-
=* fleet-loop $
?~ fleets
(pure:m *vase)
::
;< ~ bind:m (send-events (restore-fleet i.fleets))
;< ~ bind:m (sleep ~s0)
;< ~ bind:m (send-events commit-events)
;< ~ bind:m (sleep ~s0)
;< =bowl:spider bind:m get-bowl
=/ full-ships
.^((list @p) %gx /(scot %p our.bowl)/aqua/(scot %da now.bowl)/ships/noun)
;< ~ bind:m (send-events (snap-fleet i.fleets full-ships))
;< ~ bind:m (sleep ~s0)
::
fleet-loop(fleets t.fleets)

View File

@ -0,0 +1,22 @@
/- spider
/+ *ph-io
=, strand=strand:spider
=>
|%
++ import-all
|= [who=@p by-app=(list [@tas *])]
=/ m (strand:spider ,~)
^- form:m
=* loop $
?~ by-app (pure:m ~)
=/ [app=@tas data=*] i.by-app
;< ~ bind:m (poke-app who app %import data)
loop(by-app t.by-app)
--
^- thread:spider
|= arg=vase
=+ !<([who=@p by-app=(list [@tas *]) ~] arg)
=/ m (strand ,vase)
;< ~ bind:m start-simple
;< ~ bind:m (import-all who by-app)
(pure:m *vase)

View File

@ -0,0 +1,24 @@
/- spider
/+ *ph-io
=, strand=strand:spider
^- thread:spider
|= vase
=/ m (strand ,vase)
;< ~ bind:m start-simple
;< ~ bind:m init-azimuth
;< ~ bind:m (spawn-aqua ~zod)
;< ~ bind:m (spawn-aqua ~bus)
;< ~ bind:m (spawn-aqua ~web)
::
;< ~ bind:m (init-ship ~zod)
;< ~ bind:m (init-ship ~bus)
;< ~ bind:m (init-ship ~web)
::
;< ~ bind:m (send-hi ~zod ~web)
;< ~ bind:m (send-hi ~zod ~bus)
;< ~ bind:m (send-hi ~web ~zod)
;< ~ bind:m (send-hi ~bus ~zod)
;< ~ bind:m (send-hi ~bus ~web)
;< ~ bind:m (send-hi ~web ~bus)
::
(pure:m *vase)

View File

@ -0,0 +1,96 @@
/- spider,
chat-view,
*resource,
chat-store
/+ *ph-io, strandio
=, strand=strand:spider
=>
|%
++ chat-message
|= [our=@p =path wen=@da mes=cord]
=/ act=action:chat-store
:* %message path `@uvH`(sham [our path mes])
0 our wen [%text mes]
==
(poke-app our %chat-hook %chat-action act)
--
::
^- thread:spider
|= vase
=/ m (strand ,vase)
;< ~ bind:m start-simple
;< bol=bowl:spider bind:m get-bowl:strandio
::
:: chat setup
:: - ~zod creates a chat associated with group-1
:: - ~bus creates a chat associated with group-1
:: - ~web creates a dm with ~zod
::
=/ chat-1=action:chat-view
:* %create
'Chat 1' ''
/~zod/chat-1
/ship/~zod/group-1
[%invite ~]
~
%.y
%.n
==
=/ chat-2=action:chat-view
:* %create
'Chat 2' ''
/~bus/chat-2
/ship/~zod/group-1
[%invite ~]
~
%.y
%.n
==
=/ web-zod-dm=action:chat-view
:* %create
'~web <-> ~zod' ''
/~web/dm--zod
/ship/~web/dm--zod
[%invite (sy ~zod ~)]
(sy ~zod ~)
%.y
%.n
==
=/ join-1 [%join ~zod /~zod/chat-1 %.y]
=/ join-2 [%join ~bus /~bus/chat-2 %.y]
=/ join-3 [%join ~web /~web/dm--zod %.y]
;< ~ bind:m (poke-app ~zod %chat-view %chat-view-action chat-1)
;< ~ bind:m (wait-for-output ~zod ">=")
;< ~ bind:m (poke-app ~bus %chat-view %chat-view-action chat-2)
;< ~ bind:m (wait-for-output ~bus ">=")
;< ~ bind:m (poke-app ~web %chat-view %chat-view-action web-zod-dm)
;< ~ bind:m (wait-for-output ~web ">=")
;< ~ bind:m (sleep ~s20)
::
;< ~ bind:m (poke-app ~bus %chat-view %chat-view-action join-1)
;< ~ bind:m (wait-for-output ~bus ">=")
;< ~ bind:m (poke-app ~web %chat-view %chat-view-action join-1)
;< ~ bind:m (wait-for-output ~web ">=")
::
;< ~ bind:m (poke-app ~zod %chat-view %chat-view-action join-2)
;< ~ bind:m (wait-for-output ~zod ">=")
;< ~ bind:m (poke-app ~web %chat-view %chat-view-action join-2)
;< ~ bind:m (wait-for-output ~web ">=")
::
;< ~ bind:m (poke-app ~zod %chat-view %chat-view-action join-3)
;< ~ bind:m (wait-for-output ~zod ">=")
;< ~ bind:m (sleep ~s20)
::
;< ~ bind:m (chat-message ~zod /~zod/chat-1 now.bol 'message 1')
;< ~ bind:m (chat-message ~bus /~zod/chat-1 now.bol 'message 2')
;< ~ bind:m (chat-message ~web /~bus/chat-2 now.bol 'message 3')
;< ~ bind:m (chat-message ~zod /~web/dm--zod now.bol 'message 4')
::
;< ~ bind:m (send-hi ~zod ~bus)
;< ~ bind:m (send-hi ~zod ~web)
;< ~ bind:m (send-hi ~bus ~zod)
;< ~ bind:m (send-hi ~bus ~web)
;< ~ bind:m (send-hi ~web ~zod)
;< ~ bind:m (send-hi ~web ~bus)
::
(pure:m *vase)

View File

@ -0,0 +1,112 @@
/- spider,
graph-store,
graph-view,
post,
*resource
/+ *ph-io, strandio
=, strand=strand:spider
=>
|%
::
++ graph-post
|= [our=@p wen=@da rid=resource body=cord id=@]
=/ =index:post [id]~
=/ =post:post [our index wen [%text body]~ ~ ~]
=/ =node:graph-store [post %empty ~]
=/ act=update:graph-store [%0 wen %add-nodes rid (my [index node] ~)]
(poke-app our %graph-push-hook %graph-update act)
--
::
^- thread:spider
|= vase
=/ m (strand ,vase)
;< ~ bind:m start-simple
;< bol=bowl:spider bind:m get-bowl:strandio
::
:: create graphs
::
=/ group-rid [~zod %group-1]
=/ group-path /ship/~zod/group-1
=/ create-1=action:graph-view
:* %create
[~zod %graph-1]
'graph 1'
'desc 1'
~
[%group group-rid]
'fake'
==
::
=/ create-2=action:graph-view
:* %create
[~bus %graph-2]
'graph 2'
'desc 2'
~
[%group group-rid]
'fake'
==
::
=/ create-3=action:graph-view
:* %create
[~web %graph-3]
'graph 3'
'desc 3'
~
[%policy %invite (sy ~zod ~bus ~)]
'fake'
==
::
;< ~ bind:m (dojo-thread ~zod %graph-create %graph-view-action create-1)
;< ~ bind:m (dojo-thread ~bus %graph-create %graph-view-action create-2)
;< ~ bind:m (dojo-thread ~web %graph-create %graph-view-action create-3)
;< ~ bind:m (sleep ~s30)
::
:: join graphs
::
=/ join-1=action:graph-view
[%join [~zod %graph-1] ~zod]
=/ join-2=action:graph-view
[%join [~bus %graph-2] ~bus]
=/ join-3=action:graph-view
[%join [~web %graph-3] ~web]
::
;< ~ bind:m (dojo-thread ~zod %graph-join %graph-view-action join-2)
;< ~ bind:m (dojo-thread ~zod %graph-join %graph-view-action join-3)
;< ~ bind:m (dojo-thread ~bus %graph-join %graph-view-action join-1)
;< ~ bind:m (dojo-thread ~bus %graph-join %graph-view-action join-3)
;< ~ bind:m (dojo-thread ~web %graph-join %graph-view-action join-1)
;< ~ bind:m (dojo-thread ~web %graph-join %graph-view-action join-2)
;< ~ bind:m (sleep ~s30)
::
:: make posts
::
;< ~ bind:m (graph-post ~zod now.bol [~zod %graph-1] 'post 1' 1)
;< ~ bind:m (sleep ~s5)
;< ~ bind:m (graph-post ~bus now.bol [~zod %graph-1] 'post 2' 2)
;< ~ bind:m (sleep ~s5)
;< ~ bind:m (graph-post ~web now.bol [~zod %graph-1] 'post 3' 3)
;< ~ bind:m (sleep ~s5)
::
;< ~ bind:m (graph-post ~zod now.bol [~bus %graph-2] 'post 4' 4)
;< ~ bind:m (sleep ~s5)
;< ~ bind:m (graph-post ~bus now.bol [~bus %graph-2] 'post 5' 5)
;< ~ bind:m (sleep ~s5)
;< ~ bind:m (graph-post ~web now.bol [~bus %graph-2] 'post 6' 6)
;< ~ bind:m (sleep ~s5)
::
;< ~ bind:m (graph-post ~zod now.bol [~web %graph-3] 'post 7' 7)
;< ~ bind:m (sleep ~s5)
;< ~ bind:m (graph-post ~bus now.bol [~web %graph-3] 'post 8' 8)
;< ~ bind:m (sleep ~s5)
;< ~ bind:m (graph-post ~web now.bol [~web %graph-3] 'post 9' 9)
;< ~ bind:m (sleep ~s5)
::
;< ~ bind:m (send-hi ~zod ~bus)
;< ~ bind:m (send-hi ~zod ~web)
;< ~ bind:m (send-hi ~bus ~zod)
;< ~ bind:m (send-hi ~bus ~web)
;< ~ bind:m (send-hi ~web ~zod)
;< ~ bind:m (send-hi ~web ~bus)
::
(pure:m *vase)

View File

@ -0,0 +1,46 @@
/- spider,
contact-view,
*resource
/+ *ph-io, strandio
=, strand=strand:spider
::
^- thread:spider
|= vase
=/ m (strand ,vase)
;< ~ bind:m start-simple
;< bol=bowl:spider bind:m get-bowl:strandio
::
:: group setup
:: - ~zod creates an open group
:: - ~zod creates and invite-only group, and invites ~bus and ~web
:: - ~bus and ~web join the first, but not the second group, to keep
:: invite-store populated
::
=/ group-1=contact-view-action:contact-view
:* %create
%group-1
[%open ~ ~]
'Group 1'
'this is group 1'
==
=/ group-2=contact-view-action:contact-view
:* %create
%group-2
[%invite (sy ~bus ~web ~)]
'Group 2'
'this is group 2'
==
=/ join=contact-view-action:contact-view [%join ~zod %group-1]
;< ~ bind:m (poke-app ~zod %contact-view %contact-view-action group-1)
;< ~ bind:m (wait-for-output ~zod ">=")
;< ~ bind:m (poke-app ~zod %contact-view %contact-view-action group-2)
;< ~ bind:m (wait-for-output ~zod ">=")
;< ~ bind:m (sleep ~s10)
;< ~ bind:m (poke-app ~bus %contact-view %contact-view-action join)
;< ~ bind:m (wait-for-output ~bus ">=")
;< ~ bind:m (poke-app ~web %contact-view %contact-view-action join)
;< ~ bind:m (wait-for-output ~web ">=")
;< ~ bind:m (send-hi ~bus ~zod)
;< ~ bind:m (send-hi ~web ~zod)
;< ~ bind:m (sleep ~s2)
(pure:m *vase)

View File

@ -0,0 +1,36 @@
/- spider,
chat-view,
*resource,
chat-store
/+ *ph-io, strandio
=, strand=strand:spider
=>
|%
++ chat-message
|= [our=@p =path wen=@da mes=cord]
=/ act=action:chat-store
:* %message path `@uvH`(sham [our path mes])
0 our wen [%text mes]
==
(poke-app our %chat-hook %chat-action act)
--
::
^- thread:spider
|= vase
=/ m (strand ,vase)
;< ~ bind:m start-simple
;< bol=bowl:spider bind:m get-bowl:strandio
::
;< ~ bind:m (chat-message ~zod /~zod/chat-1 now.bol 'message 5')
;< ~ bind:m (chat-message ~bus /~zod/chat-1 now.bol 'message 6')
;< ~ bind:m (chat-message ~web /~bus/chat-2 now.bol 'message 7')
;< ~ bind:m (chat-message ~zod /~web/dm--zod now.bol 'message 8')
::
;< ~ bind:m (send-hi ~zod ~bus)
;< ~ bind:m (send-hi ~zod ~web)
;< ~ bind:m (send-hi ~bus ~zod)
;< ~ bind:m (send-hi ~bus ~web)
;< ~ bind:m (send-hi ~web ~zod)
;< ~ bind:m (send-hi ~web ~bus)
::
(pure:m *vase)

View File

@ -0,0 +1,56 @@
/- spider,
graph-store,
graph-view,
post,
*resource
/+ *ph-io, strandio
=, strand=strand:spider
=>
|%
::
++ graph-post
|= [our=@p wen=@da rid=resource body=cord id=@]
=/ =index:post [id]~
=/ =post:post [our index wen [%text body]~ ~ ~]
=/ =node:graph-store [post %empty ~]
=/ act=update:graph-store [%0 wen %add-nodes rid (my [index node] ~)]
(poke-app our %graph-push-hook %graph-update act)
--
::
^- thread:spider
|= vase
=/ m (strand ,vase)
;< ~ bind:m start-simple
;< bol=bowl:spider bind:m get-bowl:strandio
::
:: make posts
::
;< ~ bind:m (graph-post ~zod now.bol [~zod %graph-1] 'post 10' 10)
;< ~ bind:m (sleep ~s5)
;< ~ bind:m (graph-post ~bus now.bol [~zod %graph-1] 'post 20' 20)
;< ~ bind:m (sleep ~s5)
;< ~ bind:m (graph-post ~web now.bol [~zod %graph-1] 'post 30' 30)
;< ~ bind:m (sleep ~s5)
::
;< ~ bind:m (graph-post ~zod now.bol [~bus %graph-2] 'post 40' 40)
;< ~ bind:m (sleep ~s5)
;< ~ bind:m (graph-post ~bus now.bol [~bus %graph-2] 'post 50' 50)
;< ~ bind:m (sleep ~s5)
;< ~ bind:m (graph-post ~web now.bol [~bus %graph-2] 'post 60' 60)
;< ~ bind:m (sleep ~s5)
::
;< ~ bind:m (graph-post ~zod now.bol [~web %graph-3] 'post 70' 70)
;< ~ bind:m (sleep ~s5)
;< ~ bind:m (graph-post ~bus now.bol [~web %graph-3] 'post 80' 80)
;< ~ bind:m (sleep ~s5)
;< ~ bind:m (graph-post ~web now.bol [~web %graph-3] 'post 90' 90)
;< ~ bind:m (sleep ~s5)
::
;< ~ bind:m (send-hi ~zod ~bus)
;< ~ bind:m (send-hi ~zod ~web)
;< ~ bind:m (send-hi ~bus ~zod)
;< ~ bind:m (send-hi ~bus ~web)
;< ~ bind:m (send-hi ~web ~zod)
;< ~ bind:m (send-hi ~web ~bus)
::
(pure:m *vase)

View File

@ -0,0 +1,24 @@
/- spider,
contact-view,
*resource,
group-store
/+ *ph-io, strandio
=, strand=strand:spider
::
^- thread:spider
|= vase
=/ m (strand ,vase)
;< ~ bind:m start-simple
;< bol=bowl:spider bind:m get-bowl:strandio
::
=/ join-2=contact-view-action:contact-view [%join ~zod %group-2]
=/ add-members-1=action:group-store
[%add-members [~zod %group-1] (sy ~def ~ten ~)]
=/ add-members-2=action:group-store
[%add-members [~zod %group-2] (sy ~def ~ten ~)]
;< ~ bind:m (poke-app ~bus %contact-view %contact-view-action join-2)
;< ~ bind:m (poke-app ~web %contact-view %contact-view-action join-2)
;< ~ bind:m (poke-app ~zod %group-store %group-action add-members-1)
;< ~ bind:m (poke-app ~zod %group-store %group-action add-members-2)
::
(pure:m *vase)

View File

@ -0,0 +1,61 @@
/- spider,
contact-view,
contact-store,
group-store,
metadata-store,
post,
graph-store,
*resource
/+ *ph-io, strandio
=, strand=strand:spider
::
::
^- thread:spider
|= vase
=/ m (strand ,vase)
;< ~ bind:m start-simple
;< bol=bowl:spider bind:m get-bowl:strandio
::
:: test metadata import
::
=/ change-group-1=metadata-action:metadata-store
:* %add
/ship/~zod/group-1
[%contacts /ship/~zod/group-1]
'New Group 1 Title'
'new description'
0x0
now.bol
~zod
'fake'
==
=/ change-web-book=metadata-action:metadata-store
:* %add
/ship/~web/graph-3
[%graph /ship/~web/graph-3]
'New Graph 3 Title'
'new description'
0x0
now.bol
~web
'fake'
==
;< ~ bind:m (poke-app ~zod %metadata-hook %metadata-action change-group-1)
;< ~ bind:m (sleep ~s5)
;< ~ bind:m (poke-app ~web %metadata-hook %metadata-action change-web-book)
;< ~ bind:m (sleep ~s5)
::
:: test contacts import
::
=/ add-zod=contact-action:contact-store
:* %add /ship/~zod/group-1 ~zod
'ZOD' '' '' '' '' 0x0 ~
==
=/ add-bus=contact-action:contact-store
:* %add /ship/~zod/group-2 ~bus
'BUS' '' '' '' '' 0x0 ~
==
;< ~ bind:m (poke-app ~zod %contact-hook %contact-action add-zod)
;< ~ bind:m (sleep ~s5)
;< ~ bind:m (poke-app ~bus %contact-hook %contact-action add-bus)
(pure:m *vase)

View File

@ -0,0 +1,18 @@
/- spider
/+ *ph-io, strandio
=, strand=strand:spider
::
^- thread:spider
|= vase
=/ m (strand ,vase)
;< ~ bind:m start-simple
;< bol=bowl:spider bind:m get-bowl:strandio
::
;< ~ bind:m (send-hi ~zod ~bus)
;< ~ bind:m (send-hi ~zod ~web)
;< ~ bind:m (send-hi ~bus ~zod)
;< ~ bind:m (send-hi ~bus ~web)
;< ~ bind:m (send-hi ~web ~zod)
;< ~ bind:m (send-hi ~web ~bus)
::
(pure:m *vase)

View File

@ -0,0 +1,73 @@
/- spider
/+ *ph-io
=, strand=strand:spider
=>
|%
++ start-agent
|= [=ship agent=term]
=/ m (strand:spider ,~)
^- form:m
=* loop $
;< ~ bind:m (dojo ship "|start {<agent>}")
;< ~ bind:m ::(wait-for-agent-start ship agent)
(wait-for-output ship "activated app home/{(trip agent)}")
(pure:m ~)
::
++ wait-for-agent-start
|= [=ship agent=term]
=/ m (strand:spider ,~)
^- form:m
=* loop $
;< [her=^ship =unix-effect] bind:m take-unix-effect
?: (is-dojo-output:util ship her unix-effect "activated app home/{(trip agent)}")
(pure:m ~)
loop
::
++ start-agents
|= =ship
=/ m (strand:spider ,~)
~& %starting-agents
^- form:m
;< ~ bind:m (start-agent ship %group-store)
;< ~ bind:m (start-agent ship %group-pull-hook)
;< ~ bind:m (start-agent ship %group-push-hook)
::
;< ~ bind:m (start-agent ship %metadata-store)
;< ~ bind:m (start-agent ship %metadata-hook)
::
;< ~ bind:m (start-agent ship %invite-store)
;< ~ bind:m (start-agent ship %invite-hook)
::
;< ~ bind:m (start-agent ship %chat-store)
;< ~ bind:m (start-agent ship %chat-hook)
;< ~ bind:m (start-agent ship %chat-view)
::
;< ~ bind:m (start-agent ship %contact-store)
;< ~ bind:m (start-agent ship %contact-hook)
;< ~ bind:m (start-agent ship %contact-view)
::
;< ~ bind:m (start-agent ship %graph-store)
;< ~ bind:m (start-agent ship %graph-push-hook)
;< ~ bind:m (start-agent ship %graph-pull-hook)
::
(pure:m ~)
::
--
^- thread:spider
|= arg=vase
=+ !<(who=?(~ [@p ~]) arg)
=/ m (strand ,vase)
;< ~ bind:m start-simple
::
?~ who
;< ~ bind:m (dojo ~zod "|mount %")
;< ~ bind:m (dojo ~bus "|mount %")
;< ~ bind:m (dojo ~web "|mount %")
;< ~ bind:m (start-agents ~zod)
;< ~ bind:m (start-agents ~bus)
;< ~ bind:m (start-agents ~web)
(pure:m *vase)
::
;< ~ bind:m (dojo -.who "|mount %")
;< ~ bind:m (start-agents -.who)
(pure:m *vase)

View File

@ -6,8 +6,8 @@
=/ m (strand ,vase)
;< =bowl:spider bind:m get-bowl
;< ~ bind:m start-simple
:: must be a better way to background threads
|-
=* loop $
~& >> %looping
;< ~ bind:m (sleep ~s5)
loop

View File

@ -85,18 +85,11 @@ _fore_inject(u3_auto* car_u, c3_c* pax_c)
static void
_fore_import(u3_auto* car_u, c3_c* pax_c)
{
// With apologies
u3_noun arc = u3ke_cue(u3m_file(pax_c));
u3_noun b64 = u3do("crip", u3do("en-base64:mimes:html", arc));
c3_c * b64_c = u3r_string(b64);
u3_noun imp = u3dt("cat", 3, u3i_string("#import_"), arc);
u3_noun siz = u3r_met(3, imp);
u3_noun dat = u3nt(u3_nul, siz, imp);
c3_w siz_w = strlen(b64_c) + 120;
c3_c * bod_c = (c3_c *) c3_malloc(siz_w);
snprintf(bod_c, siz_w,
"{\"source\": {\"import-all\": {\"base64-jam\": \"%s\"}}, \
\"sink\": {\"stdout\": null}}", b64_c);
u3_noun dat = u3nt(u3_nul, u3i_word(strlen(bod_c)), u3i_string(bod_c));
u3_noun req = u3nt(c3n,
u3nc(u3i_string("ipv4"), u3i_word(0x7f000001)),
u3nq(u3i_string("POST"), u3i_string("/"), u3_nul, dat));
@ -105,10 +98,6 @@ _fore_import(u3_auto* car_u, c3_c* pax_c)
u3_auto_peer(
u3_auto_plan(car_u, u3_ovum_init(0, c3__e, wir, cad)),
0, 0, _fore_import_bail);
u3z(b64);
c3_free(b64_c);
c3_free(bod_c);
}
/* _fore_io_talk():

View File

@ -1 +1 @@
0.10.9-rc1
0.10.9-main-post