graph-store: bump update mark

This commit is contained in:
Liam Fitzgerald 2021-09-28 09:43:36 +10:00
parent ba353fbd36
commit cf5f444458
37 changed files with 155 additions and 55 deletions

View File

@ -169,7 +169,7 @@
::
%fact
?+ p.cage.sign ~|([dap.bowl %bad-sub-mark wire p.cage.sign] !!)
%graph-update-2
%graph-update-3
%- on-graph-update:tc
!<(update:graph q.cage.sign)
==
@ -763,7 +763,7 @@
::TODO move creation into lib?
%^ act %out-message
%graph-push-hook
:- %graph-update-2
:- %graph-update-3
!> ^- update:graph
:- now.bowl
:+ %add-nodes audience

View File

@ -154,7 +154,7 @@
++ poke-graph-store
|= =update:graph-store
^- card
(poke-our %graph-store %graph-update-2 !>(update))
(poke-our %graph-store %graph-update-3 !>(update))
::
++ nobody
^- @p

View File

@ -134,7 +134,7 @@
==
[cards this]
::
%graph-update-2
%graph-update-3
=+ !<(=update:store vase)
?+ -.q.update !!
%add-nodes

View File

@ -9,7 +9,7 @@
update:store
%graph-update
%graph-push-hook
2 2
3 3
%.n
==
--
@ -41,7 +41,7 @@
%- (slog leaf+"nacked {<resource>}" tang)
:_ this
?. (~(has in get-keys:gra) resource) ~
=- [%pass /pull-nack %agent [our.bowl %graph-store] %poke %graph-update-2 -]~
=- [%pass /pull-nack %agent [our.bowl %graph-store] %poke %graph-update-3 -]~
!> ^- update:store
[now.bowl [%archive-graph resource]]
::

View File

@ -12,7 +12,7 @@
update:store
%graph-update
%graph-pull-hook
2 2
3 3
==
::
+$ agent (push-hook:push-hook config)

View File

@ -16,6 +16,7 @@
+$ state-5 [%5 network:store]
++ orm orm:store
++ orm-log orm-log:store
++ mar %graph-update-3
--
::
=| state-5
@ -100,7 +101,7 @@
++ give
|= =action:store
^- (list card)
[%give %fact ~ [%graph-update-2 !>(`update:store`[now.bowl action])]]~
[%give %fact ~ [mar !>(`update:store`[now.bowl action])]]~
--
::
++ on-poke
@ -111,7 +112,7 @@
?> (team:title our.bowl src.bowl)
=^ cards state
?+ mark (on-poke:def mark vase)
%graph-update-2 (graph-update !<(update:store vase))
%graph-update-3 (graph-update !<(update:store vase))
%import (poke-import q.vase)
==
[cards this]
@ -570,7 +571,7 @@
++ give
|= [paths=(list path) update=action:store]
^- (list card)
[%give %fact paths [%graph-update-2 !>(`update:store`[now.bowl update])]]~
[%give %fact paths [mar !>(`update:store`[now.bowl update])]]~
--
::
++ validate-graph
@ -619,11 +620,11 @@
[%x %export ~] ``noun+!>(state)
::
[%x %keys ~]
:- ~ :- ~ :- %graph-update-2
:- ~ :- ~ :- mar
!>(`update:store`[now.bowl [%keys ~(key by graphs)]])
::
[%x %tag-queries *]
:- ~ :- ~ :- %graph-update-2
:- ~ :- ~ :- mar
!> ^- update:store
:- now.bowl
?+ t.t.path (on-peek:def path)
@ -639,7 +640,7 @@
?~ marked-graph [~ ~]
=* graph p.u.marked-graph
=* mark q.u.marked-graph
:- ~ :- ~ :- %graph-update-2
:- ~ :- ~ :- mar
!>(`update:store`[now.bowl [%add-graph [ship term] graph mark %.y]])
::
[%x %update-log @ @ *]
@ -679,7 +680,7 @@
=* mark q.u.marked-graph
?+ t.t.t.t.path (on-peek:def path)
~
:- ~ :- ~ :- %graph-update-2
:- ~ :- ~ :- mar
!>(`update:store`[now.bowl [%add-graph [ship term] graph mark %.y]])
::
[%mark ~]
@ -688,7 +689,7 @@
[%subset ?(%lone %kith) @ @ ~]
=/ start=(unit atom) (rush i.t.t.t.t.t.t.path dem:ag)
=/ end=(unit atom) (rush i.t.t.t.t.t.t.t.path dem:ag)
:- ~ :- ~ :- %graph-update-2
:- ~ :- ~ :- mar
!> ^- update:store
:^ now.bowl %add-nodes [ship term]
%- ~(gas by *(map index:store node:store))
@ -715,7 +716,7 @@
(turn t.t.pax (cury slav %ud))
=/ node (get-node graph index)
?~ node [~ ~]
:- ~ :- ~ :- %graph-update-2
:- ~ :- ~ :- mar
!> ^- update:store
:^ now.bowl %add-nodes [ship term]
%- ~(gas by *(map index:store node:store))
@ -739,7 +740,7 @@
?: ?=(%empty -.children.u.node)
~
p.children.u.node
:- ~ :- ~ :- %graph-update-2
:- ~ :- ~ :- mar
!> ^- update:store
:^ now.bowl %add-nodes [ship term]
%- ~(gas by *(map index:store node:store))
@ -763,7 +764,7 @@
?: ?=(%empty -.children.u.node)
~
p.children.u.node
:- ~ :- ~ :- %graph-update-2
:- ~ :- ~ :- mar
!> ^- update:store
:^ now.bowl %add-nodes [ship term]
%- ~(gas by *(map index:store node:store))
@ -825,7 +826,7 @@
|= [=node:store =index:store =(map index:store node:store)]
^- (unit (unit cage))
?: ?=(%empty -.children.node)
:- ~ :- ~ :- %graph-update-2
:- ~ :- ~ :- mar
!>(`update:store`[now.bowl [%add-nodes [ship term] map]])
=/ item=[k=atom v=node:store]
(need (ram:orm p.children.node))
@ -858,7 +859,7 @@
=/ start=(unit atom) (rush i.t.t.t.t.t.path dem:ag)
?: ?=(~ count)
[~ ~]
:- ~ :- ~ :- %graph-update-2
:- ~ :- ~ :- mar
!> ^- update:store
:^ now.bowl %add-nodes [ship term]
=* a u.count

