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
21c2c0e8
Commit
21c2c0e8
authored
Dec 26, 2018
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delayed: make delayed implement io.Closer
parent
edbdfb8f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
delayed/delayed.go
delayed/delayed.go
+11
-0
No files found.
delayed/delayed.go
View file @
21c2c0e8
...
...
@@ -3,6 +3,8 @@
package
delayed
import
(
"io"
ds
"github.com/ipfs/go-datastore"
dsq
"github.com/ipfs/go-datastore/query"
delay
"github.com/ipfs/go-ipfs-delay"
...
...
@@ -20,6 +22,7 @@ type Delayed struct {
}
var
_
ds
.
Batching
=
(
*
Delayed
)(
nil
)
var
_
io
.
Closer
=
(
*
Delayed
)(
nil
)
// Put implements the ds.Datastore interface.
func
(
dds
*
Delayed
)
Put
(
key
ds
.
Key
,
value
[]
byte
)
(
err
error
)
{
...
...
@@ -67,3 +70,11 @@ func (dds *Delayed) DiskUsage() (uint64, error) {
dds
.
delay
.
Wait
()
return
ds
.
DiskUsage
(
dds
.
ds
)
}
// Close closes the inner datastore (if it implements the io.Closer interface).
func
(
dds
*
Delayed
)
Close
()
error
{
if
closer
,
ok
:=
dds
.
ds
.
(
io
.
Closer
);
ok
{
return
closer
.
Close
()
}
return
nil
}
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