graph-store/push-hook: remove old mark warming, organize

This commit is contained in:
Logan Allen 2021-04-26 13:28:13 -05:00
parent f44236b7a2
commit 79fe01a434
4 changed files with 45 additions and 62 deletions

View File

@ -19,9 +19,12 @@
:: ::
+$ state-null ~ +$ state-null ~
+$ state-zero [%0 marks=(set mark)] +$ state-zero [%0 marks=(set mark)]
+$ state-one [%1 ~]
+$ versioned-state +$ versioned-state
$@ state-null $@ state-null
state-zero $% state-zero
state-one
==
-- --
:: ::
%- agent:dbug %- agent:dbug
@ -30,13 +33,14 @@
%- (agent:push-hook config) %- (agent:push-hook config)
^- agent ^- agent
=- =-
=| state-zero =| state-one
=* state - =* state -
|_ =bowl:gall |_ =bowl:gall
+* this . +* this .
def ~(. (default-agent this %|) bowl) def ~(. (default-agent this %|) bowl)
grp ~(. group bowl) grp ~(. group bowl)
gra ~(. graph bowl) gra ~(. graph bowl)
met ~(. mdl bowl)
hc ~(. hook-core bowl) hc ~(. hook-core bowl)
:: ::
++ on-init on-init:def ++ on-init on-init:def
@ -46,7 +50,9 @@
=+ !<(old=versioned-state vase) =+ !<(old=versioned-state vase)
=? old ?=(~ old) =? old ?=(~ old)
[%0 ~] [%0 ~]
?> ?=(%0 -.old) =? old ?=(%0 -.old)
[%1 ~]
?> ?=(%1 -.old)
`this(state old) `this(state old)
:: ::
++ on-poke on-poke:def ++ on-poke on-poke:def
@ -58,17 +64,10 @@
|= [=wire =sign-arvo] |= [=wire =sign-arvo]
^- (quip card _this) ^- (quip card _this)
?+ wire (on-arvo:def wire sign-arvo) ?+ wire (on-arvo:def wire sign-arvo)
:: XX: no longer necessary
:: ::
[%perms @ @ ~] [%perms @ @ ~] [~ this]
?> ?=(?(%add %remove) i.t.t.wire) [%transform-add @ ~] [~ this]
=* mark i.t.wire
:_ this
(build-permissions:hc mark i.t.t.wire %next)^~
::
[%transform-add @ ~]
=* mark i.t.wire
:_ this
(build-transform-add:hc mark %next)^~
== ==
:: ::
++ on-fail on-fail:def ++ on-fail on-fail:def
@ -175,7 +174,8 @@
++ initial-watch ++ initial-watch
|= [=path =resource:res] |= [=path =resource:res]
^- vase ^- vase
?> (is-allowed:hc resource) |^
?> (is-allowed resource)
!> ^- update:store !> ^- update:store
?~ path ?~ path
:: new subscribe :: new subscribe
@ -188,22 +188,19 @@
=/ =time (slav %da i.path) =/ =time (slav %da i.path)
=/ =update-log:store (get-update-log-subset:gra resource time) =/ =update-log:store (get-update-log-subset:gra resource time)
[now.bowl [%run-updates resource update-log]] [now.bowl [%run-updates resource update-log]]
::
++ is-allowed
|= =resource:res
=/ group-res=resource:res
(need (peek-group:met %graph resource))
(is-member:grp src.bowl group-res)
--
:: ::
++ take-update ++ take-update
|= =vase |= =vase
^- [(list card) agent] ^- [(list card) agent]
=/ =update:store !<(update:store vase) =/ =update:store !<(update:store vase)
?+ -.q.update [~ this] ?+ -.q.update [~ this]
%add-graph
?~ mark.q.update `this
=* mark u.mark.q.update
?: (~(has in marks) mark) `this
:_ this(marks (~(put in marks) mark))
:~ (build-permissions:hc mark %add %sing)
(build-permissions:hc mark %remove %sing)
(build-transform-add:hc mark %sing)
==
::
%remove-graph %remove-graph
:_ this :_ this
[%give %kick ~[resource+(en-path:res resource.q.update)] ~]~ [%give %kick ~[resource+(en-path:res resource.q.update)] ~]~
@ -213,6 +210,7 @@
[%give %kick ~[resource+(en-path:res resource.q.update)] ~]~ [%give %kick ~[resource+(en-path:res resource.q.update)] ~]~
== ==
-- --
::
^| ^= hook-core ^| ^= hook-core
|_ =bowl:gall |_ =bowl:gall
+* grp ~(. group bowl) +* grp ~(. group bowl)
@ -225,28 +223,22 @@
/[care]/(scot %p our.bowl)/[desk]/(scot %da now.bowl) /[care]/(scot %p our.bowl)/[desk]/(scot %da now.bowl)
path path
:: ::
++ perm-mark-name
|= perm=@t
^- @t
(cat 3 'graph-permissions-' perm)
::
++ perm-mark ++ perm-mark
|= [=resource:res perm=@t vip=vip-metadata:metadata =indexed-post:store] |= [=resource:res perm=@t vip=vip-metadata:metadata =indexed-post:store]
^- permissions:store ^- permissions:store
|^
=- (check vip) =- (check vip)
!< check=$-(vip-metadata:metadata permissions:store) !< check=$-(vip-metadata:metadata permissions:store)
%. !>(indexed-post) %. !>(indexed-post)
=/ mark (get-mark:gra resource) =/ mark (get-mark:gra resource)
?~ mark |=(=vase !>([%no %no %no])) ?~ mark |=(=vase !>([%no %no %no]))
.^(tube:clay (scry %cc %home /[u.mark]/(perm-mark-name perm))) .^(tube:clay (scry %cc %home /[u.mark]/(perm-mark-name perm)))
:: ::
++ add-mark ++ perm-mark-name
|= [=resource:res vip=vip-metadata:metadata =indexed-post:store] |= perm=@t
(perm-mark resource %add vip indexed-post) ^- @t
:: (cat 3 'graph-permissions-' perm)
++ remove-mark --
|= [=resource:res vip=vip-metadata:metadata =indexed-post:store]
(perm-mark resource %remove vip indexed-post)
:: ::
++ get-permission ++ get-permission
|= [=permissions:store is-admin=? writers=(set ship)] |= [=permissions:store is-admin=? writers=(set ship)]
@ -259,12 +251,6 @@
writer.permissions writer.permissions
reader.permissions reader.permissions
:: ::
++ is-allowed
|= =resource:res
=/ group-res=resource:res
(need (peek-group:met %graph resource))
(is-member:grp src.bowl group-res)
::
++ get-roles-writers-variation ++ get-roles-writers-variation
|= =resource:res |= =resource:res
^- (unit [is-admin=? writers=(set ship) vip=vip-metadata:metadata]) ^- (unit [is-admin=? writers=(set ship) vip=vip-metadata:metadata])
@ -290,6 +276,7 @@
++ is-allowed-add ++ is-allowed-add
|= [=resource:res nodes=(map index:store node:store)] |= [=resource:res nodes=(map index:store node:store)]
^- ? ^- ?
|^
%- (bond |.(%.n)) %- (bond |.(%.n))
%+ biff (get-roles-writers-variation resource) %+ biff (get-roles-writers-variation resource)
|= [is-admin=? writers=(set ship) vip=vip-metadata:metadata] |= [is-admin=? writers=(set ship) vip=vip-metadata:metadata]
@ -320,10 +307,16 @@
%.n %.n
=(author.p.post.parent-node src.bowl) =(author.p.post.parent-node src.bowl)
== ==
::
++ add-mark
|= [=resource:res vip=vip-metadata:metadata =indexed-post:store]
(perm-mark resource %add vip indexed-post)
--
:: ::
++ is-allowed-remove ++ is-allowed-remove
|= [=resource:res indices=(set index:store)] |= [=resource:res indices=(set index:store)]
^- ? ^- ?
|^
%- (bond |.(%.n)) %- (bond |.(%.n))
%+ biff (get-roles-writers-variation resource) %+ biff (get-roles-writers-variation resource)
|= [is-admin=? writers=(set ship) vip=vip-metadata:metadata] |= [is-admin=? writers=(set ship) vip=vip-metadata:metadata]
@ -344,21 +337,10 @@
%no %.n %no %.n
%self =(author.p.post.node src.bowl) %self =(author.p.post.node src.bowl)
== ==
:: ::
++ build-permissions ++ remove-mark
|= [=mark kind=?(%add %remove) mode=?(%sing %next)] |= [=resource:res vip=vip-metadata:metadata =indexed-post:store]
^- card (perm-mark resource %remove vip indexed-post)
=/ =wire /perms/[mark]/[kind] --
=/ =mood:clay [%c da+now.bowl /[mark]/(perm-mark-name kind)]
=/ =rave:clay ?:(?=(%sing mode) [mode mood] [mode mood])
[%pass wire %arvo %c %warp our.bowl %home `rave]
::
++ build-transform-add
|= [=mark mode=?(%sing %next)]
^- card
=/ =wire /transform-add/[mark]
=/ =mood:clay [%c da+now.bowl /[mark]/transform-add-nodes]
=/ =rave:clay ?:(?=(%sing mode) [mode mood] [mode mood])
[%pass wire %arvo %c %warp our.bowl %home `rave]
-- --

