Skip to content
This repository was archived by the owner on Jun 19, 2023. It is now read-only.

Commit 7adc396

Browse files
authored
make idstore implement io.Closer. (#60)
1 parent 3e8fd89 commit 7adc396

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

idstore.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package blockstore
22

33
import (
44
"context"
5+
"io"
56

67
blocks "github.com/ipfs/go-block-format"
78
cid "github.com/ipfs/go-cid"
@@ -16,6 +17,7 @@ type idstore struct {
1617

1718
var _ Blockstore = (*idstore)(nil)
1819
var _ Viewer = (*idstore)(nil)
20+
var _ io.Closer = (*idstore)(nil)
1921

2022
func NewIdStore(bs Blockstore) Blockstore {
2123
ids := &idstore{bs: bs}
@@ -112,3 +114,10 @@ func (b *idstore) HashOnRead(enabled bool) {
112114
func (b *idstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) {
113115
return b.bs.AllKeysChan(ctx)
114116
}
117+
118+
func (b *idstore) Close() error {
119+
if c, ok := b.bs.(io.Closer); ok {
120+
return c.Close()
121+
}
122+
return nil
123+
}

0 commit comments

Comments
 (0)