diff --git a/sys/vane/clay.hoon b/sys/vane/clay.hoon index 05613195c..3a1ffbac6 100644 --- a/sys/vane/clay.hoon +++ b/sys/vane/clay.hoon @@ -180,7 +180,7 @@ :: :: Formal vane state. :: -:: -- `fat` is a collection of our domestic ships. +:: -- `rom` is our domestic state. :: -- `hoy` is a collection of foreign ships where we know something about :: their clay. :: -- `ran` is the object store. @@ -192,7 +192,7 @@ :: -- `tip` is the date of the last write; if now, enqueue incoming requests. :: ++ raft :: filesystem - $: fat/(map ship room) :: domestic + $: rom/room :: domestic hoy/(map ship rung) :: foreign ran/rang :: hashes mon/(map term beam) :: mount points @@ -388,25 +388,24 @@ :: :: The state includes: :: +:: -- local urbit `our` :: -- current time `now` :: -- current duct `hen` -:: -- local urbit `our` +:: -- all vane state `++raft` (rarely used, except for the object store) :: -- target urbit `her` :: -- target desk `syd` -:: -- all vane state `++raft` (rarely used, except for the object store) :: :: For local desks, `our` == `her` is one of the urbits on our pier. For :: foreign desks, `her` is the urbit the desk is on and `our` is the local :: urbit that's managing the relationship with the foreign urbit. Don't mix :: up those two, or there will be wailing and gnashing of teeth. :: -:: While setting up `++de`, we check if the given `her` is a local urbit. If -:: so, we pull the room from `fat` in the raft and get the desk information -:: from `dos` in there. Otherwise, we get the rung from `hoy` and get the -:: desk information from `rus` in there. In either case, we normalize the -:: desk information to a `++rede`, which is all the desk-specific data that -:: we utilize in `++de`. Because it's effectively a part of the `++de` -:: state, let's look at what we've got: +:: While setting up `++de`, we check if `our` == `her`. If so, we get +:: the desk information from `dos.rom`. Otherwise, we get the rung from +:: `hoy` and get the desk information from `rus` in there. In either case, +:: we normalize the desk information to a `++rede`, which is all the +:: desk-specific data that we utilize in `++de`. Because it's effectively +:: a part of the `++de` state, let's look at what we've got: :: :: -- `lim` is the most recent date we're confident we have all the :: information for. For local desks, this is always `now`. For foreign @@ -429,47 +428,44 @@ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |% ++ de :: per desk - |= {now/@da hen/duct raft} - |= {{our/@p her/@p} syd/desk} - =* ruf +>+<+> - =+ ^- {hun/(unit duct) rede} - =+ rom=(~(get by fat.ruf) her) - ?~ rom + |= [our=ship now=@da hen=duct raft] + |= [her=ship syd=desk] + :: XX ruf=raft crashes in the compiler + :: + =* ruf |3.+6.^$ + :: + =+ ^- [hun=(unit duct) rede] + ?. =(our her) + :: no duct, foreign +rede or default + :: :- ~ - %+ fall - (~(get by rus:(fall (~(get by hoy.ruf) her) *rung)) syd) - :* lim=~2000.1.1 - ref=[~ *rind] - qyx=~ - dom=*dome - dok=~ - mer=~ - per=~ - pew=~ - == - :- `hun.u.rom - =+ jod=(fall (~(get by dos.u.rom) syd) *dojo) - :* lim=now - ref=~ - qyx=qyx.jod - dom=dom.jod - dok=dok.jod - mer=mer.jod - per=per.jod - pew=pew.jod - == - =* red -> + =/ rus rus:(fall (~(get by hoy.ruf) her) *rung) + %+ fall (~(get by rus) syd) + [lim=~2000.1.1 ref=`*rind qyx=~ dom=*dome dok=~ mer=~ per=~ pew=~] + :: administrative duct, domestic +rede + :: + :- `hun.rom.ruf + =/ jod (fall (~(get by dos.rom.ruf) syd) *dojo) + [lim=now ref=~ [qyx dom dok mer per pew]:jod] + :: + =* red=rede -> =| mow/(list move) |% ++ abet :: resolve - ^- {(list move) raft} - :_ =+ rom=(~(get by fat.ruf) her) - ?~ rom - =+ rug=(~(put by rus:(fall (~(get by hoy.ruf) her) *rung)) syd red) - ruf(hoy (~(put by hoy.ruf) her rug)) - =+ dos=(~(put by dos.u.rom) syd [qyx dom dok mer per pew]) - ruf(fat (~(put by fat.ruf) her [(need hun) dos])) - (flop mow) + ^- [(list move) raft] + :- (flop mow) + ?. =(our her) + :: save foreign +rede + :: + =/ rus rus:(fall (~(get by hoy.ruf) her) *rung) + =/ rug (~(put by rus) syd red) + ruf(hoy (~(put by hoy.ruf) her rug)) + :: save domestic +room + :: + %= ruf + hun.rom (need hun) + dos.rom (~(put by dos.rom.ruf) syd [qyx dom dok mer per pew]:red) + == :: :: Handle `%sing` requests :: @@ -2755,12 +2751,13 @@ ~ ?- p.mun $d - =+ rom=(~(get by fat.ruf) her) - ?~ rom - ~&(%null-rom-cd [~ ~]) + :: XX this should only allow reads at the currebt date + :: + ?: !=(our her) + [~ ~] ?^ r.mun ~&(%no-cd-path [~ ~]) - [~ ~ %& %noun !>(~(key by dos.u.rom))] + [~ ~ %& %noun !>(~(key by dos.rom.ruf))] :: $p (read-p r.mun) $t (bind (read-t yon r.mun) (lift |=(a=cage [%& a]))) @@ -3687,7 +3684,7 @@ :: This is the arvo interface vane. Our formal state is a `++raft`, which :: has five components: :: -:: -- `fat` is the state for all local desks. +:: -- `rom` is the state for all local desks. :: -- `hoy` is the state for all foreign desks. :: -- `ran` is the global, hash-addressed object store. :: -- `mon` is the set of mount points in unix. @@ -3724,11 +3721,10 @@ (~(put by cez.ruf) nom.req cew.req) :: wake all desks, a request may have been affected. =| mos/(list move) - =+ rom=(fall (~(get by fat.ruf) our.req) *room) - =+ des=~(tap in ~(key by dos.rom)) + =/ des ~(tap in ~(key by dos.rom.ruf)) |- ?~ des [[[hen %give %mack ~] mos] ..^^$] - =+ den=((de now hen ruf) [. .]:our.req i.des) + =/ den ((de our now hen ruf) our i.des) =^ mor ruf =< abet:wake ?: ?=(^ cew.req) den @@ -3739,8 +3735,7 @@ [[hen %give %cruz cez.ruf]~ ..^$] :: $crow - =+ rom=(fall (~(get by fat.ruf) our.req) *room) - =+ des=~(tap by dos.rom) + =/ des ~(tap by dos.rom.ruf) =| rus/(map desk {r/regs w/regs}) |^ ?~ des [[hen %give %croz rus]~ ..^^$] @@ -3764,7 +3759,7 @@ :: $drop =^ mos ruf - =+ den=((de now hen ruf) [. .]:our.req des.req) + =/ den ((de our now hen ruf) our des.req) abet:drop-me:den [mos ..^$] :: @@ -3783,17 +3778,12 @@ ?: =(%$ des.req) [~ ..^$] =^ mos ruf - =+ den=((de now hen ruf) [. .]:our.req des.req) + =/ den ((de our now hen ruf) our des.req) abet:(edit:den now dit.req) [mos ..^$] :: $init - :- ~ - %_ ..^$ - fat.ruf - ?< (~(has by fat.ruf) our.req) - (~(put by fat.ruf) our.req [-(hun hen)]:[*room .]) - == + [~ ..^$(hun.rom.ruf hen)] :: $into =. hez.ruf `hen @@ -3804,11 +3794,8 @@ =+ ^- bem/beam ?^ bem u.bem - [[?>(?=(^ fat.ruf) p.n.fat.ruf) %base %ud 1] ~] - =+ rom=(~(get by fat.ruf) p.bem) - ?~ rom - ~ - =+ dos=(~(get by dos.u.rom) q.bem) + [[our %base %ud 1] ~] + =/ dos (~(get by dos.rom.ruf) q.bem) ?~ dos ~ ?: =(0 let.dom.u.dos) @@ -3820,18 +3807,18 @@ ?=($mime p.p.b) ?=({$hoon ~} (slag (dec (lent a)) a)) == - :~ [hen %pass /one %c %info p.bem q.bem %& one] - [hen %pass /two %c %info p.bem q.bem %& two] + :~ [hen %pass /one %c %info our q.bem %& one] + [hen %pass /two %c %info our q.bem %& two] == =+ yak=(~(got by hut.ran.ruf) (~(got by hit.dom.u.dos) let.dom.u.dos)) =+ cos=(mode-to-soba q.yak (flop s.bem) all.req fis.req) - [hen %pass /both %c %info p.bem q.bem %& cos]~ + [hen %pass /both %c %info our q.bem %& cos]~ :: $merg :: direct state up ?: =(%$ des.req) [~ ..^$] =^ mos ruf - =+ den=((de now hen ruf) [. .]:our.req des.req) + =/ den ((de our now hen ruf) our des.req) abet:abet:(start:(me:ze:den [her.req dem.req] ~ &) cas.req how.req) [mos ..^$] :: @@ -3844,14 +3831,11 @@ =* bem bem.req =. mon.ruf (~(put by mon.ruf) des.req [p.bem q.bem r.bem] s.bem) - =+ yar=(~(get by fat.ruf) p.bem) - ?~ yar - [~ ..^$] - =+ dos=(~(get by dos.u.yar) q.bem) + =/ dos (~(get by dos.rom.ruf) q.bem) ?~ dos [~ ..^$] =^ mos ruf - =+ den=((de now hen ruf) [. .]:p.bem q.bem) + =/ den ((de our now hen ruf) p.bem q.bem) abet:(mont:den des.req bem) [mos ..^$] :: @@ -3889,8 +3873,7 @@ :: $perm =^ mos ruf - ::TODO after new boot system, just use our from global. - =+ den=((de now hen ruf) [. .]:our.req des.req) + =/ den ((de our now hen ruf) our des.req) abet:(perm:den pax.req rit.req) [mos ..^$] :: @@ -3906,7 +3889,7 @@ ?> ?=($warp -.req) =* rif rif.req =^ mos ruf - =+ den=((de now hen ruf) wer.req p.rif) + =/ den ((de our now hen ruf) q.wer.req p.rif) =< abet ?~ q.rif cancel-request:den @@ -3933,7 +3916,7 @@ =+ syd=(slav %tas i.t.pax) =+ inx=(slav %ud i.t.t.pax) =^ mos ruf - =+ den=((de now hen ruf) [our wer] syd) + =/ den ((de our now hen ruf) wer syd) abet:(take-foreign-update:den inx ((hard (unit rand)) res.req)) [[[hen %give %mack ~] mos] ..^$] :: @@ -3942,7 +3925,7 @@ :^ hen %give %mass :- %clay :- %| - :~ domestic+[%& fat.ruf] + :~ domestic+[%& rom.ruf] foreign+[%& hoy.ruf] :- %object-store :- %| :~ commits+[%& hut.ran.ruf] @@ -3953,80 +3936,11 @@ :: ++ load => |% - ++ rove-0 - $% {$sing p/mood} - {$next p/mood q/cach} - $: $mult - p/mool - q/(unit aeon) - r/(map (pair care path) cach) - s/(map (pair care path) cach) - == - {$many p/? q/moat r/(map path lobe)} - == - ++ wove-0 (cork wove |=(a/wove a(q (rove-0 q.a)))) - ++ cult-0 (jug wove-0 duct) - ++ dojo-0 (cork dojo |=(a/dojo a(qyx *cult-0))) - ++ rede-0 (cork rede |=(a/rede a(qyx *cult-0))) - ++ room-0 (cork room |=(a/room a(dos (~(run by dos.a) dojo-0)))) - ++ rung-0 (cork rung |=(a/rung a(rus (~(run by rus.a) rede-0)))) - ++ raft-0 - %+ cork raft - |= a/raft - %= a - fat (~(run by fat.a) room-0) - hoy (~(run by hoy.a) rung-0) - == - :: - ++ axle $%({$1 ruf/raft} {$0 ruf/raft-0}) + ++ axle $%([%1 ruf=raft]) -- - |= old/axle + |= old=axle ^+ ..^$ - ?- -.old - $1 - ..^$(ruf ruf.old) - :: - $0 - |^ - =- ^$(old [%1 -]) - =+ ruf.old - :* (~(run by fat) rom) - (~(run by hoy) run) - ran mon hez ~ ~ *@da - == - :: - ++ wov - |= a/wove-0 - ^- wove - :- p.a - ?. ?=($next -.q.a) q.a - [%next p.q.a ~ q.q.a] - :: - ++ cul - |= a/cult-0 - ^- cult - %- ~(gas by *cult) - %+ turn ~(tap by a) - |= {p/wove-0 q/(set duct)} - [(wov p) q] - :: - ++ rom - |= room-0 - ^- room - :- hun - %- ~(run by dos) - |= d/dojo-0 - ^- dojo - d(qyx (cul qyx.d)) - :: - ++ run - |= a/rung-0 - =- a(rus (~(run by rus.a) -)) - |= r/rede-0 - ^- rede - r(qyx (cul qyx.r)) - -- - == + ..^$(ruf ruf.old) :: ++ scry :: inspect |= {fur/(unit (set monk)) ren/@tas why/shop syd/desk lot/coin tyl/path} @@ -4035,7 +3949,6 @@ =* his p.why :: ~& scry+[ren `path`[(scot %p his) syd ~(rent co lot) tyl]] :: =- ~& %scry-done - - =+ got=(~(has by fat.ruf) his) =+ luk=?.(?=(%$ -.lot) ~ ((soft case) p.lot)) ?~ luk [~ ~] ?: =(%$ ren) @@ -4050,7 +3963,7 @@ ?: ?=(%| -.m) ~ ?: =(p.m his) ~ `p.m - =+ den=((de now [/scryduct ~] ruf) [. .]:his syd) + =/ den ((de our now [/scryduct ~] ruf) his syd) =+ (aver:den for u.run u.luk tyl) ?~ - - ?~ u.- - @@ -4063,20 +3976,16 @@ ^+ [*(list move) ..^$] ?: ?=({$merge @ @ @ @ @ ~} tea) ?> ?=(?($writ $made) +<.q.hin) - =+ our=(slav %p i.t.tea) =* syd i.t.t.tea =+ her=(slav %p i.t.t.t.tea) =* sud i.t.t.t.t.tea =* sat i.t.t.t.t.t.tea =+ dat=?-(+<.q.hin $writ [%& p.q.hin], $made [%| result.q.hin]) - =+ ^- kan/(unit dome) - %+ biff (~(get by fat.ruf) her) - |= room - %+ bind (~(get by dos) sud) - |= dojo - dom + =/ kan=(unit dome) + %+ bind (~(get by dos.rom.ruf) sud) + |=(a=dojo dom.a) =^ mos ruf - =+ den=((de now hen ruf) [. .]:our syd) + =/ den ((de our now hen ruf) our syd) abet:abet:(route:(me:ze:den [her sud] kan |) sat dat) [mos ..^$] ?: ?=({$blab care @ @ *} tea) @@ -4103,76 +4012,68 @@ ?+ -.tea !! $inserting ?> ?=({@ @ @ ~} t.tea) - =+ our=(slav %p i.t.tea) =+ syd=(slav %tas i.t.t.tea) =+ wen=(slav %da i.t.t.t.tea) =^ mos ruf - =+ den=((de now hen ruf) [. .]:our syd) + =/ den ((de our now hen ruf) our syd) abet:(take-inserting:den wen result.q.hin) [mos ..^$] :: $diffing ?> ?=({@ @ @ ~} t.tea) - =+ our=(slav %p i.t.tea) =+ syd=(slav %tas i.t.t.tea) =+ wen=(slav %da i.t.t.t.tea) =^ mos ruf - =+ den=((de now hen ruf) [. .]:our syd) + =/ den ((de our now hen ruf) our syd) abet:(take-diffing:den wen result.q.hin) [mos ..^$] :: $castifying ?> ?=({@ @ @ ~} t.tea) - =+ our=(slav %p i.t.tea) =+ syd=(slav %tas i.t.t.tea) =+ wen=(slav %da i.t.t.t.tea) =^ mos ruf - =+ den=((de now hen ruf) [. .]:our syd) + =/ den ((de our now hen ruf) our syd) abet:(take-castify:den wen result.q.hin) [mos ..^$] :: $mutating ?> ?=({@ @ @ ~} t.tea) - =+ our=(slav %p i.t.tea) =+ syd=(slav %tas i.t.t.tea) =+ wen=(slav %da i.t.t.t.tea) =^ mos ruf - =+ den=((de now hen ruf) [. .]:our syd) + =/ den ((de our now hen ruf) our syd) abet:(take-mutating:den wen result.q.hin) [mos ..^$] :: $patching ?> ?=({@ @ ~} t.tea) - =+ our=(slav %p i.t.tea) =+ syd=(slav %tas i.t.t.tea) =^ mos ruf - =+ den=((de now hen ruf) [. .]:our syd) + =/ den ((de our now hen ruf) our syd) abet:(take-patch:den result.q.hin) [mos ..^$] :: $ergoing ?> ?=({@ @ ~} t.tea) - =+ our=(slav %p i.t.tea) =+ syd=(slav %tas i.t.t.tea) =^ mos ruf - =+ den=((de now hen ruf) [. .]:our syd) + =/ den ((de our now hen ruf) our syd) abet:(take-ergo:den result.q.hin) [mos ..^$] :: $foreign-plops ?> ?=({@ @ @ @ ~} t.tea) - =+ our=(slav %p i.t.tea) =+ her=(slav %p i.t.t.tea) =* syd i.t.t.t.tea =+ lem=(slav %da i.t.t.t.t.tea) =^ mos ruf - =+ den=((de now hen ruf) [our her] syd) + =/ den ((de our now hen ruf) her syd) abet:(take-foreign-plops:den ?~(lem ~ `lem) result.q.hin) [mos ..^$] :: $foreign-x ?> ?=({@ @ @ @ @ *} t.tea) - =+ our=(slav %p i.t.tea) =+ her=(slav %p i.t.t.tea) =+ syd=(slav %tas i.t.t.t.tea) =+ car=((hard care) i.t.t.t.t.tea) @@ -4182,7 +4083,7 @@ ->+ =* pax t.t.t.t.t.t.tea =^ mos ruf - =+ den=((de now hen ruf) [our her] syd) + =/ den ((de our now hen ruf) her syd) abet:(take-foreign-x:den car cas pax result.q.hin) [mos ..^$] == @@ -4210,19 +4111,14 @@ ?> =(hen queued-duct) :: (call hen [-:!>(*task:able) queued-task]) - :: =+ dal=(turn ~(tap by fat.ruf) |=([a=@p b=room] a)) - :: =| mos=(list move) - :: |- ^- [p=(list move) q=_..^^$] - :: ?~ dal [mos ..^^$] - :: =+ une=(un i.dal now hen ruf) - :: =^ som une wake:une - :: $(dal t.dal, ruf abet:une, mos (weld som mos)) + :: =^ mos=(list move) une + :: wake:(un our now hen ruf) + :: [mos ..^^$] :: $writ ?> ?=({@ @ *} tea) ~| i=i.tea ~| it=i.t.tea - =+ our=(slav %p i.tea) =+ him=(slav %p i.t.tea) :_ ..^$ :~ :* hen %pass /writ-want %a diff --git a/tests/sys/vane/clay.hoon b/tests/sys/vane/clay.hoon index fd66bc032..916b0a0fa 100644 --- a/tests/sys/vane/clay.hoon +++ b/tests/sys/vane/clay.hoon @@ -451,7 +451,7 @@ == ^- [tang _clay-gate] :: - =/ clay-core (clay-gate our=~zod now=now eny=`@`0xdead.beef scry=scry) + =/ clay-core (clay-gate our=~nul now=now eny=`@`0xdead.beef scry=scry) :: =^ moves clay-gate (call:clay-core call-args) :: @@ -472,7 +472,7 @@ == ^- [tang _clay-gate] :: - =/ clay-core (clay-gate our=~zod now=now eny=`@`0xdead.beef scry=scry) + =/ clay-core (clay-gate our=~nul now=now eny=`@`0xdead.beef scry=scry) :: =^ moves clay-gate (call:clay-core call-args) :: @@ -490,7 +490,7 @@ == ^- [tang _clay-gate] :: - =/ clay-core (clay-gate our=~zod now=now eny=`@`0xdead.beef scry=scry) + =/ clay-core (clay-gate our=~nul now=now eny=`@`0xdead.beef scry=scry) :: =^ moves clay-gate (take:clay-core take-args) :: @@ -511,7 +511,7 @@ == ^- [tang _clay-gate] :: - =/ clay-core (clay-gate our=~zod now=now eny=`@`0xdead.beef scry=scry) + =/ clay-core (clay-gate our=~nul now=now eny=`@`0xdead.beef scry=scry) :: =^ moves clay-gate (take:clay-core take-args) ::