mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-11 16:09:31 +03:00
Merge branch 'dish' of https://github.com/urbit/urbit into dish
This commit is contained in:
commit
c8f5313407
@ -1,5 +1,5 @@
|
||||
:: ames (4a), networking
|
||||
!:
|
||||
!: :: ames (4a), networking
|
||||
::
|
||||
|= pit=vase
|
||||
=> =~
|
||||
:: structures
|
||||
@ -1433,7 +1433,7 @@
|
||||
=+ bou=bust:puz
|
||||
=. bin
|
||||
?. &(bou !oub) bin
|
||||
:_(bin [%wine [our her] " not responding still trying"])
|
||||
:_(bin [%wine [our her] " not responding still crying"])
|
||||
=. diz ?:((boom:puz now) (pode:diz now) diz)
|
||||
(busk xong:diz yem)
|
||||
::
|
||||
|
@ -1,6 +1,6 @@
|
||||
!:
|
||||
:: batz (4b), shell
|
||||
::
|
||||
::
|
||||
|= pit=vase
|
||||
=> =~
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
|
@ -1,3 +1,4 @@
|
||||
!:
|
||||
:: clay (4c), revision control
|
||||
!:
|
||||
|= pit=vase
|
||||
@ -83,7 +84,7 @@
|
||||
== ::
|
||||
++ room :: fs per ship
|
||||
$: hun=duct :: terminal duct
|
||||
hez=(unit duct) :: sync duch
|
||||
hez=(unit duct) :: sync duct
|
||||
dos=(map desk dojo) :: native desk
|
||||
== ::
|
||||
++ rove (each mood moot) :: stored request
|
||||
@ -141,9 +142,9 @@
|
||||
?~(nao ~ [~ (~(read-at-aeon ze lim dom ran) u.nao mun)])
|
||||
::
|
||||
++ balk :: read and send
|
||||
|= [hen=duct oan=@ud mun=mood]
|
||||
|= [hen=duct yon=@ud mun=mood]
|
||||
^+ +>
|
||||
=+ vid=(~(read-at-aeon ze lim dom ran) oan mun)
|
||||
=+ vid=(~(read-at-aeon ze lim dom ran) yon mun)
|
||||
?~ vid (blub hen) (blab hen mun u.vid)
|
||||
::
|
||||
++ bait
|
||||
|
@ -1,4 +1,3 @@
|
||||
::
|
||||
:: :: %eyre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A.l9000.00dPb.YzBT6.giO00.o100d.wZcqc.a9tg-.VTG0b.
|
||||
AUIvE.HBM3g.cK4SE.0aagi.l090p.I1P5g.Y-80r.y1YS9.1xE~Y.qgpFY.
|
||||
vKN1V.905y0.2UwvL.43TUw.uL406.0-31h.xwoJF.Ul454.ilk00.00Yps.
|
||||
BNumh.xpl9B.pS5Ji.i1BoC.ZAgg1.BsC5T.t6pLk.Thohn.gp000.0ov~P.
|
||||
7M000.0o840.00010.0001i.h4x93.g0000.Eq2wR.7jB29
|
||||
==
|
||||
::
|
||||
++ huff :: request by ship
|
||||
|
@ -1,4 +1,4 @@
|
||||
::::::
|
||||
!:::::
|
||||
:: :: %ford, new execution control
|
||||
!? 164
|
||||
::::
|
||||
@ -804,7 +804,8 @@
|
||||
|= [cof=cafe vax=vase gen=twig]
|
||||
=+ puz=(mule |.((~(mint ut p.vax) [%noun gen])))
|
||||
?- -.puz
|
||||
| (flaw cof p.puz)
|
||||
| ~& [%maim-fail p.puz]
|
||||
(flaw cof p.puz)
|
||||
& %+ (coup cof) (mock [q.vax q.p.puz] (mole ska))
|
||||
|= val=*
|
||||
`vase`[p.p.puz val]
|
||||
|
@ -592,7 +592,7 @@
|
||||
^- lens
|
||||
?~ huv.sat *lens
|
||||
=+ gat=(slap u.huv.sat [%cnzy %peek])
|
||||
=+ cor=(slam gat !>(pax))
|
||||
=+ cor=(slam gat !>([our pax]))
|
||||
=+ ^= dek
|
||||
|* fun=$+(vase *)
|
||||
|= nam=@tas
|
||||
|
195
arvo/hoon.hoon
195
arvo/hoon.hoon
@ -31,11 +31,11 @@
|
||||
++ bean ,? :: 0=&=yes, 1=|=no
|
||||
++ beer $|(@ [~ p=twig]) :: simple embed
|
||||
++ beet $| @ :: advanced embed
|
||||
$% [%a p=twig] ::
|
||||
[%b p=twig] ::
|
||||
[%c p=twig] ::
|
||||
[%d p=twig] ::
|
||||
[%e p=twig q=(list tuna)] ::
|
||||
$% [%a p=twig] :: take tape
|
||||
[%b p=twig] :: take manx
|
||||
[%c p=twig] :: take marl
|
||||
[%d p=twig] :: take $+(marl marl)
|
||||
[%e p=twig q=(list tuna)] :: element literal
|
||||
== ::
|
||||
++ bloq ,@ :: blockclass
|
||||
++ calf ,[p=(map ,@ud wine) q=wine] ::
|
||||
@ -49,8 +49,8 @@
|
||||
[std=term kel=@] :: kelvin version
|
||||
[ven=term pro=term kel=@] :: vendor and product
|
||||
[ven=term pro=term ver=@ kel=@] :: all of the above
|
||||
== ::
|
||||
++ clue ,[p=axis q=chum r=tyre] :: battery definition
|
||||
==
|
||||
++ clue ,[p=chum q=nock r=(list (pair term nock))] :: battery definition
|
||||
++ coil $: p=?(%gold %iron %lead %zinc) :: core type
|
||||
q=type ::
|
||||
r=[p=?(~ ^) q=(map term foot)] ::
|
||||
@ -154,8 +154,8 @@
|
||||
p=[p=tape q=tape r=tape s=tape] ::
|
||||
q=(list tank) ::
|
||||
== ::
|
||||
$: %rose ::
|
||||
p=[p=tape q=tape r=tape] ::
|
||||
$: %rose :: delimeted list
|
||||
p=[p=tape q=tape r=tape] :: mid open close
|
||||
q=(list tank) ::
|
||||
== ::
|
||||
==
|
||||
@ -341,19 +341,19 @@
|
||||
[%10 p=?(@ [p=@ q=nock]) q=nock] :: hint
|
||||
[%11 p=nock] :: grab data from sky
|
||||
== ::
|
||||
++ tone $% [%0 p=*] ::
|
||||
[%1 p=(list)] ::
|
||||
[%2 p=(list ,[@ta *])] ::
|
||||
++ tone $% [%0 p=*] :: success
|
||||
[%1 p=(list)] :: blocks
|
||||
[%2 p=(list ,[@ta *])] :: error ~_s
|
||||
== ::
|
||||
++ toon $% [%0 p=*] ::
|
||||
[%1 p=(list)] ::
|
||||
[%2 p=(list tank)] ::
|
||||
++ toon $% [%0 p=*] :: success
|
||||
[%1 p=(list)] :: blocks
|
||||
[%2 p=(list tank)] :: stack trace
|
||||
== ::
|
||||
++ tune $% [%0 p=vase] ::
|
||||
[%1 p=(list)] ::
|
||||
[%2 p=(list ,[@ta *])] ::
|
||||
== ::
|
||||
++ twin ,[p=term q=wing r=axis s=type] ::
|
||||
++ twin ,[p=term q=wing r=axis s=type] :: alias info
|
||||
++ type $| ?(%noun %void) :: set all or set none
|
||||
$% [%atom p=term] :: number and format
|
||||
[%bull p=twin q=type] :: wing synonym
|
||||
@ -418,7 +418,7 @@
|
||||
++ wonk |*(veq=edge ?~(q.veq !! p.u.q.veq)) ::
|
||||
:: ::
|
||||
:: ::
|
||||
++ map |* [a=_,* b=_,*] :: associative array
|
||||
++ map |* [a=_,* b=_,*] :: associative tree
|
||||
$|(~ [n=[p=a q=b] l=(map a b) r=(map a b)]) ::
|
||||
++ qeu |* a=_,* :: queue
|
||||
$|(~ [n=a l=(qeu a) r=(qeu a)]) ::
|
||||
@ -812,13 +812,6 @@
|
||||
+<-(+ $(+<- +<->))
|
||||
--
|
||||
::
|
||||
++ wild :: concatenate
|
||||
|* [a=(list) b=(list)]
|
||||
=> .(a ^.(homo a), b ^.(homo b))
|
||||
|-
|
||||
?~ a b
|
||||
[i=i.a $(a t.a)]
|
||||
::
|
||||
++ zing :: promote
|
||||
=| *
|
||||
|%
|
||||
@ -1141,23 +1134,25 @@
|
||||
/remlysfynwerrycsugnysnyllyndyndemluxfedsedbecmun\
|
||||
/lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes'
|
||||
|%
|
||||
++ ind ~/ %ind
|
||||
++ ind ~/ %ind :: parse prefix
|
||||
|= a=@tas
|
||||
=+ b=0
|
||||
|- ^- (unit ,@)
|
||||
?:(=(256 b) ~ ?:(=(a (tod b)) [~ b] $(b +(b))))
|
||||
++ ins ~/ %ins
|
||||
++ ins ~/ %ins :: parse suffix
|
||||
|= a=@tas
|
||||
=+ b=0
|
||||
|- ^- (unit ,@)
|
||||
?:(=(256 b) ~ ?:(=(a (tos b)) [~ b] $(b +(b))))
|
||||
++ tod ~/(%tod |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] dex))))
|
||||
++ tos ~/(%tos |=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] sis))))
|
||||
++ tod ~/ %tod :: fetch prefix
|
||||
|=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] dex)))
|
||||
++ tos ~/ %tos :: fetch suffix
|
||||
|=(a=@ ?>((lth a 256) (cut 3 [(mul 3 a) 3] sis)))
|
||||
--
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: section 2cF, signed and modular ints ::
|
||||
::
|
||||
++ si :: signed integer
|
||||
++ si !: :: signed integer
|
||||
|%
|
||||
++ abs |=(a=@s (add (end 0 1 a) (rsh 0 1 a))) :: absolute value
|
||||
++ dif |= [a=@s b=@s] :: subtraction
|
||||
@ -1206,9 +1201,9 @@
|
||||
--
|
||||
++ fe :: modulo bloq
|
||||
|_ a=bloq
|
||||
++ dif |=([b=@ c=@] (sit (sub (add out (sit b)) (sit c))))
|
||||
++ inv |=(b=@ (sub (dec out) (sit b)))
|
||||
++ net |= b=@ ^- @
|
||||
++ dif |=([b=@ c=@] (sit (sub (add out (sit b)) (sit c)))) :: difference
|
||||
++ inv |=(b=@ (sub (dec out) (sit b))) :: inverse
|
||||
++ net |= b=@ ^- @ :: flip byte endianness
|
||||
=> .(b (sit b))
|
||||
?: (lte a 3)
|
||||
b
|
||||
@ -1216,19 +1211,19 @@
|
||||
%+ con
|
||||
(lsh c 1 $(a c, b (cut c [0 1] b)))
|
||||
$(a c, b (cut c [1 1] b))
|
||||
++ out (bex (bex a))
|
||||
++ rol |= [b=bloq c=@ d=@] ^- @
|
||||
++ out (bex (bex a)) :: mod value
|
||||
++ rol |= [b=bloq c=@ d=@] ^- @ :: roll left
|
||||
=+ e=(sit d)
|
||||
=+ f=(bex (sub a b))
|
||||
=+ g=(mod c f)
|
||||
(sit (con (lsh b g e) (rsh b (sub f g) e)))
|
||||
++ ror |= [b=bloq c=@ d=@] ^- @
|
||||
++ ror |= [b=bloq c=@ d=@] ^- @ :: roll right
|
||||
=+ e=(sit d)
|
||||
=+ f=(bex (sub a b))
|
||||
=+ g=(mod c f)
|
||||
(sit (con (rsh b g e) (lsh b (sub f g) e)))
|
||||
++ sum |=([b=@ c=@] (sit (add b c)))
|
||||
++ sit |=(b=@ (end a 1 b))
|
||||
++ sum |=([b=@ c=@] (sit (add b c))) :: wrapping add
|
||||
++ sit |=(b=@ (end a 1 b)) :: enforce modulo
|
||||
--
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: section 2cG, floating point ::
|
||||
@ -1770,31 +1765,32 @@
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: section 2cI, almost macros ::
|
||||
::
|
||||
++ cury
|
||||
++ cury :: curry left
|
||||
|* [a=_|=(^ **) b=*]
|
||||
|* c=_+<+.a
|
||||
(a b c)
|
||||
::
|
||||
++ curr
|
||||
++ curr :: curry right
|
||||
|* [a=_|=(^ **) c=*]
|
||||
|* b=_+<+.a
|
||||
(a b c)
|
||||
::
|
||||
++ cork |*([a=_,* b=gate] (corl b a))
|
||||
++ cork |*([a=_,* b=gate] (corl b a)) :: compose forward
|
||||
::
|
||||
++ corl
|
||||
++ corl :: compose backwards
|
||||
|* [a=gate b=_,*]
|
||||
|= c=_+<.b
|
||||
=< +:|.((a (b))) :: type check
|
||||
|* c=_+<.b
|
||||
(a (b c))
|
||||
::
|
||||
++ hard
|
||||
++ hard :: force coerce to type
|
||||
|* han=$+(* *)
|
||||
|= fud=* ^- han
|
||||
~| %hard
|
||||
=+ gol=(han fud)
|
||||
?>(=(gol fud) gol)
|
||||
::
|
||||
++ soft
|
||||
++ soft :: maybe coerce to type
|
||||
|* han=$+(* *)
|
||||
|= fud=* ^- (unit han)
|
||||
=+ gol=(han fud)
|
||||
@ -2484,9 +2480,7 @@
|
||||
[zac [~ i.q.tub [zac t.q.tub]]]
|
||||
::
|
||||
++ sear :: conditional cook
|
||||
~/ %sear
|
||||
|* [pyq=_|=(* *(unit)) sef=_rule]
|
||||
~/ %fun
|
||||
|= tub=nail
|
||||
=+ vex=(sef tub)
|
||||
?~ q.vex
|
||||
@ -2583,9 +2577,7 @@
|
||||
[(last p.vex p.wag) [~ (raq p.u.q.vex p.u.q.wag) q.u.q.wag]]
|
||||
::
|
||||
++ stun :: parse several times
|
||||
~/ %stun
|
||||
|* [[les=@ mos=@] fel=_rule]
|
||||
~/ %fun
|
||||
|= tub=nail
|
||||
^- (like (list ,_(wonk (fel))))
|
||||
?: =(0 mos)
|
||||
@ -2816,17 +2808,18 @@
|
||||
;~(less bas soq prn)
|
||||
;~(pfix bas ;~(pose bas soq mes)) :: escape chars
|
||||
==
|
||||
++ qut ;~ pose :: cord
|
||||
++ qut ;~ simu soq :: cord
|
||||
;~ pose
|
||||
;~ less soqs
|
||||
(ifix [soq soq] (boss 256 (more gon qit)))
|
||||
==
|
||||
=+ hed=;~(pose ;~(plug (plus ace) vul) (just '\0a'))
|
||||
%- inde %+ ifix
|
||||
:- ;~ plug soqs
|
||||
;~(pose ;~(plug (plus ace) vul) (just '\0a'))
|
||||
==
|
||||
:- ;~(plug soqs hed)
|
||||
;~(plug (just '\0a') soqs)
|
||||
(boss 256 (star qat))
|
||||
==
|
||||
==
|
||||
::
|
||||
++ soqs ;~(plug soq soq soq) :: delimiting '''
|
||||
++ sym :: symbol
|
||||
@ -3431,7 +3424,6 @@
|
||||
rex
|
||||
:- '.'
|
||||
=>(.(rex $(esc t.esc)) ((x-co 4) i.esc))
|
||||
|
||||
::
|
||||
++ v-co |=(min=@ (em-co [32 min] |=([? b=@ c=tape] [~(v ne b) c])))
|
||||
++ w-co |=(min=@ (em-co [64 min] |=([? b=@ c=tape] [~(w ne b) c])))
|
||||
@ -3439,10 +3431,8 @@
|
||||
++ y-co |=(dat=@ ((d-co 2) dat))
|
||||
++ z-co |=(dat=@ `tape`['0' 'x' ((x-co 1) dat)])
|
||||
--
|
||||
~% %co +> ~
|
||||
|%
|
||||
++ em-co
|
||||
~/ %emco
|
||||
|= [[bas=@ min=@] [par=$+([? @ tape] tape)]]
|
||||
|= hol=@
|
||||
^- tape
|
||||
@ -3456,7 +3446,6 @@
|
||||
==
|
||||
::
|
||||
++ ox-co
|
||||
~/ %oxco
|
||||
|= [[bas=@ gop=@] dug=$+(@ @)]
|
||||
%+ em-co
|
||||
[|-(?:(=(0 gop) 1 (mul bas $(gop (dec gop))))) 0]
|
||||
@ -3469,7 +3458,6 @@
|
||||
|=([? b=@ c=tape] [(dug b) c])
|
||||
::
|
||||
++ ro-co
|
||||
~/ %roco
|
||||
|= [[buz=@ bas=@ dop=@] dug=$+(@ @)]
|
||||
|= hol=@
|
||||
^- tape
|
||||
@ -4656,7 +4644,7 @@
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: section 2eW, lite number theory ::
|
||||
::
|
||||
++ egcd :: schneier's egcd
|
||||
++ egcd !: :: schneier's egcd
|
||||
|= [a=@ b=@]
|
||||
=+ si
|
||||
=+ [c=(sun a) d=(sun b)]
|
||||
@ -5265,7 +5253,7 @@
|
||||
|= [who=@p wud=@]
|
||||
(shas (mix %shak who) wud)
|
||||
::
|
||||
++ sham :: noun hash
|
||||
++ sham :: 128bit noun hash
|
||||
|= yux=* ^- @uvH ^- @
|
||||
?@ yux
|
||||
(shaf %mash yux)
|
||||
@ -8397,6 +8385,7 @@
|
||||
++ hasp ;~ pose
|
||||
(ifix [sel ser] wide)
|
||||
(stag %cnhp (ifix [pel per] (most ace wide)))
|
||||
(stag %dtzy (stag %t qut))
|
||||
%+ cook
|
||||
|=(a=coin [%dtzy ?:(?=([~ %tas *] a) %tas %ta) ~(rent co a)])
|
||||
nuck:so
|
||||
@ -8772,7 +8761,7 @@
|
||||
(stag %dtzz (stag %tas (cold %$ buc)))
|
||||
(stag %dtzz (stag %f (cold & pam)))
|
||||
(stag %dtzz (stag %f (cold | bar)))
|
||||
(stag %dtzz (stag %ta qut))
|
||||
(stag %dtzz (stag %t qut))
|
||||
(cook (jock &) nuck:so)
|
||||
(cook |=(a=(list) [%clsg (posh ~ ~ (lent a) ~)]) (star cen))
|
||||
:: (easy [%clsg (poof wer)])
|
||||
@ -9396,7 +9385,7 @@
|
||||
(stag %leaf (stag %tas (cold %$ buc)))
|
||||
(stag %leaf (stag %f (cold & pam)))
|
||||
(stag %leaf (stag %f (cold | bar)))
|
||||
(stag %leaf (stag %ta qut))
|
||||
(stag %leaf (stag %t qut))
|
||||
%+ cook
|
||||
|= lot=coin ^- tile
|
||||
?- -.lot
|
||||
@ -9476,6 +9465,86 @@
|
||||
|= txt=@ta
|
||||
^- twig
|
||||
(rash txt wide:vast)
|
||||
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:::::: :::::: profiling support; move me ::::::
|
||||
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
++ doss
|
||||
$: sap=@ud :: sample count
|
||||
hit=(map term ,@ud) :: hit points
|
||||
cut=(map span hump) :: cut points
|
||||
==
|
||||
::
|
||||
++ hump
|
||||
$: sap=@ud :: sample count
|
||||
inn=(map span ,@ud) :: calls into
|
||||
out=(map span ,@ud) :: calls out of
|
||||
==
|
||||
::
|
||||
++ pi-heck
|
||||
|= [nam=@tas day=doss]
|
||||
^- doss
|
||||
=+ lam=(~(get by hit.day) nam)
|
||||
day(hit (~(put by hit.day) nam ?~(lam 1 +(u.lam))))
|
||||
::
|
||||
++ pi-noon :: sample trace
|
||||
|= [pax=path day=doss]
|
||||
=| lax=(unit span)
|
||||
|- ^- doss
|
||||
?~ pax day(sap +(sap.day))
|
||||
%= $
|
||||
pax t.pax
|
||||
lax `i.pax
|
||||
cut.day
|
||||
%+ ~(put by cut.day) i.pax
|
||||
^- hump
|
||||
=+ nax=`(unit span)`?~(t.pax ~ `i.t.pax)
|
||||
=+ hup=`hump`=+(hup=(~(get by cut.day) i.pax) ?^(hup u.hup [0 ~ ~]))
|
||||
:+ +(sap.hup)
|
||||
?~ lax inn.hup
|
||||
=+ hag=(~(get by inn.hup) u.lax)
|
||||
(~(put by inn.hup) u.lax ?~(hag 1 +(u.hag)))
|
||||
?~ nax out.hup
|
||||
=+ hag=(~(get by out.hup) u.nax)
|
||||
(~(put by out.hup) u.nax ?~(hag 1 +(u.hag)))
|
||||
==
|
||||
::
|
||||
++ pi-tell :: produce dump
|
||||
|= day=doss
|
||||
^- (list tape)
|
||||
;: welp
|
||||
[(welp "events: " (scow %ud sap.day)) ~]
|
||||
::
|
||||
%+ turn
|
||||
(~(tap by hit.day) ~)
|
||||
|= [nam=term num=@ud]
|
||||
:(welp (trip nam) ": " (scow %ud num))
|
||||
["" ~]
|
||||
::
|
||||
%- zing
|
||||
^- (list (list tape))
|
||||
%+ turn
|
||||
(~(tap by cut.day) ~)
|
||||
|= [nam=term hup=hump]
|
||||
;: welp
|
||||
[(welp "sector: " (trip nam)) ~]
|
||||
[(welp "weight: " (scow %ud (div (mul 1.000 sap.hup) sap.day))) ~]
|
||||
["inn:" ~]
|
||||
::
|
||||
%+ turn
|
||||
(~(tap by inn.hup) ~)
|
||||
|= [nam=term num=@ud]
|
||||
^- tape
|
||||
:(welp " " (trip nam) ": " (scow %ud num))
|
||||
::
|
||||
["out:" ~]
|
||||
::
|
||||
%+ turn
|
||||
(~(tap by out.hup) ~)
|
||||
|= [nam=term num=@ud]
|
||||
^- tape
|
||||
:(welp " " (trip nam) ": " (scow %ud num))
|
||||
==
|
||||
==
|
||||
--
|
||||
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:::::: :::::: volume 3, Arvo models and skeleton ::::::
|
||||
@ -9522,7 +9591,7 @@
|
||||
a ::
|
||||
== ::
|
||||
++ kirk (unit (set monk)) :: audience
|
||||
++ khan ,[p=@tas q=path] :: foreign identity
|
||||
++ khan ,[p=@tas q=@ta] :: foreign identity
|
||||
++ lens :: observation core
|
||||
$_ ^? ::
|
||||
|% ++ u *(unit (unit ,~)) :: existence
|
||||
@ -9723,6 +9792,7 @@
|
||||
bed=beam
|
||||
==
|
||||
^- (unit (unit cage))
|
||||
:: ~& [%arvo-scry ren bed]
|
||||
=+ ^= old
|
||||
:* fur
|
||||
ren
|
||||
@ -9903,6 +9973,7 @@
|
||||
:::::: :::::: Postface ::::::
|
||||
:::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
!:
|
||||
~& %post-start
|
||||
=+ pit=`vase`!>(.) ::
|
||||
=+ bud=pit :: becomes tang
|
||||
=+ vil=(viol p.bud) :: cached reflexives
|
||||
|
86
arvo/jael.hoon
Normal file
86
arvo/jael.hoon
Normal file
@ -0,0 +1,86 @@
|
||||
:: %jael, secret storage
|
||||
::
|
||||
:::: /hoon/jael
|
||||
::
|
||||
!? 164
|
||||
::::
|
||||
:: %jael is logically homogeneous, but please follow these conventions:
|
||||
::
|
||||
:: /cap :: foreign app keys
|
||||
:: /service :: service name, eg %face
|
||||
:: /appid :: your ship's app-id
|
||||
:: /@uvH :: by hash
|
||||
:: /@ud :: by number
|
||||
:: /@tas :: by name
|
||||
::
|
||||
:: /key :: foreign user secrets
|
||||
:: /service :: service name, eg %face
|
||||
:: /userid :: user identity
|
||||
::
|
||||
:: /urb :: urbit secrets
|
||||
:: /tok/hash
|
||||
|
||||
|= pit=vase
|
||||
=> =~
|
||||
:: structures
|
||||
|%
|
||||
++ axle :: %jael state
|
||||
$: %0 ::
|
||||
ent=@uwH :: entropy
|
||||
all=(map ship ,[p=@ q=safe]) :: entropy, secrets
|
||||
== ::
|
||||
++ mast $: ent=@
|
||||
|
||||
++ mort ,[p=@da q=duct r=@] :: a mortal secret
|
||||
++ gift :: out result <-$
|
||||
$% [%done p=path q=@] :: key expired
|
||||
== ::
|
||||
++ kiss :: in request ->$
|
||||
$% [%kill p=
|
||||
[%drop p=@p q=path r=@] :: discard key
|
||||
[%junk p=@] :: add entropy
|
||||
[%show p=@p q=path] :: read subtree
|
||||
[%tell p=@ q=path r=@da s=@] :: save key
|
||||
== ::
|
||||
++ safe ,[p=(unit ,@) q=(map ,@ta safe)] :: secret tree
|
||||
++ move ,[p=duct q=[%give p=gift]] :: local move
|
||||
-- ::
|
||||
. ==
|
||||
=| axle
|
||||
=* lex -
|
||||
|= [now=@da eny=@ ski=sled] :: activate
|
||||
^? :: opaque core
|
||||
|% ::
|
||||
++ call :: request
|
||||
|= [hen=duct hic=(hypo (hobo kiss))]
|
||||
^- [p=(list move) q=_..^$]
|
||||
=> .(q.hic ?.(?=(%soft -.q.hic) q.hic ((hard kiss) p.q.hic)))
|
||||
!!
|
||||
::
|
||||
++ doze
|
||||
|= [now=@da hen=duct]
|
||||
^- (unit ,@da)
|
||||
~
|
||||
::
|
||||
++ load :: highly forgiving
|
||||
|= old=*
|
||||
=+ lox=((soft axle) old)
|
||||
^+ ..^$
|
||||
?~ lox
|
||||
~& %jael-reset
|
||||
..^$
|
||||
..^$(+>- u.lox)
|
||||
::
|
||||
++ scry
|
||||
|= [fur=(unit (set monk)) ren=@tas who=ship syd=desk lot=coin tyl=path]
|
||||
^- (unit (unit (pair mark ,*)))
|
||||
:: actually scry
|
||||
~
|
||||
::
|
||||
++ stay :: save w/o cache
|
||||
`axle`+>-.$(pol (~(run by pol) |=(a=baby [tad.a dym.a ~])))
|
||||
::
|
||||
++ take :: response
|
||||
|= [tea=wire hen=duct hin=(hypo noun)]
|
||||
!!
|
||||
--
|
99
arvo/kahn.hoon
Normal file
99
arvo/kahn.hoon
Normal file
@ -0,0 +1,99 @@
|
||||
:: %kahn, social state
|
||||
::
|
||||
:::: /hoon/kahn
|
||||
::
|
||||
!? 164
|
||||
::::
|
||||
|= pit=vase
|
||||
=> =~
|
||||
:: structures
|
||||
|%
|
||||
++ axle :: %kahn state
|
||||
$: %0 ::
|
||||
big=(unit ship) :: main ship, freeze
|
||||
soc=(map monk node) :: state once big
|
||||
== ::
|
||||
++ cert (each will ,*) :: urbit or other
|
||||
++ gift :: out result <-$
|
||||
$: [%then p=node] :: propagate change
|
||||
== ::
|
||||
++ node :: social identity
|
||||
$: tin=(map monk link) :: inbound links
|
||||
oud=(map monk link) :: outbound links
|
||||
cet=cert :: certificate
|
||||
== ::
|
||||
++ kiss :: social update
|
||||
$: [%that p=monk q=(map monk link)] :: set links
|
||||
[%this p=monk q=cert] :: set certificate
|
||||
== ::
|
||||
++ link (pair rank ,@da) :: trust/expiration
|
||||
++ rank :: privilege ring
|
||||
$? %0 :: owner / admin
|
||||
%1 :: guardian / employer
|
||||
%2 :: partner / employee
|
||||
%3 :: friend / customer
|
||||
%4 :: neighbor/ contact
|
||||
%5 :: zombie
|
||||
== ::
|
||||
-- ::
|
||||
. ==
|
||||
=| axle
|
||||
=* lex -
|
||||
|= [now=@da eny=@ ski=sled] :: activate
|
||||
^? :: opaque core
|
||||
|% ::
|
||||
++ call :: request
|
||||
|= [hen=duct hic=(hypo (hobo kiss))]
|
||||
^- [p=(list move) q=_..^$]
|
||||
=> .(q.hic ?.(?=(%soft -.q.hic) q.hic ((hard kiss) p.q.hic)))
|
||||
!!
|
||||
::
|
||||
++ doze
|
||||
|= [now=@da hen=duct]
|
||||
^- (unit ,@da)
|
||||
~
|
||||
::
|
||||
++ load :: highly forgiving
|
||||
|= old=*
|
||||
=+ lox=((soft axle) old)
|
||||
^+ ..^$
|
||||
?~ lox
|
||||
~& %lunt-reset
|
||||
..^$
|
||||
..^$(+>- u.lox)
|
||||
::
|
||||
++ scry
|
||||
|= [fur=(unit (set monk)) ren=@tas who=ship syd=desk lot=coin tyl=path]
|
||||
^- (unit (unit (pair mark ,*)))
|
||||
?. =(big [~ who]) ~
|
||||
=+ ^= yub ^- [(unit monk)
|
||||
?: =(%urb syd)
|
||||
?. ?=([* ~] tyl) ~
|
||||
=+ goy=(slaw %p
|
||||
|
||||
?+ ?=([%$ %da @]
|
||||
?+ lot ~
|
||||
[%$ %ud @]
|
||||
%+ bind
|
||||
(perm who u.hun q.p.lot [syd t.tyl])
|
||||
|=(a=* [%noun a])
|
||||
::
|
||||
?. =(now q.p.lot) ~
|
||||
%+ bind
|
||||
(temp who u.hun [syd t.tyl])
|
||||
|=(a=* [%noun a])
|
||||
==
|
||||
?. ?=([%da
|
||||
=+ mok ^- (unit monk)
|
||||
?: =(%urb face)
|
||||
(
|
||||
|
||||
::
|
||||
++ stay :: save w/o cache
|
||||
`axle`+>-.$
|
||||
::
|
||||
++ take :: response
|
||||
|= [tea=wire hen=duct hin=(hypo noun)]
|
||||
!!
|
||||
--
|
||||
|
103
arvo/lunt.hoon
Normal file
103
arvo/lunt.hoon
Normal file
@ -0,0 +1,103 @@
|
||||
:: %lunt, fleet job control
|
||||
::
|
||||
:::: /hoon/lunt
|
||||
::
|
||||
!? 164
|
||||
::::
|
||||
|= pit=vase
|
||||
=> =~
|
||||
:: structures
|
||||
|%
|
||||
++ axle :: %lunt state
|
||||
$: %0 ::
|
||||
all=(map ship axil) :: state by owner
|
||||
== ::
|
||||
++ born ,[p=brat q=(unit ship)] :: task identity
|
||||
++ brat ,@ud :: task number
|
||||
++ bulb ::
|
||||
$: p=@p :: ship identity
|
||||
q=home :: server data
|
||||
== ::
|
||||
++ home :: storage access
|
||||
$: pad=@uvH :: passcode
|
||||
huc=husk :: log server
|
||||
sog=hulk :: storage server
|
||||
== ::
|
||||
++ hulk :: checkpoint service
|
||||
$% [%astr p=@ud q=@ud] :: S3
|
||||
== ::
|
||||
++ husk :: log server
|
||||
$: pro=@tas :: protocol
|
||||
cap=@uvH :: access code
|
||||
srv=(list (pair ,@ud clip)) :: server cluster
|
||||
== ::
|
||||
++ gift :: result
|
||||
$: [%die p=brat] :: kill
|
||||
[%int p=brat] :: interrupt
|
||||
[%run p=brat q=@p r=home] :: load
|
||||
[%say p=brat q=(list ovum)] :: send events
|
||||
[%new p=brat q=@p r=home s=(list ovum)] :: create
|
||||
== ::
|
||||
++ kiss :: request
|
||||
$: [%com p=@p] :: toggle compute svr
|
||||
[%end p=brat] :: local end
|
||||
[%fan p=@ud] :: set local fanout
|
||||
[%kil ~] :: terminate ship
|
||||
[%int ~] :: interrupt ship
|
||||
[%new p=@p q=(set ,@p) q=home r=@uvI] :: create ship
|
||||
[%run p=@p q=home] :: run existing ship
|
||||
[%say p=(list ovum)] :: remote events
|
||||
[%sto p=husk] :: toggle logger
|
||||
== ::
|
||||
++ axil ::
|
||||
$: bus=(unit ,@p) :: master
|
||||
loc=@ud :: local resources
|
||||
hen=(unit duct) :: effect duct
|
||||
ent=@ :: entropy
|
||||
seq=@ :: brat sequence
|
||||
why=(map duct born) :: hosted ships
|
||||
how=(map born duct) :: reverse why
|
||||
hut=(map born home) :: storage control
|
||||
sto=(set husk) :: storage resources
|
||||
com=(set ship) :: compute resources
|
||||
== ::
|
||||
-- ::
|
||||
. ==
|
||||
=| axle
|
||||
=* lex -
|
||||
|= [now=@da eny=@ ski=sled] :: activate
|
||||
^? :: opaque core
|
||||
|% ::
|
||||
++ call :: request
|
||||
|= [hen=duct hic=(hypo (hobo kiss))]
|
||||
^- [p=(list move) q=_..^$]
|
||||
=> .(q.hic ?.(?=(%soft -.q.hic) q.hic ((hard kiss) p.q.hic)))
|
||||
!!
|
||||
::
|
||||
++ doze
|
||||
|= [now=@da hen=duct]
|
||||
^- (unit ,@da)
|
||||
~
|
||||
::
|
||||
++ load :: highly forgiving
|
||||
|= old=*
|
||||
=+ lox=((soft axle) old)
|
||||
^+ ..^$
|
||||
?~ lox
|
||||
~& %lunt-reset
|
||||
..^$
|
||||
..^$(+>- u.lox)
|
||||
::
|
||||
++ scry
|
||||
|= [fur=(unit (set monk)) ren=@tas who=ship syd=desk lot=coin tyl=path]
|
||||
^- (unit (unit (pair mark ,*)))
|
||||
~
|
||||
::
|
||||
++ stay :: save w/o cache
|
||||
`axle`+>-.$
|
||||
::
|
||||
++ take :: response
|
||||
|= [tea=wire hen=duct hin=(hypo noun)]
|
||||
!!
|
||||
--
|
||||
|
94
arvo/musk.hoon
Normal file
94
arvo/musk.hoon
Normal file
@ -0,0 +1,94 @@
|
||||
:: %musk, realm management
|
||||
::
|
||||
:::: /hoon/musk
|
||||
::
|
||||
!? 164
|
||||
::::
|
||||
|= pit=vase
|
||||
=> =~
|
||||
:: structures
|
||||
|%
|
||||
++ axle :: %musk state
|
||||
$: %0 ::
|
||||
all=(map ship axil) :: state by owner
|
||||
== ::
|
||||
++ axil ::
|
||||
$: kid=(map ship girl) :: daughters
|
||||
deq=(map narc ship) :: reverse address
|
||||
siq=(map ship (list clan)) :: ship to clans
|
||||
kes=(map clan (list ship)) :: clan to ships
|
||||
== ::
|
||||
++ clan ,@tas :: group identity
|
||||
++ narc :: contact address
|
||||
$: [%$ p=ship] :: urbit
|
||||
[%m p=@t q=@t] :: email p@q
|
||||
[%f p=@t] :: facebook
|
||||
[%g p=@t] :: google
|
||||
[%p p=@t] :: phone message
|
||||
[%t p=@t] :: twitter
|
||||
== ::
|
||||
++ pony :: daughter status
|
||||
$% [%cold ~] :: virginal
|
||||
[%dead ~] :: written off
|
||||
[%fake ~] :: virtual
|
||||
[%free ~] :: downloaded
|
||||
[%here ~] :: hosted
|
||||
[%left p=(unit ship)] :: run away to
|
||||
== ::
|
||||
++ rank :: relative privilege
|
||||
$? %0 :: enemy
|
||||
%1 :: neighbor
|
||||
%2 :: guest/customer
|
||||
%3 :: friend/employee
|
||||
%4 :: officer/family
|
||||
%5 :: self/admin
|
||||
== ::
|
||||
++ girl ::
|
||||
$: hop=pony :: status
|
||||
tag=(unit ,@tas) :: petname
|
||||
tip=rank :: rank
|
||||
fig=(set narc) :: identities
|
||||
loc=(unit ,[p=@da q=@ud r=clip]) :: last position
|
||||
sym=(set ,[p=@ q=@uvH]) :: symmetric keys?
|
||||
wyl=will :: crypto will
|
||||
== ::
|
||||
-- ::
|
||||
. ==
|
||||
=| axle
|
||||
=* lex -
|
||||
|= [now=@da eny=@ ski=sled] :: activate
|
||||
^? :: opaque core
|
||||
|% ::
|
||||
++ call :: request
|
||||
|= [hen=duct hic=(hypo (hobo kiss))]
|
||||
^- [p=(list move) q=_..^$]
|
||||
=> .(q.hic ?.(?=(%soft -.q.hic) q.hic ((hard kiss) p.q.hic)))
|
||||
!!
|
||||
::
|
||||
++ doze
|
||||
|= [now=@da hen=duct]
|
||||
^- (unit ,@da)
|
||||
~
|
||||
::
|
||||
++ load :: highly forgiving
|
||||
|= old=*
|
||||
=+ lox=((soft axle) old)
|
||||
^+ ..^$
|
||||
?~ lox
|
||||
~& %lunt-reset
|
||||
..^$
|
||||
..^$(+>- u.lox)
|
||||
::
|
||||
++ scry
|
||||
|= [fur=(unit (set monk)) ren=@tas who=ship syd=desk lot=coin tyl=path]
|
||||
^- (unit (unit (pair mark ,*)))
|
||||
~
|
||||
::
|
||||
++ stay :: save w/o cache
|
||||
`axle`+>-.$
|
||||
::
|
||||
++ take :: response
|
||||
|= [tea=wire hen=duct hin=(hypo noun)]
|
||||
!!
|
||||
--
|
||||
|
@ -1,24 +0,0 @@
|
||||
?> ?=([@ @] .)
|
||||
%. .
|
||||
|= [x=@ y=@]
|
||||
=- (add:all x y)
|
||||
^= all
|
||||
=> %164
|
||||
~% %k164 ~ ~
|
||||
|%
|
||||
++ add
|
||||
~/ %add
|
||||
|= [a=@ b=@]
|
||||
^- @
|
||||
?: =(0 a) b
|
||||
$(a (dec a), b +(b))
|
||||
::
|
||||
++ dec
|
||||
~/ %dec
|
||||
|= a=@
|
||||
?< =(0 a)
|
||||
=+ b=0
|
||||
|- ^- @
|
||||
?: =(a +(b)) b
|
||||
$(b +(b))
|
||||
--
|
184
arvo/zuse.hoon
184
arvo/zuse.hoon
@ -41,7 +41,7 @@
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: section 3bB, cryptosuites ::
|
||||
::
|
||||
++ crua :: cryptosuite A (RSA)
|
||||
++ crua !: :: cryptosuite A (RSA)
|
||||
^- acru
|
||||
=| [mos=@ pon=(unit ,[p=@ q=@ r=[p=@ q=@] s=_*fu])]
|
||||
=> |%
|
||||
@ -1009,9 +1009,10 @@
|
||||
%indirect p.p
|
||||
==
|
||||
::
|
||||
++ ze
|
||||
++ ze !:
|
||||
|_ [lim=@da dome rang]
|
||||
++ aeon-to-tako ~(got by hit)
|
||||
++ aeon-to-yaki (cork aeon-to-tako tako-to-yaki)
|
||||
++ make-yaki :: make yaki
|
||||
|= [p=(list tako) q=(map path lobe) t=@da]
|
||||
^- yaki
|
||||
@ -1082,17 +1083,16 @@
|
||||
((diff (blob-to-umph (lobe-to-blob u.leb))) zeq zoq)
|
||||
::
|
||||
++ lobes-at-path :: lobes-at-path:ze
|
||||
|= [oan=aeon pax=path] :: data at path
|
||||
|= [yon=aeon pax=path] :: data at path
|
||||
^- (map path lobe)
|
||||
?: =(0 oan) ~
|
||||
?: =(0 yon) ~
|
||||
%- mo
|
||||
%+ skim
|
||||
%. ~
|
||||
%~ tap by
|
||||
=< q
|
||||
%- tako-to-yaki
|
||||
%- aeon-to-tako
|
||||
oan
|
||||
%- aeon-to-yaki
|
||||
yon
|
||||
|= [p=path q=lobe]
|
||||
?| ?=(~ pax)
|
||||
?& !?=(~ p)
|
||||
@ -1110,8 +1110,7 @@
|
||||
?: =(0 let) [~ 0] :: avoid underflow
|
||||
?: %+ gte p.lok
|
||||
=< t
|
||||
%- tako-to-yaki
|
||||
%- aeon-to-tako
|
||||
%- aeon-to-yaki
|
||||
let
|
||||
[~ let]
|
||||
$(let (dec let))
|
||||
@ -1221,11 +1220,11 @@
|
||||
==
|
||||
::
|
||||
++ rewind :: rewind:ze
|
||||
|= oan=aeon :: rewind to aeon
|
||||
|= yon=aeon :: rewind to aeon
|
||||
^+ +>
|
||||
?: =(let oan) +>
|
||||
?: (gth oan let) !! :: don't have version
|
||||
+>(ank (checkout-ankh q:(tako-to-yaki (aeon-to-tako oan))), let oan)
|
||||
?: =(let yon) +>
|
||||
?: (gth yon let) !! :: don't have version
|
||||
+>(ank (checkout-ankh q:(aeon-to-yaki yon)), let yon)
|
||||
::
|
||||
::::
|
||||
++ update-lat :: update-lat:ze
|
||||
@ -1245,16 +1244,15 @@
|
||||
?: =(let 0) :: initial commit
|
||||
~ :: has nothing
|
||||
=< q
|
||||
%- tako-to-yaki
|
||||
%- aeon-to-tako
|
||||
%- aeon-to-yaki
|
||||
let
|
||||
%- |= bar=(map path blob) :: find unchanged
|
||||
=+ sar=(sa (turn lar |=([p=path *] p))) :: changed paths
|
||||
%+ roll (~(tap by hat) ~)
|
||||
=- =+ sar=(sa (turn lar |=([p=path *] p))) :: changed paths
|
||||
%+ roll (~(tap by hat) ~) :: find unchanged
|
||||
|= [[pat=path gar=lobe] bat=_bar]
|
||||
?: (~(has in sar) pat) :: has update
|
||||
bat
|
||||
(~(put by bat) pat (lobe-to-blob gar)) :: use original
|
||||
^= bar ^- (map path blob)
|
||||
%+ roll lar
|
||||
|= [[pat=path mys=miso] bar=(map path blob)]
|
||||
^+ bar
|
||||
@ -1757,34 +1755,29 @@
|
||||
?^(r.mun ~ [~ let])
|
||||
?: ?=(%w p.mun)
|
||||
=+ ^= yak
|
||||
%- tako-to-yaki
|
||||
%- aeon-to-tako
|
||||
%- aeon-to-yaki
|
||||
let
|
||||
?^(r.mun ~ [~ [t.yak (forge-nori yak)]])
|
||||
::?> ?=(^ hit) ?^(r.mun ~ [~ i.hit]) :: what do?? need [@da nori]
|
||||
(query(ank ank:(descend-path:(zu ank) r.mun)) p.mun)
|
||||
::
|
||||
++ read-at-aeon :: read-at-aeon:ze
|
||||
|= [oan=aeon mun=mood] :: seek and read
|
||||
|= [yon=aeon mun=mood] :: seek and read
|
||||
^- (unit)
|
||||
?: &(?=(%w p.mun) !?=(%ud -.q.mun)) :: NB only for speed
|
||||
?^(r.mun ~ [~ oan])
|
||||
(read:(rewind oan) mun)
|
||||
?^(r.mun ~ [~ yon])
|
||||
(read:(rewind yon) mun)
|
||||
::
|
||||
++ equiv :: test paths
|
||||
|= [p=(map path lobe) q=(map path lobe)]
|
||||
^- ?
|
||||
%- |= qat=?
|
||||
?. qat %.n
|
||||
%+ roll (~(tap by q) ~)
|
||||
|= [[pat=path lob=lobe] eq=?]
|
||||
^- ?
|
||||
?. eq %.n
|
||||
=- ?. qat %.n
|
||||
%+ levy (~(tap by q) ~)
|
||||
|= [pat=path lob=lobe]
|
||||
(~(has by p) pat)
|
||||
%+ roll (~(tap by p) ~)
|
||||
|= [[pat=path lob=lobe] eq=?]
|
||||
^- ?
|
||||
?. eq %.n
|
||||
^= qat
|
||||
%+ levy (~(tap by p) ~)
|
||||
|= [pat=path lob=lobe]
|
||||
=+ zat=(~(get by q) pat)
|
||||
?~ zat %.n
|
||||
=((lobe-to-noun u.zat) (lobe-to-noun lob))
|
||||
@ -1793,16 +1786,14 @@
|
||||
|= [wen=@da lem=nori] :: edit
|
||||
^+ +>
|
||||
?- -.lem
|
||||
& =+ ^= yet
|
||||
& =^ yak lat :: merge objects
|
||||
%+ forge-yaki wen
|
||||
?: =(let 0) :: initial import
|
||||
[~ q.lem]
|
||||
[(some r:(tako-to-yaki (aeon-to-tako let))) q.lem]
|
||||
=+ yak=-.yet
|
||||
=. lat +.yet :: merge objects
|
||||
[(some r:(aeon-to-yaki let)) q.lem]
|
||||
?. ?| =(0 let)
|
||||
!=((lent p.yak) 1)
|
||||
!(equiv q.yak q:(tako-to-yaki (aeon-to-tako let)))
|
||||
!(equiv q.yak q:(aeon-to-yaki let))
|
||||
==
|
||||
+>.$ :: silently ignore
|
||||
=: let +(let)
|
||||
@ -1814,7 +1805,7 @@
|
||||
==
|
||||
--
|
||||
::
|
||||
++ zu :: filesystem
|
||||
++ zu !: :: filesystem
|
||||
|= ank=ankh :: filesystem state
|
||||
=| myz=(list ,[p=path q=miso]) :: changes in reverse
|
||||
=| ram=path :: reverse path into
|
||||
@ -2024,23 +2015,19 @@
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: section 3bG, URL handling ::
|
||||
::
|
||||
++ deft :: import url path
|
||||
++ deft :: parse url extension
|
||||
|= rax=(list ,@t)
|
||||
|- ^- pork
|
||||
?~ rax
|
||||
[~ ~]
|
||||
?~ t.rax
|
||||
=+ den=(trip i.rax)
|
||||
=+ ^= vex
|
||||
%- %- full
|
||||
;~(plug sym ;~(pose (stag ~ ;~(pfix dot sym)) (easy ~)))
|
||||
[[1 1] (trip i.rax)]
|
||||
?~ q.vex
|
||||
?^ t.rax
|
||||
[p.pok [i.rax q.pok]]:[pok=$(rax t.rax) .]
|
||||
=+ ^- raf=(unit ,[p=term q=(unit term)])
|
||||
%+ rush i.rax
|
||||
;~(plug sym ;~((bend) (easy ~) ;~(pfix dot sym)))
|
||||
?~ raf
|
||||
[~ [i.rax ~]]
|
||||
[+.p.u.q.vex [-.p.u.q.vex ~]]
|
||||
=+ pok=$(rax t.rax)
|
||||
:- p.pok
|
||||
[i.rax q.pok]
|
||||
[q.u.raf [p.u.raf ~]]
|
||||
::
|
||||
++ fain :: path restructure
|
||||
|= [hom=path raw=path]
|
||||
@ -2052,16 +2039,6 @@
|
||||
?> &(?=(^ mer) =(i.mer i.moh))
|
||||
$(mer t.mer, moh t.moh)
|
||||
::
|
||||
++ fest :: web synthesizer
|
||||
|= [hom=path raw=path]
|
||||
|* yax=$+(epic *)
|
||||
(yax (fuel (fain hom raw)))
|
||||
::
|
||||
++ folk :: silk construction
|
||||
|= [hom=path raw=path]
|
||||
|* yox=$+((pair beam path) *)
|
||||
(yox (fain hom raw))
|
||||
::
|
||||
++ fuel :: parse fcgi
|
||||
|= [bem=beam but=path]
|
||||
^- epic
|
||||
@ -2097,27 +2074,6 @@
|
||||
nyp
|
||||
==
|
||||
::
|
||||
++ gist :: convenient html
|
||||
|= [hom=path raw=path]
|
||||
|= yax=$+(epic marl)
|
||||
%- (fest hom raw)
|
||||
|= piq=epic
|
||||
^- manx
|
||||
=+ ^= sip :: skip blanks
|
||||
|= mal=marl
|
||||
?~(mal ~ ?.(|(=(:/(~) i.mal) =(:/([10 ~]) i.mal)) mal $(mal t.mal)))
|
||||
=+ zay=`marl`(yax piq)
|
||||
=. zay (sip zay)
|
||||
=+ ^= twa
|
||||
|- ^- [p=marl q=marl]
|
||||
?~ zay [~ ~]
|
||||
?: ?=([[[%head *] *] *] zay)
|
||||
[c.i.zay ?:(?=([[[%body *] *] ~] t.zay) c.i.t.zay t.zay)]
|
||||
?: ?=([[[%title *] *] *] zay)
|
||||
[[i.zay ~] t.zay]
|
||||
[~ zay]
|
||||
[/html [/head (sip p.twa)] [/body (sip q.twa)] ~]
|
||||
::
|
||||
++ sifo :: 64-bit encode
|
||||
|= tig=@
|
||||
^- tape
|
||||
@ -2126,13 +2082,12 @@
|
||||
=+ ^= cha
|
||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
|
||||
=+ ^= sif
|
||||
%- flop
|
||||
|- ^- tape
|
||||
?~ pad
|
||||
~
|
||||
=+ d=(end 0 6 pad)
|
||||
[(cut 3 [0 d] cha) $(pad (rsh 0 6 pad))]
|
||||
(weld (scag (sub (lent sif) poc) sif) (trip (fil 3 poc '=')))
|
||||
[(cut 3 [d 1] cha) $(pad (rsh 0 6 pad))]
|
||||
(weld (flop (slag poc sif)) (trip (fil 3 poc '=')))
|
||||
::
|
||||
++ urle :: URL encode
|
||||
|= tep=tape
|
||||
@ -2166,64 +2121,63 @@
|
||||
=+ nex=$(tep t.tep)
|
||||
?~(nex ~ [~ i.tep u.nex])
|
||||
::
|
||||
++ earl :: local purl to tape
|
||||
++ earl :: localize purl
|
||||
|= [who=@p pul=purl]
|
||||
^- purl
|
||||
pul(q.q [(rsh 3 1 (scot %p who)) q.q.pul])
|
||||
::
|
||||
++ earn :: purl to tape
|
||||
|= pul=purl
|
||||
|^ |= pul=purl
|
||||
^- tape
|
||||
=< apex
|
||||
|%
|
||||
++ apex
|
||||
^- tape
|
||||
:(weld head "/" body tail)
|
||||
:(weld (head p.pul) "/" (body q.pul) (tail r.pul))
|
||||
::
|
||||
++ body
|
||||
|- ^- tape
|
||||
?~ q.q.pul
|
||||
?~(p.q.pul ~ ['.' (trip u.p.q.pul)])
|
||||
=+ seg=(trip i.q.q.pul)
|
||||
?:(=(~ t.q.q.pul) seg (weld seg `tape`['/' $(q.q.pul t.q.q.pul)]))
|
||||
|= pok=pork ^- tape
|
||||
?~ q.pok ~
|
||||
|-
|
||||
=+ seg=(trip i.q.pok)
|
||||
?~ t.q.pok
|
||||
?~(p.pok seg (welp seg '.' (trip u.p.pok)))
|
||||
(welp seg '/' $(q.pok t.q.pok))
|
||||
::
|
||||
++ head
|
||||
|= har=hart
|
||||
^- tape
|
||||
;: weld
|
||||
?:(&(p.p.pul !=([& /localhost] r.p.pul)) "https://" "http://")
|
||||
?:(&(p.har !=([& /localhost] r.har)) "https://" "http://")
|
||||
::
|
||||
?- -.r.p.pul
|
||||
| (trip (rsh 3 1 (scot %if p.r.p.pul)))
|
||||
& =+ rit=(flop p.r.p.pul)
|
||||
?- -.r.har
|
||||
| (trip (rsh 3 1 (scot %if p.r.har)))
|
||||
& =+ rit=(flop p.r.har)
|
||||
|- ^- tape
|
||||
?~(rit ~ (weld (trip i.rit) ?~(t.rit "" `tape`['.' $(rit t.rit)])))
|
||||
==
|
||||
::
|
||||
?~(q.p.pul ~ `tape`[':' (trip (rsh 3 2 (scot %ui u.q.p.pul)))])
|
||||
?~(q.har ~ `tape`[':' (trip (rsh 3 2 (scot %ui u.q.har)))])
|
||||
==
|
||||
::
|
||||
++ tail
|
||||
|= kay=quay
|
||||
^- tape
|
||||
?: =(~ r.pul) ~
|
||||
?: =(~ kay) ~
|
||||
:- '?'
|
||||
|- ^- tape
|
||||
?~ r.pul ~
|
||||
?~ kay ~
|
||||
;: weld
|
||||
(trip p.i.r.pul)
|
||||
(urle (trip p.i.kay))
|
||||
"="
|
||||
(trip q.i.r.pul)
|
||||
?~(t.r.pul ~ `tape`['&' $(r.pul t.r.pul)])
|
||||
(urle (trip q.i.kay))
|
||||
?~(t.kay ~ `tape`['&' $(kay t.kay)])
|
||||
==
|
||||
--
|
||||
::
|
||||
++ epur :: url/header parser
|
||||
=< |=(a=cord (rush a apex))
|
||||
=< |=(a=cord (rush a auri))
|
||||
|%
|
||||
++ apat :: 2396 abs_path
|
||||
%+ cook deft
|
||||
(ifix [fas ;~(pose fas (easy ~))] (more fas smeg))
|
||||
++ apex auri
|
||||
++ auri
|
||||
++ auri :: 2396 URL
|
||||
%+ cook
|
||||
|= a=purl
|
||||
?.(=([& /localhost] r.p.a) a a(p.p &))
|
||||
@ -2250,13 +2204,7 @@
|
||||
++ fque (cook crip (plus pquo)) :: normal query field
|
||||
++ fquu (cook crip (star pquo)) :: optional field
|
||||
++ pcar ;~(pose pure pesc psub col pat) :: 2396 path char
|
||||
++ pcok ;~ pose :: cookie char
|
||||
(just `@`0x21)
|
||||
(shim 0x23 0x2b)
|
||||
(shim 0x2d 0x3a)
|
||||
(shim 0x3c 0x5b)
|
||||
(shim 0x5d 0x7e)
|
||||
==
|
||||
++ pcok ;~(less bas sem com doq prn) :: cookie char
|
||||
++ pesc ;~(pfix cen mes) :: 2396 escaped
|
||||
++ pold (cold ' ' (just '+')) :: old space code
|
||||
++ pque ;~(pose pcar fas wut) :: 3986 query char
|
||||
@ -2282,7 +2230,7 @@
|
||||
%+ cook |*(a=[* *] [+.a -.a])
|
||||
;~ plug
|
||||
thos
|
||||
;~(pose (stag ~ ;~(pfix col dim:ag)) (easy ~))
|
||||
;~((bend) (easy ~) ;~(pfix col dim:ag))
|
||||
==
|
||||
++ thos :: 2396 host, no local
|
||||
;~ plug
|
||||
|
20
main/bin/liquid.hoon
Normal file
20
main/bin/liquid.hoon
Normal file
@ -0,0 +1,20 @@
|
||||
!:
|
||||
:: /=main=/bin/liquid/hoon
|
||||
::
|
||||
=> .(- `[who=@p how=path]`-)
|
||||
|= [est=time eny=@uw]
|
||||
|= arg=*
|
||||
=+ ^= lok ^- case
|
||||
?: =(~ arg) [%da est]
|
||||
?> =(~ +.arg)
|
||||
((hard case) -.arg)
|
||||
=+ cav=(scot (dime lok))
|
||||
=+ top=`path`[(scot %p who) %arvo cav ~]
|
||||
=+ pax=`path`(weld top `path`[%hoon ~])
|
||||
~& %liquid-start
|
||||
=+ gen=(reck pax)
|
||||
~& %liquid-parsed
|
||||
=+ ken=q:(~(mint ut %noun) %noun gen)
|
||||
~& %liquid-compiled
|
||||
:_ ~ :_ ~
|
||||
[%xx %sage [%dummy %pill ~] [ken 0]]
|
@ -17,7 +17,9 @@
|
||||
=+ ken=q:(~(mint ut %noun) %noun gen)
|
||||
~& %solid-compiled
|
||||
=+ ^= all
|
||||
~& [%solid-ken `@ux`(mug ken)]
|
||||
=+ all=.*(0 ken)
|
||||
~& %solid-loaded
|
||||
=+ ^= vay ^- (list ,[p=@tas q=@tas])
|
||||
:~ [%$ %zuse]
|
||||
[%f %ford]
|
||||
|
@ -6,8 +6,9 @@
|
||||
::
|
||||
++ grow :: convert to
|
||||
|%
|
||||
++ mime [/text/html (taco own)] :: convert to %mime
|
||||
++ hymn ;div:(pre:"{(trip own)}") :: convert to %html
|
||||
++ mime [/text/hoon (taco own)] :: convert to %mime
|
||||
++ psal ;div:(pre:"{(trip own)}") :: convert to %html
|
||||
++ hymn ;html:(head:title:"Source" "+{psal}")
|
||||
--
|
||||
++ grab |% :: convert from
|
||||
++ noun ,@t :: clam from %noun
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -685,8 +685,8 @@ each in detail.
|
||||
These two kisses are nearly identical. At a high level, they apply changes to
|
||||
the filesystem. Whenever we add, remove, or edit a file, one of these cards is
|
||||
sent. The `p` is the ship whose filesystem we're trying to change, the `q` is
|
||||
the desk we're changing, and the `r` is the request change. For the format of
|
||||
the requested change, see the documentation for `++nori` above.
|
||||
the desk we're changing, and the `r` is the requested change. For the format
|
||||
of the requested change, see the documentation for `++nori` above.
|
||||
|
||||
When a file is changed in the unix filesystem, vere will send a `%into` kiss.
|
||||
This tells clay that the duct over which the kiss was sent is the duct that
|
||||
@ -1024,11 +1024,11 @@ which reads the requested data at the given revision.
|
||||
|
||||
```
|
||||
++ read-at-aeon :: read-at-aeon:ze
|
||||
|= [oan=aeon mun=mood] :: seek and read
|
||||
|= [yon=aeon mun=mood] :: seek and read
|
||||
^- (unit)
|
||||
?: &(?=(%w p.mun) !?=(%ud -.q.mun)) :: NB only for speed
|
||||
?^(r.mun ~ [~ oan])
|
||||
(read:(rewind oan) mun)
|
||||
?^(r.mun ~ [~ yon])
|
||||
(read:(rewind yon) mun)
|
||||
```
|
||||
|
||||
If we're requesting the revision number with a case other than by number, then
|
||||
@ -1038,11 +1038,11 @@ to get the requested information.
|
||||
|
||||
```
|
||||
++ rewind :: rewind:ze
|
||||
|= oan=aeon :: rewind to aeon
|
||||
|= yon=aeon :: rewind to aeon
|
||||
^+ +>
|
||||
?: =(let oan) +>
|
||||
?: (gth oan let) !! :: don't have version
|
||||
+>(ank (checkout-ankh q:(tako-to-yaki (aeon-to-tako oan))), let oan)
|
||||
?: =(let yon) +>
|
||||
?: (gth yon let) !! :: don't have version
|
||||
+>(ank (checkout-ankh q:(tako-to-yaki (aeon-to-tako yon))), let yon)
|
||||
```
|
||||
|
||||
If we're already at the requested version, we do nothing. If we're requesting
|
||||
@ -1490,9 +1490,9 @@ We call `++lobes-at-path:ze` to get the data at the particular path.
|
||||
|
||||
```
|
||||
++ lobes-at-path :: lobes-at-path:ze
|
||||
|= [oan=aeon pax=path] :: data at path
|
||||
|= [yon=aeon pax=path] :: data at path
|
||||
^- (map path lobe)
|
||||
?: =(0 oan) ~
|
||||
?: =(0 yon) ~
|
||||
%- mo
|
||||
%+ skim
|
||||
%. ~
|
||||
@ -1500,7 +1500,7 @@ We call `++lobes-at-path:ze` to get the data at the particular path.
|
||||
=< q
|
||||
%- tako-to-yaki
|
||||
%- aeon-to-tako
|
||||
oan
|
||||
yon
|
||||
|= [p=path q=lobe]
|
||||
?| ?=(~ pax)
|
||||
?& !?=(~ p)
|
||||
@ -2001,9 +2001,9 @@ subscription case.
|
||||
|
||||
```
|
||||
++ balk :: read and send
|
||||
|= [hen=duct oan=@ud mun=mood]
|
||||
|= [hen=duct yon=@ud mun=mood]
|
||||
^+ +>
|
||||
=+ vid=(~(read-at-aeon ze lim dom ran) oan mun)
|
||||
=+ vid=(~(read-at-aeon ze lim dom ran) yon mun)
|
||||
?~ vid (blub hen) (blab hen mun u.vid)
|
||||
```
|
||||
|
||||
@ -2035,3 +2035,397 @@ producing it if it has; else, we call `++blub` since no more data can be
|
||||
produced over this subscription.
|
||||
|
||||
This concludes our discussion of foreign requests.
|
||||
|
||||
Lifecycle of a Local Write
|
||||
--------------------------
|
||||
|
||||
There are two kisses that cause a local write: `%info` and `%into`. These are
|
||||
exactly identical except that `%into` resets the the sync duct in clay, so it
|
||||
ought only to be called from unix. Within arvo, we call `%info`.
|
||||
|
||||
Both are handled in `++call`.
|
||||
|
||||
```
|
||||
?(%info %into)
|
||||
?: =(%$ q.q.hic)
|
||||
?. ?=(%into -.q.hic) [~ ..^$]
|
||||
=+ yar=(need (~(get by fat.ruf) p.q.hic))
|
||||
[~ ..^$(fat.ruf (~(put by fat.ruf) p.q.hic yar(hez [~ hen])))]
|
||||
=^ mos ruf
|
||||
=+ une=(un p.q.hic now ruf)
|
||||
=+ ^= zat
|
||||
(exec:(di:wake:une q.q.hic) hen now r.q.hic)
|
||||
=+ zot=abet.zat
|
||||
:- -.zot
|
||||
=. une (pish:une q.q.hic +.zot ran.zat)
|
||||
abet:une(hez.yar ?.(=(%into -.q.hic) hez.yar.une [~ hen]))
|
||||
[mos ..^$]
|
||||
```
|
||||
|
||||
Recall that in the kiss (`q.hic`) the `p` is the ship whose filesystem we're
|
||||
trying to change, the `q` is the desk we're changing, and the `r` is the
|
||||
requested change.
|
||||
|
||||
If `q`, the desk name, is empty, then we don't make any actual changes to the
|
||||
filesystem. In the case of `%info`, we do nothing at all. For the `%into`
|
||||
kiss, we simply set the sync duct to the duct we received this kiss on. This
|
||||
allows us to set the sync duct without making a change to our filesystem.
|
||||
|
||||
Otherwise, we construct the core for a local ship with `++un` and for the local
|
||||
desk with `++di`, as described above. We then apply the change with
|
||||
`++exec:de`, which contains the meat of the write functionality. Afterward, we
|
||||
call `++abet:de` to resolve our changes to the desk and `++pish:un` and
|
||||
`++abet:un` to resolve our changes to the ship, as described above. Again, if
|
||||
this is a `%info` kiss, then we don't change the sync duct; else, we set it to
|
||||
the calling duct.
|
||||
|
||||
The interesting call here was, of course, `++exec:de`.
|
||||
|
||||
```
|
||||
++ exec :: change and update
|
||||
|= [hen=duct wen=@da lem=nori]
|
||||
^+ +>
|
||||
(echo:wake:(edit wen lem) hen wen lem)
|
||||
```
|
||||
|
||||
First, we call `++edit` to apply our changes, then we call `++wake` to push out
|
||||
any new updates to our subscribers. Finally, we call `++echo` to announce our
|
||||
changes to both unix and the terminal.
|
||||
|
||||
We have described `++wake` above, so we'll discuss `++edit` and `++echo` here.
|
||||
Since `++echo` is significantly simpler, we'll start with it.
|
||||
|
||||
```
|
||||
++ echo :: announce changes
|
||||
|= [hen=duct wen=@da lem=nori]
|
||||
^+ +>
|
||||
%= +>
|
||||
vag ?~(hez vag :_(vag [u.hez [%ergo who syd let.dom]]))
|
||||
yel
|
||||
=+ pre=`path`~[(scot %p for) syd (scot %ud let.dom)]
|
||||
?- -.lem
|
||||
| :_ yel
|
||||
[hen %note '=' %leaf :(weld (trip p.lem) " " (spud pre))]
|
||||
& |- ^+ yel
|
||||
?~ q.q.lem yel
|
||||
:_ $(q.q.lem t.q.q.lem)
|
||||
:- hen
|
||||
:+ %note
|
||||
?-(-.q.i.q.q.lem %del '-', %ins '+', %mut ':')
|
||||
[%leaf (spud (weld pre p.i.q.q.lem))]
|
||||
==
|
||||
==
|
||||
```
|
||||
|
||||
If we have a sync duct, then we push out a `%ergo` gift along it so that unix
|
||||
knows there has been a change to the filesystem and can update the copy on the
|
||||
unix filesystem.
|
||||
|
||||
Additionally, we push out a `%note` gift to the terminal duct to display the
|
||||
new changes to the user. This is responsible for the printed lines we see when
|
||||
a file is added, removed, or modified.
|
||||
|
||||
It remains to discuss `++edit:de`.
|
||||
|
||||
```
|
||||
++ edit :: apply changes
|
||||
|= [wen=@da lem=nori]
|
||||
^+ +>
|
||||
=+ axe=(~(edit ze lim dom ran) wen lem)
|
||||
=+ `[l=@da d=dome r=rang]`+<.axe
|
||||
+>.$(dom d, ran r)
|
||||
```
|
||||
|
||||
We very simply call `++edit:ze` and apply the resultant dome and rang back into
|
||||
ourself. As we should expect, the actual handling of the changes themselves
|
||||
is delegated to `++ze` in `arvo/zuse.hoon`.
|
||||
|
||||
```
|
||||
++ edit :: edit:ze
|
||||
|= [wen=@da lem=nori] :: edit
|
||||
^+ +>
|
||||
?- -.lem
|
||||
& =^ yak lat :: merge objects
|
||||
%+ forge-yaki wen
|
||||
?: =(let 0) :: initial import
|
||||
[~ q.lem]
|
||||
[(some r:(aeon-to-yaki let)) q.lem]
|
||||
?. ?| =(0 let)
|
||||
!=((lent p.yak) 1)
|
||||
!(equiv q.yak q:(aeon-to-yaki let))
|
||||
==
|
||||
+>.$ :: silently ignore
|
||||
=: let +(let)
|
||||
hit (~(put by hit) +(let) r.yak)
|
||||
hut (~(put by hut) r.yak yak)
|
||||
==
|
||||
+>.$(ank (checkout-ankh q.yak))
|
||||
| +>.$(lab ?<((~(has by lab) p.lem) (~(put by lab) p.lem let)))
|
||||
==
|
||||
```
|
||||
|
||||
Two kinds of changes may be made to a filesystem: we can modify the contents
|
||||
or we can label a revision.
|
||||
|
||||
Labeling a revision (the `|` case) is much simpler. We first assert that the
|
||||
label doesn't already exist. Then, we put in `lab` in our dome the label
|
||||
associated with the current revision number.
|
||||
|
||||
In the `&` case, we're actually modifying the contents of the filesystem.
|
||||
First, we create the commit in `++forge-yaki` by applying the given changes to
|
||||
our current revision. This also updates `lat` in our rang with the new data
|
||||
objects.
|
||||
|
||||
Unless either this is the initial import, the generated yaki doesn't have
|
||||
exactly one parent, or the data in the generated yaki is the same as that in
|
||||
our current revision, we silently ignore the request. Note that this only
|
||||
allows changes that don't affect the contents of the filesystem if this is a
|
||||
merge.
|
||||
|
||||
If one of the conditions does hold, then we apply the generated commit. We
|
||||
increment `let`, the revision number of our head; associate the new revision
|
||||
number with the hash of the new commit; and put the new commit in `hut`.
|
||||
Finally, we update our current ankh by checking out the new commit.
|
||||
|
||||
We discussed `++checkout-ankh` above, so it remains only to discuss
|
||||
`++forge-yaki` and `++equiv`. We begin with the simpler, `++equiv:ze`.
|
||||
|
||||
```
|
||||
++ equiv :: test paths
|
||||
|= [p=(map path lobe) q=(map path lobe)]
|
||||
^- ?
|
||||
=- ?. qat %.n
|
||||
%+ levy (~(tap by q) ~)
|
||||
|= [pat=path lob=lobe]
|
||||
(~(has by p) pat)
|
||||
^= qat
|
||||
%+ levy (~(tap by p) ~)
|
||||
|= [pat=path lob=lobe]
|
||||
=+ zat=(~(get by q) pat)
|
||||
?~ zat %.n
|
||||
=((lobe-to-noun u.zat) (lobe-to-noun lob))
|
||||
```
|
||||
|
||||
We're checking to see if the data in both filesystem trees is identical. We
|
||||
start by going through `p` and checking to see if (1) the path exists in `q`
|
||||
and (2) the data is the same as in `q`.
|
||||
|
||||
This shows that `q` is a superset of `p`. To show that `p` and `q` are
|
||||
equivalent, we have to make sure there is nothing in `q` that is not also in
|
||||
`p`. Once we've done that, we know `p` and `q` are equivalent.
|
||||
|
||||
```
|
||||
++ forge-yaki :: forge-yaki:ze
|
||||
|= [wen=@da par=(unit tako) lem=soba] :: forge yaki
|
||||
=+ ^= per
|
||||
?~ par ~
|
||||
~[u.par]
|
||||
=+ gar=(update-lat (apply-changes q.lem) lat)
|
||||
:- %^ make-yaki per +.gar wen :: from existing diff
|
||||
-.gar :: fix lat
|
||||
```
|
||||
|
||||
Here, we first make `per`, our list of parents. If we have a parent, we put it
|
||||
in the list, else the list is empty. Simple.
|
||||
|
||||
We then apply the changes and update `lat`, our object store. Finally, we make
|
||||
a yaki out of the generated change information and produce both it and the new
|
||||
object store.
|
||||
|
||||
In increasing order of complexity, the new arms here are `++make-yaki`,
|
||||
`++update-lat`, and `++apply-changes`.
|
||||
|
||||
```
|
||||
++ make-yaki :: make yaki
|
||||
|= [p=(list tako) q=(map path lobe) t=@da]
|
||||
^- yaki
|
||||
=+ ^= has
|
||||
%^ cat 7 (sham [%yaki (roll p add) q t])
|
||||
(sham [%tako (roll p add) q t])
|
||||
[p q has t]
|
||||
```
|
||||
|
||||
We're given almost everything we need to make a yaki, so we just need to
|
||||
generate the hash of the new yaki. We take a noun hash of a noun that depends
|
||||
on the hashes of the parents, the data at this commit, and the date of the
|
||||
commit. Note that this means two identical changes made on the same parents at
|
||||
different times will have different hashes.
|
||||
|
||||
```
|
||||
++ update-lat :: update-lat:ze
|
||||
|= [lag=(map path blob) sta=(map lobe blob)] :: fix lat
|
||||
^- [(map lobe blob) (map path lobe)]
|
||||
%+ roll (~(tap by lag) ~)
|
||||
|= [[pat=path bar=blob] [lut=_sta gar=(map path lobe)]]
|
||||
?~ (~(has by lut) p.bar)
|
||||
[lut (~(put by gar) pat p.bar)]
|
||||
:- (~(put by lut) p.bar bar)
|
||||
(~(put by gar) pat p.bar)
|
||||
```
|
||||
|
||||
We're given a map of paths directly to their contents, but we wish to have both
|
||||
a map from paths to hashes of their contents and a map from hashes to the
|
||||
content itself. We're given an initial map of the second kind, but when
|
||||
applying the changes, we may add new content which is not yet stored here.
|
||||
|
||||
We roll over the given map from paths to data and, if the data is already in
|
||||
our store, then we simply add a reference to the hash in the map from paths to
|
||||
hashes. Otherwise, we also have to add the entry in the map from hashes to
|
||||
data.
|
||||
|
||||
```
|
||||
++ apply-changes :: apply-changes:ze
|
||||
|= lar=(list ,[p=path q=miso]) :: store changes
|
||||
^- (map path blob)
|
||||
=+ ^= hat :: current state
|
||||
?: =(let 0) :: initial commit
|
||||
~ :: has nothing
|
||||
=< q
|
||||
%- aeon-to-yaki
|
||||
let
|
||||
=- =+ sar=(sa (turn lar |=([p=path *] p))) :: changed paths
|
||||
%+ roll (~(tap by hat) ~) :: find unchanged
|
||||
|= [[pat=path gar=lobe] bat=_bar]
|
||||
?: (~(has in sar) pat) :: has update
|
||||
bat
|
||||
(~(put by bat) pat (lobe-to-blob gar)) :: use original
|
||||
^= bar ^- (map path blob)
|
||||
%+ roll lar
|
||||
|= [[pat=path mys=miso] bar=(map path blob)]
|
||||
^+ bar
|
||||
?- -.mys
|
||||
%ins :: insert if not exist
|
||||
?: (~(has by bar) pat) !! ::
|
||||
?: (~(has by hat) pat) !! ::
|
||||
(~(put by bar) pat (make-direct p.mys %c)) :: TODO content type?
|
||||
%del :: delete if exists
|
||||
?. |((~(has by hat) pat) (~(has by bar) pat)) !!
|
||||
(~(del by bar) pat)
|
||||
%mut :: mutate, must exist
|
||||
=+ ber=(~(get by bar) pat)
|
||||
?~ ber
|
||||
=+ har=(~(get by hat) pat)
|
||||
?~ har !!
|
||||
%+ ~(put by bar) pat
|
||||
(make-delta u.har p.mys)
|
||||
%+ ~(put by bar) pat
|
||||
(make-delta p.u.ber p.mys)
|
||||
==
|
||||
```
|
||||
|
||||
We let `hat` be the state of our head. We let `bar` be the new state of
|
||||
the files we touch in our changes, and then we add in the unchanged files.
|
||||
|
||||
To compute `bar`, we go through each change, handling each one individually.
|
||||
If the change is an insert, then we first assert that the file doesn't already
|
||||
exist and that we haven't already added it in this changeset. Note that this
|
||||
means it is impossible to delete a file and then insert it again in the same
|
||||
changeset. If this is indeed a new file, then put the path into `bar`,
|
||||
associated with its data blob, as calculated by `++make-direct`.
|
||||
|
||||
```
|
||||
++ make-direct :: make blob
|
||||
|= [p=* q=umph]
|
||||
^- blob
|
||||
[%direct (mug p) p q]
|
||||
```
|
||||
|
||||
We're given everything we need to create a `%direct` blob except the hash,
|
||||
which we calculate as the simple mug of the file contents.
|
||||
|
||||
In the case of a delete, we first assert that the file exists in either the
|
||||
current head or our new changes. Note that it is possible to insert a file and
|
||||
then delete it in the same changeset. If the file does exist, then we remove
|
||||
it from `bar`.
|
||||
|
||||
Finally, in the case of a mutation, we try to get the current state of the file
|
||||
from our new changes in `bar`. If it's not there, then we assert that the file
|
||||
exists in our current head (it must, after all, if we're changing it), and we
|
||||
make a `%delta` blob out of the difference between the old contents and the new
|
||||
contents. If the file is in `bar`, then make the `%delta` blob as a change
|
||||
from from the contents already in `bar` to the new contents. This means it is
|
||||
possible to have multiple mutations to a file in the same changeset.
|
||||
|
||||
After we've computed the contents of modified files, we must add all the
|
||||
unmodified files. We might naively suppose that `(~(uni by hat) bar)` would do
|
||||
this, but this would add back all the deleted files. To get around this, we
|
||||
let `sar` be the changed files, and then we simply roll over the files at our
|
||||
current head, adding everything that isn't in `sar`.
|
||||
|
||||
This concludes our discussion of a local write.
|
||||
|
||||
Lifecycle of a Local Merge
|
||||
--------------------------
|
||||
|
||||
Merges are pretty simple from the perspective of clay. A `%merg` kiss is sent
|
||||
with already-generated merge state, and we simply apply the new state. The
|
||||
question of how the merge is generated is much more complicated, but it is also
|
||||
out of the scope of this section. If you're interested, take a look at
|
||||
`++construct-merge:ze`.
|
||||
|
||||
We've seen most of the arms involved, so we'll go through most of it pretty
|
||||
quickly. In `++call` we handle the `%merg` kiss.
|
||||
|
||||
```
|
||||
%merg :: direct state up
|
||||
=^ mos ruf
|
||||
=+ une=(un p.q.hic now ruf)
|
||||
=+ ^= zat
|
||||
(exem:(di:wake:une q.q.hic) hen now r.q.hic)
|
||||
=+ zot=abet.zat
|
||||
:- -.zot
|
||||
=. une (pish:une q.q.hic +.zot ran.zat)
|
||||
abet:une(hez.yar ?.(=(%into -.q.hic) hez.yar.une [~ hen]))
|
||||
[mos ..^$]
|
||||
```
|
||||
|
||||
As we've seen several times before, we set up a core for the local ship with
|
||||
`++un`. We set up a core for the local desk with `++di` and updating our
|
||||
subscribers with `++wake`. We call `++exem` to execute the merge. `++abet:de`,
|
||||
`++pish:un` and `++abet:un` resolve all our changes.
|
||||
|
||||
The only new arm here is `++exem:de`.
|
||||
|
||||
```
|
||||
++ exem :: execute merge
|
||||
|= [hen=duct wen=@da mer=mizu] :: aka direct change
|
||||
?. (gte p.mer let.dom) !! :: no
|
||||
=. +>.$ %= +>.$
|
||||
hut.ran (~(uni by hut.r.mer) hut.ran)
|
||||
lat.ran (~(uni by lat.r.mer) lat.ran)
|
||||
let.dom p.mer
|
||||
hit.dom (~(uni by q.mer) hit.dom)
|
||||
==
|
||||
=+ ^= hed :: head commit
|
||||
=< q
|
||||
%- ~(got by hut.ran)
|
||||
%- ~(got by hit.dom)
|
||||
let.dom
|
||||
=. ank.dom :: real checkout
|
||||
(~(checkout-ankh ze lim dom ran) hed)
|
||||
(echa:wake hen wen mer) :: notify or w/e
|
||||
```
|
||||
|
||||
We first do a quick sanity check that the head of the merge data is greater
|
||||
than the head of the old data. Merges must add at least one revision.
|
||||
|
||||
We merge the new data in the obvious way. We do map merges for `hut` and `lat`
|
||||
in rang to get all the new data and commits, we do a map merge in`hit` in our
|
||||
dome to get all the new revision numbers, and we update our head to the most
|
||||
recent revision.
|
||||
|
||||
Then, we checkout the commit at our head and announce the results to unix.
|
||||
`++echa` is the only new arm here.
|
||||
|
||||
```
|
||||
++ echa :: announce raw
|
||||
|= [hen=duct wen=@da mer=mizu]
|
||||
^+ +>
|
||||
%= +>
|
||||
vag ?~(hez vag :_(vag [u.hez [%ergo who syd let.dom]]))
|
||||
==
|
||||
```
|
||||
|
||||
If we have a sync duct, we tell unix that a new revision is available.
|
||||
|
||||
This concludes our discussion of a local merge.
|
||||
|
84
try/bin/profile.hoon
Normal file
84
try/bin/profile.hoon
Normal file
@ -0,0 +1,84 @@
|
||||
|%
|
||||
++ doss
|
||||
$: sap=,@ud :: sample count
|
||||
hit=(map term ,@ud) :: hit points
|
||||
cut=(map span hump) :: cut points
|
||||
==
|
||||
::
|
||||
++ hump
|
||||
$: sap=,@ud :: sample count
|
||||
inn=(map span ,@ud) :: calls into
|
||||
out=(map span ,@ud) :: calls out of
|
||||
==
|
||||
::
|
||||
++ pi
|
||||
|_ day=doss
|
||||
++ heck :: report event
|
||||
|= [nam=@tas day=doss]
|
||||
^- day
|
||||
=+ lam=(~(get by hit.day) nam)
|
||||
day(hit (~(put by hit.day) ?~(lam 1 +(u.lam))))
|
||||
::
|
||||
++ noon :: sample trace
|
||||
|= pax=path
|
||||
=| lax=(unit span)
|
||||
|- ^- day
|
||||
?~ pax day(sap +(sap.day))
|
||||
%= $
|
||||
pax t.pax
|
||||
lax `i.pax
|
||||
cut.day
|
||||
%+ ~(put by cut.day) i.pax
|
||||
^- hump
|
||||
=+ nax=`(unit span)`?~(t.pax ~ `i.t.pax)
|
||||
=+ hup=`hump`=+(hup=(~(get by cut) i.pax) ?^(hup u.hup [0 ~ ~]))
|
||||
:+ +(sap.hup)
|
||||
?~ lax inn.hup
|
||||
=+(hag=(~(get by inn.hup) u.lax) ?~(hag 1 +(u.hag)))
|
||||
?~ nax out.hup
|
||||
=+(hag=(~(get by out.hup) u.nax) ?~(hag 1 +(u.hag)))
|
||||
==
|
||||
::
|
||||
++ tell :: produce dump
|
||||
^- (list tape)
|
||||
;: welp
|
||||
^- (list tape)
|
||||
[(welp "events: " (scow %ud sap.day)) ~]
|
||||
::
|
||||
^- (list tape)
|
||||
%+ turn
|
||||
(~(tap by hit.day) ~)
|
||||
|= [nam=term num=@ud]
|
||||
:(welp (trip nam) ": " (scow %ud num))
|
||||
["" ~]
|
||||
::
|
||||
^- (list tape)
|
||||
%- welp
|
||||
%+ turn
|
||||
(~(tap by cut.day) ~)
|
||||
|= [nam=term hup=hump]
|
||||
^- (list tape)
|
||||
;: welp
|
||||
[(welp "sector: " (trip nam)) ~]
|
||||
::
|
||||
[(welp "weight: " (div (mul 1.000 sap.hup) sap.day)) ~]
|
||||
::
|
||||
["inn:" ~]
|
||||
::
|
||||
%+ turn
|
||||
(~(tap by inn.hup) ~)
|
||||
|= [nam=term num=@ud]
|
||||
^- tape
|
||||
:(welp " " (trip nam) ": " (scow %ud num))
|
||||
::
|
||||
["out:" ~]
|
||||
::
|
||||
%+ turn
|
||||
(~(tap by out.hup) ~)
|
||||
|= [nam=term num=@ud]
|
||||
^- tape
|
||||
:(welp " " (trip nam) ": " (scow %ud num))
|
||||
==
|
||||
==
|
||||
--
|
||||
--
|
@ -1,6 +1,34 @@
|
||||
!:
|
||||
:: Some uses of template syntax
|
||||
::
|
||||
=> |% :: no longer in %zuse
|
||||
++ fest :: web synthesizer
|
||||
|= [hom=path raw=path]
|
||||
|* yax=$+(epic *)
|
||||
(yax (fuel (fain hom raw)))
|
||||
::
|
||||
++ gist :: convenient html
|
||||
|= [hom=path raw=path]
|
||||
|= yax=$+(epic marl)
|
||||
%- (fest hom raw)
|
||||
|= piq=epic
|
||||
^- manx
|
||||
=+ ^= sip :: skip blanks
|
||||
|= mal=marl
|
||||
?~(mal ~ ?.(|(=(:/(~) i.mal) =(:/([10 ~]) i.mal)) mal $(mal t.mal)))
|
||||
=+ zay=`marl`(yax piq)
|
||||
=. zay (sip zay)
|
||||
=+ ^= twa
|
||||
|- ^- [p=marl q=marl]
|
||||
?~ zay [~ ~]
|
||||
?: ?=([[[%head *] *] *] zay)
|
||||
[c.i.zay ?:(?=([[[%body *] *] ~] t.zay) c.i.t.zay t.zay)]
|
||||
?: ?=([[[%title *] *] *] zay)
|
||||
[[i.zay ~] t.zay]
|
||||
[~ zay]
|
||||
[/html [/head (sip p.twa)] [/body (sip q.twa)] ~]
|
||||
::
|
||||
--
|
||||
%- gist
|
||||
|= epic
|
||||
^- marl
|
||||
|
Loading…
Reference in New Issue
Block a user