View File

@ -228,7 +228,7 @@
~[watch-graph:ha]
::
%fact
?. ?=(%graph-update-2 p.cage.sign)
?. ?=(%graph-update-3 p.cage.sign)
(on-agent:def wire sign)
=^ cards state
(graph-update !<(update:graph-store q.cage.sign))

View File

@ -13,7 +13,7 @@
contents.post contents
==
::
:- %graph-update-2
:- %graph-update-3
^- update
:- now
:+ %add-nodes [our %dm-inbox]

View File

@ -5,6 +5,6 @@
|= $: [now=@da eny=@uvJ =beak]
[[=resource mark=(unit mark) overwrite=? ~] ~]
==
:- %graph-update-2
:- %graph-update-3
^- update
[now [%add-graph resource (gas:orm ~ ~) mark overwrite]]

View File

@ -12,7 +12,7 @@
contents.post contents
==
::
:- %graph-update-2
:- %graph-update-3
^- update
:- now
:+ %add-nodes [our name]

View File

@ -5,6 +5,6 @@
|= $: [now=@da eny=@uvJ =beak]
[[[=resource =index] =signatures ~] ~]
==
:- %graph-update-2
:- %graph-update-3
^- update
[now [%add-signatures [resource index] signatures]]

View File

@ -5,6 +5,6 @@
|= $: [now=@da eny=@uvJ =beak]
[[=term =uid ~] ~]
==
:- %graph-update-2
:- %graph-update-3
^- update
[now [%add-tag term uid]]

View File

@ -5,6 +5,6 @@
|= $: [now=@da eny=@uvJ =beak]
[[=resource ~] ~]
==
:- %graph-update-2
:- %graph-update-3
^- update
[now [%archive-graph resource]]

View File

@ -4,7 +4,7 @@
|= $: [now=@da eny=@uvJ bec=beak]
[[=ship graph=term ~] ~]
==
:- %graph-update-2
:- %graph-update-3
=/ our (scot %p p.bec)
=/ wen (scot %da now)
=/ who (scot %p ship)

View File

@ -4,6 +4,6 @@
|= $: [now=@da eny=@uvJ bec=beak]
[[graph=term =path ~] ~]
==
:- %graph-update-2
:- %graph-update-3
=- ~& update=- -
.^(=update:graph-store %cx path)

View File

@ -5,6 +5,6 @@
|= $: [now=@da eny=@uvJ =beak]
[[=resource ~] ~]
==
:- %graph-update-2
:- %graph-update-3
^- update
[now [%remove-graph resource]]

