diff --git a/idstore.go b/idstore.go index 274c1a3b3585066f66dfbc947505d12649662761..1166e5bda11c34e7730858a674f187ddf4a3197e 100644 --- a/idstore.go +++ b/idstore.go @@ -2,6 +2,7 @@ package blockstore import ( "context" + "io" blocks "github.com/ipfs/go-block-format" cid "github.com/ipfs/go-cid" @@ -16,6 +17,7 @@ type idstore struct { var _ Blockstore = (*idstore)(nil) var _ Viewer = (*idstore)(nil) +var _ io.Closer = (*idstore)(nil) func NewIdStore(bs Blockstore) Blockstore { ids := &idstore{bs: bs} @@ -112,3 +114,10 @@ func (b *idstore) HashOnRead(enabled bool) { func (b *idstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) { return b.bs.AllKeysChan(ctx) } + +func (b *idstore) Close() error { + if c, ok := b.bs.(io.Closer); ok { + return c.Close() + } + return nil +}