fork of indigo with slightly nicer lexgen

suck less at naming

Changed files
+15 -15
repomgr
util
+2 -2
repomgr/repomgr.go
··· 455 455 return cid.Undef, nil, err 456 456 } 457 457 458 - bs := util.NewReadRecordBstore(robs) 458 + bs := util.NewLoggingBstore(robs) 459 459 460 460 head, err := rm.cs.GetUserRepoHead(ctx, user) 461 461 if err != nil { ··· 472 472 return cid.Undef, nil, err 473 473 } 474 474 475 - return head, bs.AllReadBlocks(), nil 475 + return head, bs.GetLoggedBlocks(), nil 476 476 } 477 477 478 478 func (rm *RepoManager) GetProfile(ctx context.Context, uid models.Uid) (*bsky.ActorProfile, error) {
+13 -13
util/readrecordbs.go
··· 9 9 blockstore "github.com/ipfs/go-ipfs-blockstore" 10 10 ) 11 11 12 - type ReadRecordBstore struct { 12 + type LoggingBstore struct { 13 13 base blockstore.Blockstore 14 14 15 15 set map[cid.Cid]blockformat.Block 16 16 } 17 17 18 - func NewReadRecordBstore(base blockstore.Blockstore) *ReadRecordBstore { 19 - return &ReadRecordBstore{ 18 + func NewLoggingBstore(base blockstore.Blockstore) *LoggingBstore { 19 + return &LoggingBstore{ 20 20 base: base, 21 21 set: make(map[cid.Cid]blockformat.Block), 22 22 } 23 23 } 24 24 25 - var _ blockstore.Blockstore = (*ReadRecordBstore)(nil) 25 + var _ blockstore.Blockstore = (*LoggingBstore)(nil) 26 26 27 - func (bs *ReadRecordBstore) AllReadBlocks() []blockformat.Block { 27 + func (bs *LoggingBstore) GetLoggedBlocks() []blockformat.Block { 28 28 var out []blockformat.Block 29 29 for _, v := range bs.set { 30 30 out = append(out, v) ··· 32 32 return out 33 33 } 34 34 35 - func (bs *ReadRecordBstore) Has(ctx context.Context, c cid.Cid) (bool, error) { 35 + func (bs *LoggingBstore) Has(ctx context.Context, c cid.Cid) (bool, error) { 36 36 return bs.base.Has(ctx, c) 37 37 } 38 38 39 - func (bs *ReadRecordBstore) Get(ctx context.Context, c cid.Cid) (blockformat.Block, error) { 39 + func (bs *LoggingBstore) Get(ctx context.Context, c cid.Cid) (blockformat.Block, error) { 40 40 blk, err := bs.base.Get(ctx, c) 41 41 if err != nil { 42 42 return nil, err ··· 47 47 return blk, nil 48 48 } 49 49 50 - func (bs *ReadRecordBstore) GetSize(ctx context.Context, c cid.Cid) (int, error) { 50 + func (bs *LoggingBstore) GetSize(ctx context.Context, c cid.Cid) (int, error) { 51 51 return bs.base.GetSize(ctx, c) 52 52 } 53 53 54 - func (bs *ReadRecordBstore) DeleteBlock(ctx context.Context, c cid.Cid) error { 54 + func (bs *LoggingBstore) DeleteBlock(ctx context.Context, c cid.Cid) error { 55 55 return fmt.Errorf("deletes not allowed on read-record blockstore") 56 56 } 57 57 58 - func (bs *ReadRecordBstore) Put(context.Context, blockformat.Block) error { 58 + func (bs *LoggingBstore) Put(context.Context, blockformat.Block) error { 59 59 return fmt.Errorf("writes not allowed on read-record blockstore") 60 60 } 61 61 62 - func (bs *ReadRecordBstore) PutMany(context.Context, []blockformat.Block) error { 62 + func (bs *LoggingBstore) PutMany(context.Context, []blockformat.Block) error { 63 63 return fmt.Errorf("writes not allowed on read-record blockstore") 64 64 } 65 65 66 - func (bs *ReadRecordBstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) { 66 + func (bs *LoggingBstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) { 67 67 return nil, fmt.Errorf("iteration not supported on read-record blockstore") 68 68 } 69 69 70 - func (bs *ReadRecordBstore) HashOnRead(enabled bool) { 70 + func (bs *LoggingBstore) HashOnRead(enabled bool) { 71 71 72 72 }