View File

@ -5,6 +5,6 @@
|= $: [now=@da eny=@uvJ =beak]
[[=resource indices=(set index) ~] ~]
==
:- %graph-update-2
:- %graph-update-3
^- update
[now [%remove-posts resource indices]]

View File

@ -6,6 +6,6 @@
|= $: [now=@da eny=@uvJ =beak]
[[[=resource =index] =signatures ~] ~]
==
:- %graph-update-2
:- %graph-update-3
^- update
[now [%remove-signatures [resource index] signatures]]

View File

@ -5,6 +5,6 @@
|= $: [now=@da eny=@uvJ =beak]
[[=term =uid ~] ~]
==
:- %graph-update-2
:- %graph-update-3
^- update
[now [%remove-tag term uid]]

View File

@ -5,6 +5,6 @@
|= $: [now=@da eny=@uvJ =beak]
[[=resource ~] ~]
==
:- %graph-update-2
:- %graph-update-3
^- update
[now [%unarchive-graph resource]]

View File

@ -67,7 +67,7 @@
=/ real=(set resource:re)
=/ upd=update:ga
%+ scry update:ga
[%x %graph-store /keys/graph-update-2]
[%x %graph-store /keys/graph-update-3]
?> ?=(%keys -.q.upd)
resources.q.upd
:: count activity per channel

View File

@ -6,7 +6,7 @@
++ update
|= =update:store
^- cage
[%graph-update-2 !>(update)]
[%graph-update-3 !>(update)]
--
::
++ scry-for

View File

@ -1,19 +1,15 @@
/+ *graph-store
=* as-octs as-octs:mimes:html
::
|_ upd=update
|_ =update:two
++ grad %noun
++ grow
|%
++ noun upd
++ json (update:enjs upd)
++ mime [/application/x-urb-graph-update (as-octs (jam upd))]
++ noun update
--
::
++ grab
|%
++ noun update
++ json update:dejs
++ mime |=([* =octs] ;;(update (cue q.octs)))
++ noun update:two
--
--

View File

@ -0,0 +1,19 @@
/+ *graph-store
=* as-octs as-octs:mimes:html
::
|_ upd=update
++ grad %noun
++ grow
|%
++ noun upd
++ json (update:enjs upd)
++ mime [/application/x-urb-graph-update (as-octs (jam upd))]
--
::
++ grab
|%
++ noun update
++ json update:dejs
++ mime |=([* =octs] ;;(update (cue q.octs)))
--
--

View File

@ -69,9 +69,76 @@
+$ permission-level
?(%no %self %yes)
::
:: %graph-store types version 2
::
++ two
=< [. post-one]
=, post-one
|%
++ orm ((on atom node) gth)
++ orm-log ((on time logged-update) gth)
::
+$ graph ((mop atom node) gth)
+$ marked-graph [p=graph q=(unit mark)]
::
+$ node [=post children=internal-graph]
+$ graphs (map resource marked-graph)
::
+$ tag-queries (jug term resource)
::
+$ update-log ((mop time logged-update) gth)
+$ update-logs (map resource update-log)
::
+$ internal-graph
$~ [%empty ~]
$% [%graph p=graph]
[%empty ~]
==
::
+$ network
$: =graphs
=tag-queries
=update-logs
archive=graphs
validators=(set mark)
==
::
+$ update [p=time q=action]
::
+$ logged-update [p=time q=logged-action]
::
+$ logged-action
$% [%add-graph =resource =graph mark=(unit mark) overwrite=?]
[%add-nodes =resource nodes=(map index node)]
[%remove-nodes =resource indices=(set index)]
[%add-signatures =uid =signatures]
[%remove-signatures =uid =signatures]
==
::
+$ action
$% logged-action
[%remove-graph =resource]
::
[%add-tag =term =resource]
[%remove-tag =term =resource]
::
[%archive-graph =resource]
[%unarchive-graph =resource]
[%run-updates =resource =update-log]
::
:: NOTE: cannot be sent as pokes
::
[%keys =resources]
[%tags tags=(set term)]
[%tag-queries =tag-queries]
==
--
::
:: %graph-store types version 1
::
++ one
++ one
=< [. post-one]
=, post-one
|%
++ orm ((on atom node) gth)
++ orm-log ((on time logged-update) gth)

View File

