From 7adc396ab4b40c660c72d215b3a58999b6f63413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Mon, 16 Nov 2020 15:17:40 +0000 Subject: [PATCH] make idstore implement io.Closer. (#60) --- idstore.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/idstore.go b/idstore.go index 274c1a3..1166e5b 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 +} -- GitLab