Skip to content

Commit

Permalink
feat(datastore): expose datastore Close()
Browse files Browse the repository at this point in the history
  • Loading branch information
ywh254 committed Jan 27, 2019
1 parent 3a9490a commit 0fd19d9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions autobatch/autobatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,7 @@ func (d *Datastore) Query(q dsq.Query) (dsq.Results, error) {
func (d *Datastore) DiskUsage() (uint64, error) {
return ds.DiskUsage(d.child)
}

func (d *Datastore) Close() error {
return nil
}
2 changes: 2 additions & 0 deletions datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package datastore

import (
"errors"
"io"
"time"

query "github.com/ipfs/go-datastore/query"
Expand Down Expand Up @@ -33,6 +34,7 @@ should be checked by callers.
type Datastore interface {
Read
Write
io.Closer
}

// Write is the write-side of the Datastore interface.
Expand Down
5 changes: 5 additions & 0 deletions failstore/failstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ func (d *Failstore) DiskUsage() (uint64, error) {
return ds.DiskUsage(d.child)
}

// Close implements the Datastore interface
func (d *Failstore) Close() error {
return d.child.Close()
}

// FailBatch implements batching operations on the Failstore.
type FailBatch struct {
cb ds.Batch
Expand Down

0 comments on commit 0fd19d9

Please sign in to comment.