1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-10 05:52:20 +08:00

fixup datastore interfaces

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
This commit is contained in:
Jeromy
2015-07-16 11:32:41 -07:00
parent 3ffebd942f
commit 45d4b1a8bc
8 changed files with 26 additions and 40 deletions

View File

@ -25,7 +25,7 @@ var ValueTypeMismatch = errors.New("The retrieved value is not a Block")
var ErrNotFound = errors.New("blockstore: block not found")
// Blockstore wraps a ThreadSafeDatastore
// Blockstore wraps a Datastore
type Blockstore interface {
DeleteBlock(key.Key) error
Has(key.Key) (bool, error)
@ -51,7 +51,7 @@ type GCBlockstore interface {
PinLock() func()
}
func NewBlockstore(d ds.Datastore) *blockstore {
func NewBlockstore(d ds.Batching) *blockstore {
dd := dsns.Wrap(d, BlockPrefix)
return &blockstore{
datastore: dd,
@ -60,8 +60,6 @@ func NewBlockstore(d ds.Datastore) *blockstore {
type blockstore struct {
datastore ds.Batching
// cant be ThreadSafeDatastore cause namespace.Datastore doesnt support it.
// we do check it on `NewBlockstore` though.
lk sync.RWMutex
}