this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

diff func cleanup

why 402055b2 ddd8201b

+7 -21
+7 -21
mst/diff.go
··· 18 18 NewCid cid.Cid 19 19 } 20 20 21 - func DiffTrees(ctx context.Context, bs blockstore.Blockstore, from, to cid.Cid) ([]*DiffOp, error) { 22 - cst := cbor.NewCborStore(bs) 23 - 24 - ft := LoadMST(cst, 32, from) 25 - tt := LoadMST(cst, 32, to) 26 - 27 - return diffTreesRec(ctx, cst, ft, tt, 1) 28 - } 29 - 30 21 func checkDiffSort(diffs []*DiffOp) { 31 22 if !sort.SliceIsSorted(diffs, func(i, j int) bool { 32 23 return diffs[i].Tid < diffs[j].Tid ··· 35 26 } 36 27 } 37 28 38 - func diffTreesRec(ctx context.Context, cst cbor.IpldStore, ft, tt *MerkleSearchTree, depth int) ([]*DiffOp, error) { 39 - // TODO: this code isnt great, should be rewritten on top of the baseline datastructures once functional and correct 29 + // TODO: this code isnt great, should be rewritten on top of the baseline datastructures once functional and correct 30 + func DiffTrees(ctx context.Context, bs blockstore.Blockstore, from, to cid.Cid) ([]*DiffOp, error) { 31 + cst := cbor.NewCborStore(bs) 32 + 33 + ft := LoadMST(cst, 32, from) 34 + tt := LoadMST(cst, 32, to) 35 + 40 36 fents, err := ft.getEntries(ctx) 41 37 if err != nil { 42 38 return nil, err ··· 193 189 194 190 return false 195 191 } 196 - 197 - func sameCidPtr(a, b *cid.Cid) bool { 198 - if a == nil && b == nil { 199 - return true 200 - } 201 - if a != nil && b != nil && *a == *b { 202 - return true 203 - } 204 - return false 205 - }