Commit ede5df6d authored by Steven Allen's avatar Steven Allen

implement DiskUsage for the rest of the datastores

parent f2426c09
......@@ -92,3 +92,8 @@ func (d *Datastore) Query(q dsq.Query) (dsq.Results, error) {
return d.child.Query(q)
}
// DiskUsage implements the PersistentDatastore interface.
func (d *Datastore) DiskUsage() (uint64, error) {
return ds.DiskUsage(d.child)
}
......@@ -76,6 +76,14 @@ func (d *Failstore) Query(q dsq.Query) (dsq.Results, error) {
return d.child.Query(q)
}
// DiskUsage implements the PersistentDatastore interface.
func (d *Failstore) DiskUsage() (uint64, error) {
if err := d.errfunc("disk-usage"); err != nil {
return 0, err
}
return ds.DiskUsage(d.child)
}
// FailBatch implements batching operations on the Failstore.
type FailBatch struct {
cb ds.Batch
......
......@@ -85,6 +85,11 @@ func (d *datastore) Query(q dsq.Query) (dsq.Results, error) {
}), nil
}
// DiskUsage implements the PersistentDatastore interface.
func (d *datastore) DiskUsage() (uint64, error) {
return ds.DiskUsage(d.raw)
}
func (d *datastore) Batch() (ds.Batch, error) {
if bds, ok := d.Datastore.(ds.Batching); ok {
return bds.Batch()
......
......@@ -43,6 +43,17 @@ func (d *Datastore) runOp(op func() error) error {
return fmt.Errorf(errFmtString, err)
}
// DiskUsage implements the PersistentDatastore interface.
func (d *Datastore) DiskUsage() (uint64, error) {
var size uint64
err := d.runOp(func() error {
var err error
size, err = ds.DiskUsage(d.Batching)
return err
})
return size, err
}
// Get retrieves a value given a key.
func (d *Datastore) Get(k ds.Key) (interface{}, error) {
var val 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