@@ -22,14 +22,20 @@ import (
22
22
var logger = logging .Logger ("blockstore" )
23
23
24
24
// BlockPrefix namespaces blockstore datastores
25
+ //
26
+ // Deprecated: use github.com/ipfs/boxo/blockstore.BlockPrefix
25
27
var BlockPrefix = ds .NewKey ("blocks" )
26
28
27
29
// ErrHashMismatch is an error returned when the hash of a block
28
30
// is different than expected.
31
+ //
32
+ // Deprecated: use github.com/ipfs/boxo/blockstore.ErrHashMismatch
29
33
var ErrHashMismatch = errors .New ("block in storage has different hash than requested" )
30
34
31
35
// Blockstore wraps a Datastore block-centered methods and provides a layer
32
36
// of abstraction which allows to add different caching strategies.
37
+ //
38
+ // Deprecated: use github.com/ipfs/boxo/blockstore.Blockstore
33
39
type Blockstore interface {
34
40
DeleteBlock (context.Context , cid.Cid ) error
35
41
Has (context.Context , cid.Cid ) (bool , error )
@@ -66,12 +72,16 @@ type Blockstore interface {
66
72
// The callback will only be called iff the query operation is successful (and
67
73
// the block is found); otherwise, the error will be propagated. Errors returned
68
74
// by the callback will be propagated as well.
75
+ //
76
+ // Deprecated: use github.com/ipfs/boxo/blockstore.Viewer
69
77
type Viewer interface {
70
78
View (ctx context.Context , cid cid.Cid , callback func ([]byte ) error ) error
71
79
}
72
80
73
81
// GCLocker abstract functionality to lock a blockstore when performing
74
82
// garbage-collection operations.
83
+ //
84
+ // Deprecated: use github.com/ipfs/boxo/blockstore.GCLocker
75
85
type GCLocker interface {
76
86
// GCLock locks the blockstore for garbage collection. No operations
77
87
// that expect to finish with a pin should ocurr simultaneously.
@@ -91,13 +101,17 @@ type GCLocker interface {
91
101
92
102
// GCBlockstore is a blockstore that can safely run garbage-collection
93
103
// operations.
104
+ //
105
+ // Deprecated: use github.com/ipfs/boxo/blockstore.GCBlockstore
94
106
type GCBlockstore interface {
95
107
Blockstore
96
108
GCLocker
97
109
}
98
110
99
111
// NewGCBlockstore returns a default implementation of GCBlockstore
100
112
// using the given Blockstore and GCLocker.
113
+ //
114
+ // Deprecated: use github.com/ipfs/boxo/blockstore.NewGCBlockstore
101
115
func NewGCBlockstore (bs Blockstore , gcl GCLocker ) GCBlockstore {
102
116
return gcBlockstore {bs , gcl }
103
117
}
@@ -108,12 +122,16 @@ type gcBlockstore struct {
108
122
}
109
123
110
124
// Option is a default implementation Blockstore option
125
+ //
126
+ // Deprecated: use github.com/ipfs/boxo/blockstore.Option
111
127
type Option struct {
112
128
f func (bs * blockstore )
113
129
}
114
130
115
131
// WriteThrough skips checking if the blockstore already has a block before
116
132
// writing it.
133
+ //
134
+ // Deprecated: use github.com/ipfs/boxo/blockstore.WriteThrough
117
135
func WriteThrough () Option {
118
136
return Option {
119
137
func (bs * blockstore ) {
@@ -124,6 +142,8 @@ func WriteThrough() Option {
124
142
125
143
// NoPrefix avoids wrapping the blockstore into the BlockPrefix namespace
126
144
// ("/blocks"), so keys will not be modified in any way.
145
+ //
146
+ // Deprecated: use github.com/ipfs/boxo/blockstore.NoPrefix
127
147
func NoPrefix () Option {
128
148
return Option {
129
149
func (bs * blockstore ) {
@@ -134,6 +154,8 @@ func NoPrefix() Option {
134
154
135
155
// NewBlockstore returns a default Blockstore implementation
136
156
// using the provided datastore.Batching backend.
157
+ //
158
+ // Deprecated: use github.com/ipfs/boxo/blockstore.NewBlockstore
137
159
func NewBlockstore (d ds.Batching , opts ... Option ) Blockstore {
138
160
bs := & blockstore {
139
161
datastore : d ,
@@ -155,6 +177,8 @@ func NewBlockstore(d ds.Batching, opts ...Option) Blockstore {
155
177
// This constructor does not modify input keys in any way
156
178
//
157
179
// Deprecated: Use NewBlockstore with the NoPrefix option instead.
180
+ //
181
+ // Deprecated: use github.com/ipfs/boxo/blockstore.NewBlockstoreNoPrefix
158
182
func NewBlockstoreNoPrefix (d ds.Batching ) Blockstore {
159
183
return NewBlockstore (d , NoPrefix ())
160
184
}
@@ -305,6 +329,8 @@ func (bs *blockstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) {
305
329
306
330
// NewGCLocker returns a default implementation of
307
331
// GCLocker using standard [RW] mutexes.
332
+ //
333
+ // Deprecated: use github.com/ipfs/boxo/blockstore.NewGCLocker
308
334
func NewGCLocker () GCLocker {
309
335
return & gclocker {}
310
336
}
@@ -316,6 +342,8 @@ type gclocker struct {
316
342
317
343
// Unlocker represents an object which can Unlock
318
344
// something.
345
+ //
346
+ // Deprecated: use github.com/ipfs/boxo/blockstore.Unlocker
319
347
type Unlocker interface {
320
348
Unlock (context.Context )
321
349
}
0 commit comments