From 72efd398cf14ecfb9ddd44615023278a26ad03dd Mon Sep 17 00:00:00 2001 From: Termina1 Date: Wed, 4 Dec 2024 19:57:18 +0200 Subject: [PATCH] remove extra implementation of Mdelta2 --- rdx/ELM.go | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/rdx/ELM.go b/rdx/ELM.go index b32f06f..9835102 100644 --- a/rdx/ELM.go +++ b/rdx/ELM.go @@ -486,27 +486,8 @@ func Mdelta2(tlv []byte, changes []byte) (tlv_delta []byte) { return } -// produce an op that turns the old value into the new one func MdeltaTR(tlv []byte, changes MapTR, clock Clock) (tlv_delta []byte) { - it := MIterator{Val: FIRSTIterator{TLV: tlv}} - for it.Next() { - if it.Key.lit != Term { - continue - } - change, ok := changes[string(it.Key.val)] - if !ok { // todo compare - continue - } - new_rev := NextRev(it.Val.revz) - tlv_delta = append(tlv_delta, protocol.Record(Term, FIRSTtlv(new_rev, 0, it.Key.val))...) - tlv_delta = append(tlv_delta, protocol.Record(Reference, FIRSTtlv(new_rev, 0, change.ZipBytes()))...) - delete(changes, string(it.Key.val)) - } - for key, val := range changes { - tlv_delta = append(tlv_delta, protocol.Record(Term, Ttlv(key))...) - tlv_delta = append(tlv_delta, protocol.Record(Reference, Rtlv(val))...) - } - return + return Mdelta2(tlv, MtlvTR(changes)) } // checks a TLV value for validity (format violations)