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

Commit

Permalink
make idstore implement io.Closer. (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
raulk committed Nov 16, 2020
1 parent 3e8fd89 commit 7adc396
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions idstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package blockstore

import (
"context"
"io"

blocks "github.com/ipfs/go-block-format"
cid "github.com/ipfs/go-cid"
Expand All @@ -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}
Expand Down Expand Up @@ -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
}

0 comments on commit 7adc396

Please sign in to comment.