Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-datastore
Commits
ede5df6d
Commit
ede5df6d
authored
Mar 14, 2018
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement DiskUsage for the rest of the datastores
parent
f2426c09
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
0 deletions
+29
-0
autobatch/autobatch.go
autobatch/autobatch.go
+5
-0
failstore/failstore.go
failstore/failstore.go
+8
-0
namespace/namespace.go
namespace/namespace.go
+5
-0
retrystore/retrystore.go
retrystore/retrystore.go
+11
-0
No files found.
autobatch/autobatch.go
View file @
ede5df6d
...
...
@@ -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
)
}
failstore/failstore.go
View file @
ede5df6d
...
...
@@ -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
...
...
namespace/namespace.go
View file @
ede5df6d
...
...
@@ -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
()
...
...
retrystore/retrystore.go
View file @
ede5df6d
...
...
@@ -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
{}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment