Commit 1813f016 authored by Steven Allen's avatar Steven Allen

remove closer type assertions

We no longer need them.
parent 3f52705c
package datastore
import (
"io"
"log"
dsq "github.com/ipfs/go-datastore/query"
......@@ -244,10 +243,7 @@ func (d *LogBatch) Commit() (err error) {
func (d *LogDatastore) Close() error {
log.Printf("%s: Close\n", d.Name)
if cds, ok := d.child.(io.Closer); ok {
return cds.Close()
}
return nil
return d.child.Close()
}
func (d *LogDatastore) Check() error {
......
package keytransform
import (
"io"
ds "github.com/ipfs/go-datastore"
dsq "github.com/ipfs/go-datastore/query"
)
......@@ -84,10 +82,7 @@ func (d *ktds) Query(q dsq.Query) (dsq.Results, error) {
}
func (d *ktds) Close() error {
if c, ok := d.child.(io.Closer); ok {
return c.Close()
}
return nil
return d.child.Close()
}
// DiskUsage implements the PersistentDatastore interface.
......
......@@ -5,7 +5,6 @@ package mount
import (
"errors"
"fmt"
"io"
"sort"
"strings"
"sync"
......@@ -195,13 +194,11 @@ func (d *Datastore) IsThreadSafe() {}
func (d *Datastore) Close() error {
for _, d := range d.mounts {
if c, ok := d.Datastore.(io.Closer); ok {
err := c.Close()
err := d.Datastore.Close()
if err != nil {
return err
}
}
}
return nil
}
......
package sync
import (
"io"
"sync"
ds "github.com/ipfs/go-datastore"
......@@ -93,10 +92,7 @@ func (d *MutexDatastore) Batch() (ds.Batch, error) {
func (d *MutexDatastore) Close() error {
d.RWMutex.Lock()
defer d.RWMutex.Unlock()
if c, ok := d.child.(io.Closer); ok {
return c.Close()
}
return nil
return d.child.Close()
}
// DiskUsage implements the PersistentDatastore interface.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment