Rm db.Info, rm go-iden3-core dependency

Rm db.Info, rm go-iden3-core dependency, update version of
go-iden3-crypto
This commit is contained in:
arnaucube
2020-12-18 11:58:02 +01:00
parent e5a3d7e049
commit 5c7c03eca1
8 changed files with 48 additions and 110 deletions

View File

@@ -1,8 +1,6 @@
package pebble
import (
"encoding/json"
"github.com/cockroachdb/pebble"
"github.com/iden3/go-merkletree/db"
log "github.com/sirupsen/logrus"
@@ -32,36 +30,6 @@ func NewPebbleStorage(path string, errorIfMissing bool) (*Storage, error) {
return &Storage{rdb, []byte{}}, nil
}
type storageInfo struct {
KeyCount int
ClaimCount int
}
// Info implements the method Info of the interface db.Storage
func (p *Storage) Info() string {
keycount := 0
claimcount := 0
err := p.Iterate(func(key []byte, value []byte) (bool, error) {
if value[0] == byte(1) {
claimcount++
}
keycount++
return true, nil
})
if err != nil {
return err.Error()
}
json, _ := json.MarshalIndent(
storageInfo{
KeyCount: keycount,
ClaimCount: claimcount,
},
"", " ",
)
return string(json)
}
// WithPrefix implements the method WithPrefix of the interface db.Storage
func (p *Storage) WithPrefix(prefix []byte) db.Storage {
return &Storage{p.pdb, db.Concat(p.prefix, prefix)}