Moving to a delta model for pedigree merges.

This commit is contained in:
C. Guy Yarvin 2016-09-08 17:41:02 -07:00
parent bc0a56475e
commit 8a69e1fff2
2 changed files with 74 additions and 53 deletions

View File

@ -104,6 +104,14 @@
{$ping $~} :: ping {$ping $~} :: ping
{$seed p/gree} :: propagate {$seed p/gree} :: propagate
== :: == ::
++ jael-action :: pki change
$: why/?($hear $make) :: &=import, |=export
gut/(list jael-change) :: new information
== ::
++ jael-change :: pki delta
$% {$step p/ship q/life r/lace} :: new deed
{$sure p/ship q/life r/mind s/@} :: new signature
== ::
++ jael-effect :: propagation effect ++ jael-effect :: propagation effect
$% {$cold p/ship q/life} :: breach to life $% {$cold p/ship q/life} :: breach to life
{$helo p/ship} :: intro neighbor {$helo p/ship} :: intro neighbor
@ -113,19 +121,19 @@
{$warm p/ship q/life} :: advance to life {$warm p/ship q/life} :: advance to life
{$yell p/gree} :: propagate {$yell p/gree} :: propagate
== :: == ::
++ mile
$
++ meet :: merge worlds ++ meet :: merge worlds
|= {via/@p new/gree old/gree} |= {via/@p new/gree old/gree}
^- (pair (list jael-effect) gree) ^- (list jael-action)
=+ wen=(~(tap by new)) |^ =+ wen=(~(tap by new))
|^ ^- (pair (list jael-effect) gree) |- ^- (list jael-action)
?~ wen [~ old] ?~ wen ~
=+ mor=$(wen t.wen) (weld (boat i.wen) $(wen t.wen))
=+ dis=(boat i.wen)
[(weld p.dis p.mor) (~(put by q.mor) p.i.wen q.dis)]
:: :: :: ::
++ boat :: merge per ship ++ boat :: merge per ship
|= {who/ship gur/grue} |= {who/ship gur/grue}
^- (pair (list jael-effect) grue) ^- (list jael-action)
=+ rug=((bond |.(*grue)) (~(get by old) who)) =+ rug=((bond |.(*grue)) (~(get by old) who))
?: =(gur rug) [~ rug] ?: =(gur rug) [~ rug]
=+ :* num=1 =+ :* num=1
@ -158,9 +166,23 @@
?> ?=(^ lod) ?> ?=(^ lod)
[fex u.lod]] [fex u.lod]]
:: ::
:: if we have an old deed at this life, merge them :: hash new data and check parent validity
:: ::
=+ ash=(sham dat.u.wan) =+ ash=(sham dat.u.wan)
=+ def=(sein who)
=+ mir=(clan who)
?> ?: |(=(num 1) =(%earl mir) =(%pawn mir))
::
:: comets and moons must stay with default parent
::
=(def dad.dat.u.wan)
::
:: other ships may migrate to parent of same rank
::
=((clan def) (clan dad.dat.u.wan))
::
:: if we have an old deed at this life, merge them
::
?: ?=(^ lod) ?: ?=(^ lod)
:: ::
:: deed data must be identical :: deed data must be identical
@ -188,38 +210,47 @@
u.lod (~(put by u.lod) p.i.sow [q r]:i.sow) u.lod (~(put by u.lod) p.i.sow [q r]:i.sow)
== ==
:: ::
:: new deed, if for an existing ship :: non-initial deeds must be signed by previous
:: ::
?. =(1 num) ?> ?| ?=($~ pre)
?> ?=(^ pre) =+ laz=(~(got by syg.u.wan) who)
:: ?> =(p.laz (dec num))
:: check that the previous deed has signed this one =(ash (need (sure:as:(com:nu:crub pub.dat.u.pre) *code q.laz)))
:: ==
=+ laz=(~(got by syg.u.wan) who)
?> =(p.laz (dec num))
?> =(ash (need (sure:as:(com:nu:crub pub.dat.u.pre) *code q.laz)))
::
:: check the parent has signed, if necessary
::
?> ?| ::
:: no parent signature if parent is unchanged, not a moon
::
?& (=(dad.dat.u.pre dad.dat.u.wan)
!=(%earl (clan who))
==
::
:: no parent signature if we got this deed from the parent
::
=(via dad.dat.u.wan)
::
:: valid parent signature required
::
=+ par=(~(got by syg.u.wan) dad.dat.u.wan)
(good [dad.dat.u.wan p.par] ash q.par)
==
u.wan
:: ::
:: new deed for new ship :: check the parent has signed, if necessary
::
?> ?| ::
:: no parent signature for existing, non-moon urbits
::
?& ?=(^ pre)
=(dad.dat.u.pre dad.dat.u.wan)
!=(%earl mir)
==
::
:: public keys for galaxies are hardcoded
::
?& =(%czar mir)
?=(~ pre)
=(pub.dat.u.wan (zeno who))
==
::
:: no parent signature if we got this deed from the parent
::
=(via dad.dat.u.wan)
::
:: valid parent signature required
::
=+ par=(~(got by syg.u.wan) dad.dat.u.wan)
(good [dad.dat.u.wan p.par] ash q.par)
==
::
:: if we don't need to add a signature, report the new deed
::
?. =(~ (~(get by syg.u.wan) dad.dat.u.wan))
[
::
:: new deed for a new ship
:: ::
?: (lth who 256) ?: (lth who 256)
:: ::
@ -231,19 +262,8 @@
:: ::
?> =(dad.dat.u.wan (sein who)) ?> =(dad.dat.u.wan (sein who))
?> ?| =(via dad.dat.u.wan) ?> ?| =(via dad.dat.u.wan)
=+ par=
== ==
:: if there is an old deed
::
?^ lod
::
:: merge old and new
::
=^ wax ^- lama
?^ lod
::
:: :: :: ::
++ look :: get public key ++ look :: get public key

View File

@ -3041,11 +3041,11 @@
|= who/ship ^- ship |= who/ship ^- ship
=+ mir=(clan who) =+ mir=(clan who)
?- mir ?- mir
$czar who $czar ~zod
$king (end 3 1 who) $king (end 3 1 who)
$duke (end 4 1 who) $duke (end 4 1 who)
$earl (end 5 1 who) $earl (end 5 1 who)
$pawn `@p`0 $pawn (end 4 1 who)
== ==
:: ::
++ team :: our / our moon ++ team :: our / our moon
@ -3646,6 +3646,7 @@
$had :: handle $had :: handle
$mid :: middle name $mid :: middle name
== :: == ::
++ grit ::
++ gree (map ship grue) :: pki dump set ++ gree (map ship grue) :: pki dump set
++ grue (pair life (map life lace)) :: certificate ++ grue (pair life (map life lace)) :: certificate
++ mind {lyf/@ud who/@p} :: key identifier ++ mind {lyf/@ud who/@p} :: key identifier