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
966467cf
Commit
966467cf
authored
Jun 11, 2016
by
Jakub Sztandera
Committed by
GitHub
Jun 11, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3 from ipfs-filestore/leveldb-fix
Fix bug in LevelDB datastore's Delete() method.
parents
3a579732
3c980c5a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
leveldb/datastore.go
leveldb/datastore.go
+9
-3
No files found.
leveldb/datastore.go
View file @
966467cf
...
@@ -58,11 +58,17 @@ func (d *datastore) Has(key ds.Key) (exists bool, err error) {
...
@@ -58,11 +58,17 @@ func (d *datastore) Has(key ds.Key) (exists bool, err error) {
}
}
func
(
d
*
datastore
)
Delete
(
key
ds
.
Key
)
(
err
error
)
{
func
(
d
*
datastore
)
Delete
(
key
ds
.
Key
)
(
err
error
)
{
err
=
d
.
DB
.
Delete
(
key
.
Bytes
(),
nil
)
// leveldb Delete will not return an error if the key doesn't
if
err
==
leveldb
.
ErrNotFound
{
// exist (see https://github.com/syndtr/goleveldb/issues/109),
// so check that the key exists first and if not return an
// error
exists
,
err
:=
d
.
DB
.
Has
(
key
.
Bytes
(),
nil
)
if
!
exists
{
return
ds
.
ErrNotFound
return
ds
.
ErrNotFound
}
}
else
if
err
!=
nil
{
return
err
return
err
}
return
d
.
DB
.
Delete
(
key
.
Bytes
(),
nil
)
}
}
func
(
d
*
datastore
)
Query
(
q
dsq
.
Query
)
(
dsq
.
Results
,
error
)
{
func
(
d
*
datastore
)
Query
(
q
dsq
.
Query
)
(
dsq
.
Results
,
error
)
{
...
...
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