this repo has no description
0
fork

Configure Feed

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

replace some go-libipfs/blocks with ipfs/go-block-format

This is basically identical to @mattn's
https://github.com/bluesky-social/indigo/pull/99. Didn't have time to
resolve the small merge conflict there.

+18 -17
+14 -13
carstore/bs.go
··· 14 14 15 15 util "github.com/bluesky-social/indigo/util" 16 16 17 + blockformat "github.com/ipfs/go-block-format" 17 18 carutil "github.com/ipfs/go-car/util" 18 19 "github.com/ipfs/go-cid" 19 20 "github.com/ipfs/go-datastore" ··· 83 84 cs *CarStore 84 85 user util.Uid 85 86 86 - cache map[cid.Cid]blocks.Block 87 + cache map[cid.Cid]blockformat.Block 87 88 prefetch bool 88 89 } 89 90 ··· 107 108 return count > 0, nil 108 109 } 109 110 110 - func (uv *userView) Get(ctx context.Context, k cid.Cid) (blocks.Block, error) { 111 + func (uv *userView) Get(ctx context.Context, k cid.Cid) (blockformat.Block, error) { 111 112 if uv.cache != nil { 112 113 blk, ok := uv.cache[k] 113 114 if ok { ··· 141 142 } 142 143 } 143 144 144 - func (uv *userView) prefetchRead(ctx context.Context, k cid.Cid, path string, offset int64) (blocks.Block, error) { 145 + func (uv *userView) prefetchRead(ctx context.Context, k cid.Cid, path string, offset int64) (blockformat.Block, error) { 145 146 fi, err := os.Open(path) 146 147 if err != nil { 147 148 return nil, err ··· 173 174 return outblk, nil 174 175 } 175 176 176 - func (uv *userView) singleRead(ctx context.Context, k cid.Cid, path string, offset int64) (blocks.Block, error) { 177 + func (uv *userView) singleRead(ctx context.Context, k cid.Cid, path string, offset int64) (blockformat.Block, error) { 177 178 fi, err := os.Open(path) 178 179 if err != nil { 179 180 return nil, err ··· 206 207 return nil, fmt.Errorf("not implemented") 207 208 } 208 209 209 - func (uv *userView) Put(ctx context.Context, blk blocks.Block) error { 210 + func (uv *userView) Put(ctx context.Context, blk blockformat.Block) error { 210 211 return fmt.Errorf("puts not supported to car view blockstores") 211 212 } 212 213 213 - func (uv *userView) PutMany(ctx context.Context, blks []blocks.Block) error { 214 + func (uv *userView) PutMany(ctx context.Context, blks []blockformat.Block) error { 214 215 return fmt.Errorf("puts not supported to car view blockstores") 215 216 } 216 217 ··· 230 231 231 232 type DeltaSession struct { 232 233 fresh blockstore.Blockstore 233 - blks map[cid.Cid]blocks.Block 234 + blks map[cid.Cid]blockformat.Block 234 235 base blockstore.Blockstore 235 236 user util.Uid 236 237 seq int ··· 296 297 297 298 return &DeltaSession{ 298 299 fresh: blockstore.NewBlockstore(datastore.NewMapDatastore()), 299 - blks: make(map[cid.Cid]blocks.Block), 300 + blks: make(map[cid.Cid]blockformat.Block), 300 301 base: &userView{ 301 302 user: user, 302 303 cs: cs, 303 304 prefetch: true, 304 - cache: make(map[cid.Cid]blocks.Block), 305 + cache: make(map[cid.Cid]blockformat.Block), 305 306 }, 306 307 user: user, 307 308 cs: cs, ··· 315 316 user: user, 316 317 cs: cs, 317 318 prefetch: false, 318 - cache: make(map[cid.Cid]blocks.Block), 319 + cache: make(map[cid.Cid]blockformat.Block), 319 320 }, 320 321 readonly: true, 321 322 user: user, ··· 405 406 406 407 var _ blockstore.Blockstore = (*DeltaSession)(nil) 407 408 408 - func (ds *DeltaSession) Put(ctx context.Context, b blocks.Block) error { 409 + func (ds *DeltaSession) Put(ctx context.Context, b blockformat.Block) error { 409 410 if ds.readonly { 410 411 return fmt.Errorf("cannot write to readonly deltaSession") 411 412 } ··· 413 414 return nil 414 415 } 415 416 416 - func (ds *DeltaSession) PutMany(ctx context.Context, bs []blocks.Block) error { 417 + func (ds *DeltaSession) PutMany(ctx context.Context, bs []blockformat.Block) error { 417 418 if ds.readonly { 418 419 return fmt.Errorf("cannot write to readonly deltaSession") 419 420 } ··· 441 442 return nil 442 443 } 443 444 444 - func (ds *DeltaSession) Get(ctx context.Context, c cid.Cid) (blocks.Block, error) { 445 + func (ds *DeltaSession) Get(ctx context.Context, c cid.Cid) (blockformat.Block, error) { 445 446 b, ok := ds.blks[c] 446 447 if ok { 447 448 return b, nil
+4 -4
util/tierbs.go
··· 4 4 "context" 5 5 "fmt" 6 6 7 + blockformat "github.com/ipfs/go-block-format" 7 8 "github.com/ipfs/go-cid" 8 9 blockstore "github.com/ipfs/go-ipfs-blockstore" 9 10 ipld "github.com/ipfs/go-ipld-format" 10 - "github.com/ipfs/go-libipfs/blocks" 11 11 ) 12 12 13 13 type ReadThroughBstore struct { ··· 42 42 return bs.base.Has(ctx, c) 43 43 } 44 44 45 - func (bs *ReadThroughBstore) Get(ctx context.Context, c cid.Cid) (blocks.Block, error) { 45 + func (bs *ReadThroughBstore) Get(ctx context.Context, c cid.Cid) (blockformat.Block, error) { 46 46 blk, err := bs.fresh.Get(ctx, c) 47 47 if err == nil { 48 48 return blk, nil ··· 68 68 return bs.base.GetSize(ctx, c) 69 69 } 70 70 71 - func (bs *ReadThroughBstore) Put(context.Context, blocks.Block) error { 71 + func (bs *ReadThroughBstore) Put(context.Context, blockformat.Block) error { 72 72 return fmt.Errorf("writes not allows on readthrough blockstore") 73 73 } 74 74 75 - func (bs *ReadThroughBstore) PutMany(context.Context, []blocks.Block) error { 75 + func (bs *ReadThroughBstore) PutMany(context.Context, []blockformat.Block) error { 76 76 return fmt.Errorf("writes not allows on readthrough blockstore") 77 77 } 78 78