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

remove closer type assertions

We no longer need them.
parent 3f52705c
package datastore package datastore
import ( import (
"io"
"log" "log"
dsq "github.com/ipfs/go-datastore/query" dsq "github.com/ipfs/go-datastore/query"
...@@ -244,10 +243,7 @@ func (d *LogBatch) Commit() (err error) { ...@@ -244,10 +243,7 @@ func (d *LogBatch) Commit() (err error) {
func (d *LogDatastore) Close() error { func (d *LogDatastore) Close() error {
log.Printf("%s: Close\n", d.Name) log.Printf("%s: Close\n", d.Name)
if cds, ok := d.child.(io.Closer); ok { return d.child.Close()
return cds.Close()
}
return nil
} }
func (d *LogDatastore) Check() error { func (d *LogDatastore) Check() error {
......
package keytransform package keytransform
import ( import (
"io"
ds "github.com/ipfs/go-datastore" ds "github.com/ipfs/go-datastore"
dsq "github.com/ipfs/go-datastore/query" dsq "github.com/ipfs/go-datastore/query"
) )
...@@ -84,10 +82,7 @@ func (d *ktds) Query(q dsq.Query) (dsq.Results, error) { ...@@ -84,10 +82,7 @@ func (d *ktds) Query(q dsq.Query) (dsq.Results, error) {
} }
func (d *ktds) Close() error { func (d *ktds) Close() error {
if c, ok := d.child.(io.Closer); ok { return d.child.Close()
return c.Close()
}
return nil
} }
// DiskUsage implements the PersistentDatastore interface. // DiskUsage implements the PersistentDatastore interface.
......
...@@ -5,7 +5,6 @@ package mount ...@@ -5,7 +5,6 @@ package mount
import ( import (
"errors" "errors"
"fmt" "fmt"
"io"
"sort" "sort"
"strings" "strings"
"sync" "sync"
...@@ -195,13 +194,11 @@ func (d *Datastore) IsThreadSafe() {} ...@@ -195,13 +194,11 @@ func (d *Datastore) IsThreadSafe() {}
func (d *Datastore) Close() error { func (d *Datastore) Close() error {
for _, d := range d.mounts { for _, d := range d.mounts {
if c, ok := d.Datastore.(io.Closer); ok { err := d.Datastore.Close()
err := c.Close()
if err != nil { if err != nil {
return err return err
} }
} }
}
return nil return nil
} }
......
package sync package sync
import ( import (
"io"
"sync" "sync"
ds "github.com/ipfs/go-datastore" ds "github.com/ipfs/go-datastore"
...@@ -93,10 +92,7 @@ func (d *MutexDatastore) Batch() (ds.Batch, error) { ...@@ -93,10 +92,7 @@ func (d *MutexDatastore) Batch() (ds.Batch, error) {
func (d *MutexDatastore) Close() error { func (d *MutexDatastore) Close() error {
d.RWMutex.Lock() d.RWMutex.Lock()
defer d.RWMutex.Unlock() defer d.RWMutex.Unlock()
if c, ok := d.child.(io.Closer); ok { return d.child.Close()
return c.Close()
}
return nil
} }
// DiskUsage implements the PersistentDatastore interface. // 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