@ -40,6 +40,23 @@
[%reference =reference]
==
::
++ post-one
|%
::
+$ content
$% [%text text=cord]
[%mention =ship]
[%url url=cord]
[%code expression=cord output=(list tank)]
[%reference =reference]
==
::
+$ reference
$% [%graph group=resource =uid]
[%group group=resource]
==
--
::
++ post-zero
|%
::

View File

@ -32,7 +32,7 @@
=/ hashes (nodes-to-pending-indices nodes.q.update)
;< ~ bind:m
%^ poke-our %graph-push-hook
%graph-update-2
%graph-update-3
!> ^- update:store
update
(pure:m !>(`action:graph-view`[%pending-indices hashes]))

View File

@ -39,7 +39,7 @@
==
;< ~ bind:m
%+ poke-our %graph-store
:- %graph-update-2
:- %graph-update-3
!> ^- update:graph
[now.bowl %add-graph feed-rid *graph:graph `%graph-validator-post %&]
;< ~ bind:m

View File

@ -54,7 +54,7 @@
=/ =update:graph
[now.bowl %add-graph rid.action *graph:graph mark.action overwrite]
;< ~ bind:m
(poke-our %graph-store graph-update-2+!>(update))
(poke-our %graph-store graph-update-3+!>(update))
;< ~ bind:m
(poke-our %graph-push-hook %push-hook-action !>([%add rid.action]))
::

View File

@ -36,7 +36,7 @@
^- form:m
;< =bowl:spider bind:m get-bowl:strandio
;< ~ bind:m
(poke-our %graph-store %graph-update-2 !>([now.bowl %remove-graph rid]))
(poke-our %graph-store %graph-update-3 !>([now.bowl %remove-graph rid]))
;< ~ bind:m
(poke-our %graph-push-hook %push-hook-action !>([%remove rid]))
;< ~ bind:m

View File

@ -40,7 +40,7 @@
?: ?=([~ ^] feed.config.metadatum)
;< ~ bind:m
%+ poke-our %graph-store
:- %graph-update-2
:- %graph-update-3
!> ^- update:graph
[now.bowl [%archive-graph resource.u.u.feed.config.metadatum]]
(pure:m !>(~))

View File

@ -31,7 +31,7 @@
;< ~ bind:m
(raw-poke-our %graph-pull-hook %pull-hook-action !>([%remove rid]))
;< ~ bind:m
(raw-poke-our %graph-store %graph-update-2 !>([now [%remove-graph rid]]))
(raw-poke-our %graph-store %graph-update-3 !>([now [%remove-graph rid]]))
(pure:m ~)
--
::

View File

@ -17,7 +17,7 @@
;< =bowl:spider bind:m get-bowl:strandio
:: unarchive graph and share it
;< ~ bind:m
(poke-our %graph-store %graph-update-2 !>([now.bowl %unarchive-graph rid]))
(poke-our %graph-store %graph-update-3 !>([now.bowl %unarchive-graph rid]))
;< ~ bind:m
(poke-our %graph-push-hook %push-hook-action !>([%add rid]))
::

View File

@ -70,7 +70,7 @@
;< ~ bind:m
%+ raw-poke
[our.bowl %graph-store]
:- %graph-update-2
:- %graph-update-3
!> ^- update:gra
[now.bowl [%archive-graph app-resource]]
;< ~ bind:m

View File

@ -14,7 +14,7 @@
=/ =post:post [our index wen [%text body]~ ~ ~]
=/ =node:graph-store [[%& post] %empty ~]
=/ act=update:graph-store [wen %add-nodes rid (my [index node] ~)]
(poke-app our %graph-push-hook %graph-update-2 act)
(poke-app our %graph-push-hook %graph-update-3 act)
--
::
^- thread:spider

View File

@ -14,7 +14,7 @@
=/ =post:post [our index wen [%text body]~ ~ ~]
=/ =node:graph-store [[%& post] %empty ~]
=/ act=update:graph-store [wen %add-nodes rid (my [index node] ~)]
(poke-app our %graph-push-hook %graph-update-2 act)
(poke-app our %graph-push-hook %graph-update-3 act)
--
::
^- thread:spider

View File

@ -5,7 +5,7 @@ import { Enc, Path, Patp, PatpNoSig, Poke, Thread } from '../lib/types';
import { Content, GraphChildrenPoke, GraphNode, GraphNodePoke, Post } from './types';
import { patp2dec } from 'urbit-ob';
export const GRAPH_UPDATE_VERSION = 2;
export const GRAPH_UPDATE_VERSION = 3;
export const createBlankNodeWithChildPost = (
ship: PatpNoSig,