@@ -22,8 +22,8 @@ type IpldStore interface {
22
22
// IpldBlockstore defines a subset of the go-ipfs-blockstore Blockstore interface providing methods
23
23
// for storing and retrieving block-centered data.
24
24
type IpldBlockstore interface {
25
- Get (cid.Cid ) (block.Block , error )
26
- Put (block.Block ) error
25
+ Get (context. Context , cid.Cid ) (block.Block , error )
26
+ Put (context. Context , block.Block ) error
27
27
}
28
28
29
29
// IpldBlockstoreViewer is a trait that enables zero-copy access to blocks in
@@ -60,7 +60,7 @@ func (s *BasicIpldStore) Get(ctx context.Context, c cid.Cid, out interface{}) er
60
60
})
61
61
}
62
62
63
- blk , err := s .Blocks .Get (c )
63
+ blk , err := s .Blocks .Get (ctx , c )
64
64
if err != nil {
65
65
return err
66
66
}
@@ -125,7 +125,7 @@ func (s *BasicIpldStore) Put(ctx context.Context, v interface{}) (cid.Cid, error
125
125
return cid .Undef , err
126
126
}
127
127
128
- if err := s .Blocks .Put (blk ); err != nil {
128
+ if err := s .Blocks .Put (ctx , blk ); err != nil {
129
129
return cid .Undef , err
130
130
}
131
131
@@ -142,7 +142,7 @@ func (s *BasicIpldStore) Put(ctx context.Context, v interface{}) (cid.Cid, error
142
142
return cid .Undef , err
143
143
}
144
144
145
- if err := s .Blocks .Put (nd ); err != nil {
145
+ if err := s .Blocks .Put (ctx , nd ); err != nil {
146
146
return cid .Undef , err
147
147
}
148
148
@@ -187,15 +187,15 @@ func newMockBlocks() *mockBlocks {
187
187
return & mockBlocks {make (map [cid.Cid ]block.Block )}
188
188
}
189
189
190
- func (mb * mockBlocks ) Get (c cid.Cid ) (block.Block , error ) {
190
+ func (mb * mockBlocks ) Get (ctx context. Context , c cid.Cid ) (block.Block , error ) {
191
191
d , ok := mb .data [c ]
192
192
if ok {
193
193
return d , nil
194
194
}
195
195
return nil , fmt .Errorf ("not found %s" , c )
196
196
}
197
197
198
- func (mb * mockBlocks ) Put (b block.Block ) error {
198
+ func (mb * mockBlocks ) Put (ctx context. Context , b block.Block ) error {
199
199
mb .data [b .Cid ()] = b
200
200
return nil
201
201
}
0 commit comments