View File

@ -84,6 +84,7 @@
graphs.old (~(run by graphs.old) marked-graph-to-two:upg) graphs.old (~(run by graphs.old) marked-graph-to-two:upg)
archive.old (~(run by archive.old) marked-graph-to-two:upg) archive.old (~(run by archive.old) marked-graph-to-two:upg)
tag-queries.old *tag-queries:store tag-queries.old *tag-queries:store
validators.old ~
:: ::
update-logs.old update-logs.old
%- ~(run by update-logs.old) %- ~(run by update-logs.old)

View File

@ -738,7 +738,7 @@
tag-queries=(tree [term (tree uid)]) tag-queries=(tree [term (tree uid)])
update-logs=tree-update-logs update-logs=tree-update-logs
archive=tree-graphs archive=tree-graphs
validators=(tree ^mark) ~
== ==
+$ tree-graphs (tree [resource tree-marked-graph]) +$ tree-graphs (tree [resource tree-marked-graph])
+$ tree-marked-graph [p=tree-graph q=(unit ^mark)] +$ tree-marked-graph [p=tree-graph q=(unit ^mark)]
@ -779,7 +779,7 @@
(remake-jug:migrate tag-queries.t) (remake-jug:migrate tag-queries.t)
(remake-update-logs update-logs.t) (remake-update-logs update-logs.t)
(remake-graphs archive.t) (remake-graphs archive.t)
(remake-set:migrate validators.t) ~
== ==
:: ::
++ remake-graphs ++ remake-graphs

View File

@ -23,7 +23,7 @@
=tag-queries =tag-queries
=update-logs =update-logs
archive=graphs archive=graphs
validators=(set mark) ~
== ==
:: ::
+$ update [p=time q=action] +$ update [p=time q=action]