Merge pull request #4922 from urbit/la/eyre-tube

eyre: send warp to warm %f cache for any mark that gets used and switch to %f from %c
This commit is contained in:
L 2021-06-01 13:45:08 -05:00 committed by GitHub
commit 17ea4754de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 49 additions and 35 deletions

View File

@ -1,6 +1,5 @@
:: graph-store [landscape] :: graph-store [landscape]
:: ::
::
/+ store=graph-store, sigs=signatures, res=resource, default-agent, dbug, verb /+ store=graph-store, sigs=signatures, res=resource, default-agent, dbug, verb
~% %graph-store-top ..part ~ ~% %graph-store-top ..part ~
|% |%

View File

@ -33,7 +33,7 @@
++ grab ++ grab
|% |%
++ noun ++ noun
|= p=* |: p=`*`%*(. *indexed-post index.p [0 ~])
=/ ip ;;(indexed-post p) =/ ip ;;(indexed-post p)
?> ?=([@ ~] index.p.ip) ?> ?=([@ ~] index.p.ip)
ip ip

View File

@ -49,7 +49,7 @@
++ grab ++ grab
|% |%
++ noun ++ noun
|= p=* |: p=`*`%*(. *indexed-post index.p [0 0 ~])
=/ ip ;;(indexed-post p) =/ ip ;;(indexed-post p)
?+ index.p.ip ~|(index+index.p.ip !!) ?+ index.p.ip ~|(index+index.p.ip !!)
:: top-level link post; title and url :: top-level link post; title and url

View File

@ -43,7 +43,7 @@
:: +noun: validate post :: +noun: validate post
:: ::
++ noun ++ noun
|= p=* |: p=`*`%*(. *indexed-post contents.p [%text '']~)
=/ ip ;;(indexed-post p) =/ ip ;;(indexed-post p)
?> ?=(^ contents.p.ip) ?> ?=(^ contents.p.ip)
ip ip

View File

@ -58,7 +58,7 @@
:: +noun: validate publish note :: +noun: validate publish note
:: ::
++ noun ++ noun
|= p=* |: p=`*`%*(. *indexed-post index.p [0 ~])
=/ ip ;;(indexed-post p) =/ ip ;;(indexed-post p)
?+ index.p.ip !! ?+ index.p.ip !!
:: top level post must have no content :: top level post must have no content

View File

