mirror of
https://github.com/urbit/shrub.git
synced 2024-12-28 22:54:15 +03:00
userspace: data migration testing utilities
This commit is contained in:
parent
41074e3742
commit
f5137a5114
45
pkg/arvo/gen/aqua-export.hoon
Normal file
45
pkg/arvo/gen/aqua-export.hoon
Normal 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)]
|
||||
::
|
||||
--
|
@ -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))
|
||||
--
|
||||
|
@ -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)
|
||||
|
12
pkg/arvo/mar/contact/view-action.hoon
Normal file
12
pkg/arvo/mar/contact/view-action.hoon
Normal 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
15
pkg/arvo/mar/import.hoon
Normal 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
|
||||
--
|
12
pkg/arvo/mar/metadata/hook-action.hoon
Normal file
12
pkg/arvo/mar/metadata/hook-action.hoon
Normal file
@ -0,0 +1,12 @@
|
||||
/- *metadata-hook
|
||||
|_ act=metadata-hook-action
|
||||
++ grad %noun
|
||||
++ grow
|
||||
|%
|
||||
++ noun act
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
++ noun metadata-hook-action
|
||||
--
|
||||
--
|
22
pkg/arvo/ted/ph/migrate/breach.hoon
Normal file
22
pkg/arvo/ted/ph/migrate/breach.hoon
Normal 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)
|
61
pkg/arvo/ted/ph/migrate/commit-home.hoon
Normal file
61
pkg/arvo/ted/ph/migrate/commit-home.hoon
Normal 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)
|
22
pkg/arvo/ted/ph/migrate/import.hoon
Normal file
22
pkg/arvo/ted/ph/migrate/import.hoon
Normal 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)
|
24
pkg/arvo/ted/ph/migrate/init.hoon
Normal file
24
pkg/arvo/ted/ph/migrate/init.hoon
Normal 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)
|
96
pkg/arvo/ted/ph/migrate/make-chats.hoon
Normal file
96
pkg/arvo/ted/ph/migrate/make-chats.hoon
Normal 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)
|
112
pkg/arvo/ted/ph/migrate/make-graphs.hoon
Normal file
112
pkg/arvo/ted/ph/migrate/make-graphs.hoon
Normal 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)
|
46
pkg/arvo/ted/ph/migrate/make-groups.hoon
Normal file
46
pkg/arvo/ted/ph/migrate/make-groups.hoon
Normal 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)
|
36
pkg/arvo/ted/ph/migrate/post-import-chat.hoon
Normal file
36
pkg/arvo/ted/ph/migrate/post-import-chat.hoon
Normal 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)
|
56
pkg/arvo/ted/ph/migrate/post-import-graphs.hoon
Normal file
56
pkg/arvo/ted/ph/migrate/post-import-graphs.hoon
Normal 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)
|
24
pkg/arvo/ted/ph/migrate/post-import-groups.hoon
Normal file
24
pkg/arvo/ted/ph/migrate/post-import-groups.hoon
Normal 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)
|
61
pkg/arvo/ted/ph/migrate/post-import-metadata-contacts.hoon
Normal file
61
pkg/arvo/ted/ph/migrate/post-import-metadata-contacts.hoon
Normal 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)
|
18
pkg/arvo/ted/ph/migrate/send-his.hoon
Normal file
18
pkg/arvo/ted/ph/migrate/send-his.hoon
Normal 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)
|
73
pkg/arvo/ted/ph/migrate/start.hoon
Normal file
73
pkg/arvo/ted/ph/migrate/start.hoon
Normal 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)
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user