Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement GetSize #18

Merged
merged 1 commit into from
Oct 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ func (a *accessor) Has(key ds.Key) (exists bool, err error) {
return a.ldb.Has(key.Bytes(), nil)
}

func (d *accessor) GetSize(key ds.Key) (size int, err error) {
return ds.GetBackedSize(d, key)
}

func (a *accessor) Delete(key ds.Key) (err error) {
// leveldb Delete will not return an error if the key doesn't
// exist (see https://github.com/syndtr/goleveldb/issues/109),
Expand Down
7 changes: 7 additions & 0 deletions ds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

ds "github.com/ipfs/go-datastore"
dsq "github.com/ipfs/go-datastore/query"
dstest "github.com/ipfs/go-datastore/test"
)

var testcases = map[string]string{
Expand Down Expand Up @@ -320,3 +321,9 @@ func TestTransactionManyOperations(t *testing.T) {

txn.Discard()
}

func TestSuite(t *testing.T) {
d := newDSMem(t)
defer d.Close()
dstest.SubtestAll(t, d)
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
},
{
"author": "jbenet",
"hash": "QmbQshXLNcCPRUGZv4sBGxnZNAHREA6MKeomkwihNXPZWP",
"hash": "QmaRb5yNXKonhbkpNxNawoydk4N6es6b4fPj19sjEKsh5D",
"name": "go-datastore",
"version": "3.3.0"
"version": "3.4.0"
}
],
"gxVersion": "0.8.0",
Expand Down