fix FromDatastore to not do double adapting

This commit is contained in:
vyzo 2021-03-02 18:21:17 +02:00
parent ab52e34e6a
commit 4c05ec28ba

View File

@ -47,14 +47,14 @@ func WrapIDStore(bstore blockstore.Blockstore) Blockstore {
return NewIDStore(bs) return NewIDStore(bs)
} }
// The underlying blockstore does not implement DeleteMany, so we need to shim it. // The underlying blockstore does not implement DeleteMany, so we need to shim it.
// This is less efficient as it'll iterate and perform single deletes. // This is less efficient as it'll iterate and perform single deletes.
return NewIDStore(Adapt(bstore)) return NewIDStore(Adapt(bstore))
} }
// FromDatastore creates a new blockstore backed by the given datastore. // FromDatastore creates a new blockstore backed by the given datastore.
func FromDatastore(dstore ds.Batching) Blockstore { func FromDatastore(dstore ds.Batching) Blockstore {
return WrapIDStore(Adapt(blockstore.NewBlockstore(dstore))) return WrapIDStore(blockstore.NewBlockstore(dstore))
} }
type adaptedBlockstore struct { type adaptedBlockstore struct {