@ -30,6 +30,9 @@
$% [%rest p=@da] $% [%rest p=@da]
[%wait p=@da] [%wait p=@da]
== == == ==
$: %c
$>(%warp task:clay)
==
:: %d: to dill :: %d: to dill
:: ::
$: %d $: %d
@ -53,6 +56,12 @@
$: %gall $: %gall
gift:gall gift:gall
:: $>(%unto gift:gall) :: $>(%unto gift:gall)
::
==
$: %clay
gift:clay
:: $>(%writ gift:clay)
::
== == == ==
-- --
:: more structures :: more structures
@ -1231,9 +1240,9 @@
::NOTE these will only fail if the mark and/or json types changed, ::NOTE these will only fail if the mark and/or json types changed,
:: since conversion failure also gets caught during first receive. :: since conversion failure also gets caught during first receive.
:: we can't do anything about this, so consider it unsupported. :: we can't do anything about this, so consider it unsupported.
?~ sign=(channel-event-to-sign channel-event) $ ?~ sign=(channel-event-to-sign channel-event) $
?~ json=(sign-to-json request-id u.sign) $ ?~ jive=(sign-to-json request-id u.sign) $
$(events [(event-json-to-wall id u.json) events]) $(events [(event-json-to-wall id +.u.jive) events])
:: send the start event to the client :: send the start event to the client
:: ::
=^ http-moves state =^ http-moves state
@ -1499,8 +1508,12 @@
:: if conversion succeeds, we *can* send it. if the client is actually :: if conversion succeeds, we *can* send it. if the client is actually
:: connected, we *will* send it immediately. :: connected, we *will* send it immediately.
:: ::
=/ json=(unit json) =/ jive=(unit (quip move json))
(sign-to-json request-id sign) (sign-to-json request-id sign)
=/ json=(unit json)
?~(jive ~ `+.u.jive)
=? moves ?=(^ jive)
(weld moves -.u.jive)
=* sending &(?=([%| *] state.u.channel) ?=(^ json)) =* sending &(?=([%| *] state.u.channel) ?=(^ json))
:: ::
=/ next-id next-id.u.channel =/ next-id next-id.u.channel
@ -1578,7 +1591,7 @@
^= data ^= data
%- wall-to-octs %- wall-to-octs
%+ event-json-to-wall next-id %+ event-json-to-wall next-id
(need (sign-to-json request-id %kick ~)) +:(need (sign-to-json request-id %kick ~))
:: ::
complete=%.n complete=%.n
== ==
@ -1619,32 +1632,33 @@
:: +sign-to-json: render sign from request-id as json channel event :: +sign-to-json: render sign from request-id as json channel event
:: ::
++ sign-to-json ++ sign-to-json
~% %sign-to-json ..part ~
|= [request-id=@ud =sign:agent:gall] |= [request-id=@ud =sign:agent:gall]
^- (unit json) ^- (unit (quip move json))
:: for facts, we try to convert the result to json :: for facts, we try to convert the result to json
:: ::
=/ jsyn=(unit sign:agent:gall) =/ [from=(unit mark) jsyn=(unit sign:agent:gall)]
?. ?=(%fact -.sign) `sign ?. ?=(%fact -.sign) [~ `sign]
?: ?=(%json p.cage.sign) `sign ?: ?=(%json p.cage.sign) [~ `sign]
:: find and use tube from fact mark to json :: find and use tube from fact mark to json
:: ::
=* have=mark p.cage.sign =* have=mark p.cage.sign
=* desc=tape "from {(trip have)} to json" =* desc=tape "from {(trip have)} to json"
=/ tube=(unit tube:clay) =/ convert=(unit vase)
=/ tuc=(unit (unit cage)) =/ cag=(unit (unit cage))
(rof ~ %cc [our %home da+now] /[have]/json) (rof ~ %cf [our %home da+now] /[have]/json)
?. ?=([~ ~ *] tuc) ~ ?. ?=([~ ~ *] cag) ~
`!<(tube:clay q.u.u.tuc) `q.u.u.cag
?~ tube ?~ convert
((slog leaf+"eyre: no tube {desc}" ~) ~) ((slog leaf+"eyre: no convert {desc}" ~) [~ ~])
:: ~| "conversion failed {desc}"
=/ res (mule |.((u.tube q.cage.sign))) [`have `[%fact %json (slym u.convert q.q.cage.sign)]]
?: ?=(%& -.res)
`[%fact %json p.res]
((slog leaf+"eyre: failed tube {desc}" ~) ~)
::
?~ jsyn ~ ?~ jsyn ~
%- some %- some
:- ?~ from ~
:_ ~
:^ duct %pass /conversion-cache/[u.from]
[%c %warp our %home `[%sing %f da+now /[u.from]/json]]
=* sign u.jsyn =* sign u.jsyn
=, enjs:format =, enjs:format
%- pairs %- pairs
@ -1665,7 +1679,7 @@
:- 'json' :- 'json'
~| [%unexpected-fact-mark p.cage.sign] ~| [%unexpected-fact-mark p.cage.sign]
?> =(%json p.cage.sign) ?> =(%json p.cage.sign)
;;(json q.q.cage.sign) !<(json q.cage.sign)
== ==
:: ::
%kick %kick
@ -2320,14 +2334,15 @@
:: ::
|^ ^- [(list move) _http-server-gate] |^ ^- [(list move) _http-server-gate]
:: ::
?+ i.wire ?+ i.wire
~|([%bad-take-wire wire] !!) ~|([%bad-take-wire wire] !!)
:: ::
%run-app-request run-app-request %run-app-request run-app-request
%watch-response watch-response %watch-response watch-response
%sessions sessions %sessions sessions
%channel channel %channel channel
%acme acme-ack %acme acme-ack
%conversion-cache `http-server-gate
== ==
:: ::
++ run-app-request ++ run-app-request