Add method stubs to BadgerDatabase so it formally implements the Database interface

This commit is contained in:
andrew 2019-11-14 13:00:38 +01:00
parent 62d36ada39
commit 0eb9d3915b
3 changed files with 46 additions and 3 deletions

View File

@ -281,3 +281,47 @@ func (db *BadgerDatabase) Walk(bucket, startkey []byte, fixedbits uint, walker f
}
// TODO [Andrew] implement the full Database interface
func (db *BadgerDatabase) MultiWalk(bucket []byte, startkeys [][]byte, fixedbits []uint, walker func(int, []byte, []byte) (bool, error)) error {
panic("Not implemented")
}
func (db *BadgerDatabase) WalkAsOf(bucket, hBucket, startkey []byte, fixedbits uint, timestamp uint64, walker func([]byte, []byte) (bool, error)) error {
panic("Not implemented")
}
func (db *BadgerDatabase) MultiWalkAsOf(bucket, hBucket []byte, startkeys [][]byte, fixedbits []uint, timestamp uint64, walker func(int, []byte, []byte) (bool, error)) error {
panic("Not implemented")
}
func (db *BadgerDatabase) MultiPut(tuples ...[]byte) (uint64, error) {
panic("Not implemented")
}
func (db *BadgerDatabase) RewindData(timestampSrc, timestampDst uint64, df func(bucket, key, value []byte) error) error {
panic("Not implemented")
}
func (db *BadgerDatabase) NewBatch() DbWithPendingMutations {
panic("Not implemented")
}
func (db *BadgerDatabase) Size() int {
panic("Not implemented")
}
func (db *BadgerDatabase) Keys() ([][]byte, error) {
panic("Not implemented")
}
func (db *BadgerDatabase) MemCopy() Database {
panic("Not implemented")
}
func (db *BadgerDatabase) Ancients() (uint64, error) {
panic("Not implemented")
}
func (db *BadgerDatabase) TruncateAncients(items uint64) error {
panic("Not implemented")
}

View File

@ -273,7 +273,7 @@ var fixedBits uint = 3
var keysInRange = [][]byte{common.FromHex("a8"), common.FromHex("bb"), common.FromHex("bd")}
func testWalk(db MinDatabase, t *testing.T) {
func testWalk(db Database, t *testing.T) {
for k, v := range hexEntries {
err := db.Put(bucket, common.FromHex(k), common.FromHex(v))
if err != nil {

View File

@ -61,6 +61,7 @@ type Getter interface {
// walker is called for each eligible entry.
// If walker returns false or an error, the walk stops.
Walk(bucket, startkey []byte, fixedbits uint, walker func([]byte, []byte) (bool, error)) error
MultiWalk(bucket []byte, startkeys [][]byte, fixedbits []uint, walker func(int, []byte, []byte) (bool, error)) error
WalkAsOf(bucket, hBucket, startkey []byte, fixedbits uint, timestamp uint64, walker func([]byte, []byte) (bool, error)) error
MultiWalkAsOf(bucket, hBucket []byte, startkeys [][]byte, fixedbits []uint, timestamp uint64, walker func(int, []byte, []byte) (bool, error)) error
@ -99,8 +100,6 @@ type MinDatabase interface {
Get(bucket, key []byte) ([]byte, error)
Put(bucket, key, value []byte) error
Delete(bucket, key []byte) error
Walk(bucket, startkey []byte, fixedbits uint, walker func([]byte, []byte) (bool, error)) error
}
// DbWithPendingMutations is an extended version of the Database,