Tribune: directory copy
tribune_copy_plus.ml
copies Plebeia context to its own by applying diffs between Plebeia commits. Directory copies are not detected therefore copies must be implemented adding lots of elements.
In Tezos node, directory copies are apparent, therefore Tribune can copy its "directory" to another directly more efficiently, not depending Plebeia diffs.
Very rough idea:
Internal node n
k1 k2 .. ki-1 ki ki+1 ..
s1 s2 s3 .. si-1 si si+1 si+2 ..
If the entire contents of this internal node is copied, we first make s'i
, copies of si
, then create a node with new keys k'i
:
Internal node n'
k'1 k'2 .. k'i-1 k'i k'i+1 ..
s'1 s'2 s'3 .. s'i-1 s'i s'i+1 s'i+2 ..
This new node must be inserted to the destination. Since the destination directory MUST NOT exist in the original tree, its insertion should not incur a complex node merge:
Around the destination:
ka kb kc kd
sa sb sc sd se <- the same depth as n
ka kb /\ kc kd
sa sb /__\ sd se
where the triangle is a split of n'
Edited by Jun Furuse