From 0c6baef0d9445615a8ea5f8825897dd6a937a3ec Mon Sep 17 00:00:00 2001 From: Isaac Visintainer Date: Tue, 13 Nov 2018 10:38:56 -0800 Subject: [PATCH] initial prep subscribe, mark and app stubs --- app/collections.hoon | 206 +++++++++++++++++++++++++++++++++++-- lib/collections.hoon | 71 ++++++++++--- mar/collections/prize.hoon | 17 +++ mar/collections/rumor.hoon | 17 +++ 4 files changed, 292 insertions(+), 19 deletions(-) create mode 100644 mar/collections/prize.hoon create mode 100644 mar/collections/rumor.hoon diff --git a/app/collections.hoon b/app/collections.hoon index d282d8d82d..cf6646533a 100644 --- a/app/collections.hoon +++ b/app/collections.hoon @@ -29,7 +29,7 @@ :: stores the collection built by above by :cols so that we can compare old :: and new versions whenever the rendered data changes :: -~% %collections ..^is ~ +~% %landscape ..^is ~ |_ [bol=bowl:gall sta=state] :: :: +this: app core subject @@ -44,19 +44,29 @@ :: then update state to store the new collection data :: ++ prep - ~/ %coll-prep + ~/ %land-prep |= old=(unit state) ^- (quip move _this) ?~ old :_ this - =< ta-done - (~(ta-hall-create-circle ta ~ bol) /c 'collections') + ;: welp + =< ta-done + (~(ta-hall-create-circle ta ~ bol) /c 'collections') + :: + :~ [ost.bol %peer /circles [our.bol %hall] /circles/[(scot %p our.bol)]] + [ost.bol %peer /inbox [our.bol %hall] /circle/inbox/config/grams] + [ost.bol %peer /invites [our.bol %hall] /circle/i/grams] + == + == ?- -.u.old %0 =/ mow=(list move) =< ta-done (~(ta-update ta ~ bol) col.u.old cols) - [mow this(sta [%0 cols])] + :- mow + %= this + sta [%0 cols str.u.old] + == == :: :: +mack: @@ -64,7 +74,6 @@ :: recieve acknowledgement for permissions changes, print error if it failed :: ++ mack - ~/ %coll-mack |= [wir=wire err=(unit tang)] ^- (quip move _this) ?~ err @@ -74,7 +83,6 @@ :: +coup: recieve acknowledgement for poke, print error if it failed :: ++ coup - ~/ %coll-coup |= [wir=wire err=(unit tang)] ^- (quip move _this) ?~ err @@ -116,4 +124,188 @@ =< ta-done (~(ta-write ta ~ bol) /web/landscape/onboard/json [%json !>(jon)]) [~ this] +:: +:: +:: +:: +:: +++ peer + |= wir=wire + ^- (quip move _this) + [~ this] +:: +:: +reap: recieve acknowledgement for peer, retry on failure +:: +++ reap + |= [wir=wire err=(unit tang)] + ^- (quip move _this) + ?~ err + [~ this] + ?~ wir + (mean [leaf+"invalid wire for diff: {(spud wir)}"]~) + ?+ i.wir + (mean [leaf+"invalid wire for diff: {(spud wir)}"]~) + :: + %circles + :_ this + [ost.bol %peer /circles [our.bol %hall] /circles/[(scot %p our.bol)]]~ + :: + %inbox + :_ this + [ost.bol %peer /inbox [our.bol %hall] /circle/inbox/config/grams]~ + :: + %invites + :_ this + [ost.bol %peer /invites [our.bol %hall] /circle/i/grams]~ + :: + %our + [~ this] + :: + %sub + [~ this] + == + +:: :~ [ost.bol %peer /circles [our.bol %hall] /circles/[(scot %p our.bol)]] +:: [ost.bol %peer /inbox [our.bol %hall] /circle/inbox/config/grams] +:: [ost.bol %peer /invites [our.bol %hall] /circle/i/grams] +:: == + + +:: +:: +quit: +:: +++ quit + |= [wir=wire err=(unit tang)] + ^- (quip move _this) + ?~ err + [~ this] + ?~ wir + (mean [leaf+"invalid wire for diff: {(spud wir)}"]~) + ?+ i.wir + (mean [leaf+"invalid wire for diff: {(spud wir)}"]~) + :: + %circles + :_ this + [ost.bol %peer /circles [our.bol %hall] /circles/[(scot %p our.bol)]]~ + :: + %inbox + :_ this + [ost.bol %peer /inbox [our.bol %hall] /circle/inbox/config/grams]~ + :: + %invites + :_ this + [ost.bol %peer /invites [our.bol %hall] /circle/i/grams]~ + :: + %our + [~ this] + :: + %sub + [~ this] + == +:: +:: +diff-hall-prize: +:: +:: +:: +++ diff-hall-prize + |= [wir=wire piz=prize:hall] + ^- (quip move _this) + ?~ wir + (mean [leaf+"invalid wire for diff: {(spud wir)}"]~) + ?+ i.wir + (mean [leaf+"invalid wire for diff: {(spud wir)}"]~) + :: + :: %circles: subscribe to the configuration of each of our circles + :: + %circles + ?> ?=(%circles -.piz) + =/ circs=(set name:hall) (~(dif in cis.piz) (sy ~[%inbox %i %public])) + :: + :_ this + ^- (list move) + %+ turn ~(tap in circs) + |= circ=name:hall + ^- move + [ost.bol %peer /our/[circ] [our.bol %hall] /circle/[circ]/config] + :: + :: %inbox: + :: + %inbox + [~ this] + :: + :: %invites + :: + %invites + [~ this] + :: + %our + [~ this] + :: + %sub + [~ this] + == + +:: :~ [ost.bol %peer /circles [our.bol %hall] /circles/[(scot %p our.bol)]] +:: [ost.bol %peer /inbox [our.bol %hall] /circle/inbox/config/grams] +:: [ost.bol %peer /invites [our.bol %hall] /circle/i/grams] +:: == + +:: +:: +diff-hall-rumor +:: +:: +:: +++ diff-hall-rumor + |= [wir=wire rum=rumor:hall] + ^- (quip move _this) + ?~ wir + (mean [leaf+"invalid wire for diff: {(spud wir)}"]~) + ?+ i.wir + (mean [leaf+"invalid wire for diff: {(spud wir)}"]~) + :: + %circles + [~ this] + :: + %inbox + [~ this] + :: + %invites + [~ this] + :: + %our + [~ this] + :: + %sub + [~ this] + == -- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/collections.hoon b/lib/collections.hoon index d3e703b259..e0b8fafe0e 100644 --- a/lib/collections.hoon +++ b/lib/collections.hoon @@ -8,35 +8,81 @@ :: ~% %collections-lib ..is ~ |% -+= move [bone card] -+= card ++$ move [bone card] +:: ++$ card $% [%info wire toro:clay] [%poke wire dock poke] [%perm wire desk path rite:clay] + [%peer wire dock path] + [%pull wire dock ~] == -+= poke +:: ++$ poke $% [%hall-action action:hall] [%collections-action action] [%json json] == -+= state - $% [%0 col=collection] +:: ++$ state + $% [%0 col=collection str=streams] == :: ++$ streams + $: :: inbox config and the last 30 messages in it + :: + inbox=[con=config env=(list envelope:hall)] + :: names and configs of all circles we own + :: + our-circles=(map name:hall config:hall) + :: names and configs of all circles we're subscribed to + :: + sub-circles=(map circle:hall config:hall) + :: all the DM invites we've received + :: + invites=(list envelope:hall) + == :: -+= collection [meta=config data=(map nom=knot =item)] -+= item ++$ prize + $: :: inbox config and the last 30 messages in it + :: + inbox=[con=config env=(list envelope:hall)] + :: names and configs of all circles we own + :: + our-circles=(map name:hall config:hall) + :: names and configs of all circles we're subscribed to + :: + sub-circles=(map circle:hall config:hall) + :: all the DM invites we've received + :: + invites=(list envelope:hall) + == +:: ++$ rumor + $% :: if config is given, either add new circle or update existing one + :: if config is nil then delete circle + :: + [%circle-change circle:hall config:hall] + :: recieved a new inbox message or DM invite + :: + [%new-msg ?(%inbox %invites) envelope:hall] + == +:: ++$ collection [meta=config data=(map nom=knot =item)] +:: ++$ item $~ [%error ~] $% [%collection col=collection] [%raw raw=raw-item] [%both col=collection raw=raw-item] [%error ~] == -+= raw-item +:: ++$ raw-item $% [%udon meta=(map knot cord) data=@t] == :: -+= config ++$ config $: full-path=beam name=@t description=@t @@ -53,12 +99,13 @@ :: == :: -+= action ++$ action $: who=ship dek=desk acts=(list sub-action) == -+= sub-action +:: ++$ sub-action $% [%write pax=path for=form] [%delete pax=path] [%perms pax=path r=rule:clay w=rule:clay] @@ -68,7 +115,7 @@ [%comment pax=path content=@t] == :: -+= form ++$ form $% [%udon @t] [%collections-config config] == diff --git a/mar/collections/prize.hoon b/mar/collections/prize.hoon new file mode 100644 index 0000000000..00ba874491 --- /dev/null +++ b/mar/collections/prize.hoon @@ -0,0 +1,17 @@ +:: +:: +/? 309 +:: +/+ collections, hall-json +:: +|_ piz=prize:collections +++ grow + |% + ++ json ~ + -- +:: +++ grab + |% + ++ noun prize:collections + -- +-- diff --git a/mar/collections/rumor.hoon b/mar/collections/rumor.hoon new file mode 100644 index 0000000000..60b8c2af1b --- /dev/null +++ b/mar/collections/rumor.hoon @@ -0,0 +1,17 @@ +:: +:: +/? 309 +:: +/+ collections, hall-json +:: +|_ rum=rumor:collections +++ grow + |% + ++ json ~ + -- +:: +++ grab + |% + ++ noun rumor:collections + -- +--