fork of indigo with slightly nicer lexgen
0
fork

Configure Feed

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

use ipld cbor Blockstore interface

authored by

Brian Olson and committed by
Brian Olson
aa8c2ee9 89e09de2

+11 -12
+3 -3
mst/diff.go
··· 6 6 7 7 "github.com/bluesky-social/indigo/util" 8 8 cid "github.com/ipfs/go-cid" 9 - blockstore "github.com/ipfs/go-ipfs-blockstore" 9 + cbor "github.com/ipfs/go-ipld-cbor" 10 10 ) 11 11 12 12 type DiffOp struct { ··· 18 18 } 19 19 20 20 // TODO: this code isn't great, should be rewritten on top of the baseline datastructures once functional and correct 21 - func DiffTrees(ctx context.Context, bs blockstore.Blockstore, from, to cid.Cid) ([]*DiffOp, error) { 21 + func DiffTrees(ctx context.Context, bs cbor.IpldBlockstore, from, to cid.Cid) ([]*DiffOp, error) { 22 22 cst := util.CborStore(bs) 23 23 24 24 if from == cid.Undef { ··· 185 185 return false 186 186 } 187 187 188 - func identityDiff(ctx context.Context, bs blockstore.Blockstore, root cid.Cid) ([]*DiffOp, error) { 188 + func identityDiff(ctx context.Context, bs cbor.IpldBlockstore, root cid.Cid) ([]*DiffOp, error) { 189 189 cst := util.CborStore(bs) 190 190 tt := LoadMST(cst, root) 191 191
+7 -7
repo/repo.go
··· 43 43 type Repo struct { 44 44 sc SignedCommit 45 45 cst cbor.IpldStore 46 - bs blockstore.Blockstore 46 + bs cbor.IpldBlockstore 47 47 48 48 repoCid cid.Cid 49 49 ··· 74 74 return buf.Bytes(), nil 75 75 } 76 76 77 - func IngestRepo(ctx context.Context, bs blockstore.Blockstore, r io.Reader) (cid.Cid, error) { 77 + func IngestRepo(ctx context.Context, bs cbor.IpldBlockstore, r io.Reader) (cid.Cid, error) { 78 78 ctx, span := otel.Tracer("repo").Start(ctx, "Ingest") 79 79 defer span.End() 80 80 ··· 110 110 return OpenRepo(ctx, bs, root) 111 111 } 112 112 113 - func NewRepo(ctx context.Context, did string, bs blockstore.Blockstore) *Repo { 113 + func NewRepo(ctx context.Context, did string, bs cbor.IpldBlockstore) *Repo { 114 114 cst := util.CborStore(bs) 115 115 116 116 t := mst.NewEmptyMST(cst) ··· 128 128 } 129 129 } 130 130 131 - func OpenRepo(ctx context.Context, bs blockstore.Blockstore, root cid.Cid) (*Repo, error) { 131 + func OpenRepo(ctx context.Context, bs cbor.IpldBlockstore, root cid.Cid) (*Repo, error) { 132 132 cst := util.CborStore(bs) 133 133 134 134 var sc SignedCommit ··· 173 173 return r.sc 174 174 } 175 175 176 - func (r *Repo) Blockstore() blockstore.Blockstore { 176 + func (r *Repo) Blockstore() cbor.IpldBlockstore { 177 177 return r.bs 178 178 } 179 179 ··· 435 435 return mst.DiffTrees(ctx, r.bs, oldTree, curptr) 436 436 } 437 437 438 - func (r *Repo) CopyDataTo(ctx context.Context, bs blockstore.Blockstore) error { 438 + func (r *Repo) CopyDataTo(ctx context.Context, bs cbor.IpldBlockstore) error { 439 439 return copyRecCbor(ctx, r.bs, bs, r.sc.Data, make(map[cid.Cid]struct{})) 440 440 } 441 441 442 - func copyRecCbor(ctx context.Context, from, to blockstore.Blockstore, c cid.Cid, seen map[cid.Cid]struct{}) error { 442 + func copyRecCbor(ctx context.Context, from, to cbor.IpldBlockstore, c cid.Cid, seen map[cid.Cid]struct{}) error { 443 443 if _, ok := seen[c]; ok { 444 444 return nil 445 445 }
+1 -2
util/cbor.go
··· 1 1 package util 2 2 3 3 import ( 4 - blockstore "github.com/ipfs/go-ipfs-blockstore" 5 4 cbor "github.com/ipfs/go-ipld-cbor" 6 5 mh "github.com/multiformats/go-multihash" 7 6 ) 8 7 9 - func CborStore(bs blockstore.Blockstore) *cbor.BasicIpldStore { 8 + func CborStore(bs cbor.IpldBlockstore) *cbor.BasicIpldStore { 10 9 cst := cbor.NewCborStore(bs) 11 10 cst.DefaultMultihash = mh.SHA2_256 12 11 return cst