forked from cerc-io/plugeth
37 lines
1.9 KiB
Go
37 lines
1.9 KiB
Go
|
package wrappers
|
||
|
|
||
|
import (
|
||
|
"github.com/ethereum/go-ethereum/ethdb"
|
||
|
"github.com/openrelayxyz/plugeth-utils/restricted"
|
||
|
)
|
||
|
|
||
|
type dbWrapper struct{
|
||
|
db ethdb.Database
|
||
|
}
|
||
|
|
||
|
func (d *dbWrapper) Has(key []byte) (bool, error) { return d.db.Has(key) }
|
||
|
func (d *dbWrapper) Get(key []byte) ([]byte, error) { return d.db.Get(key) }
|
||
|
func (d *dbWrapper) Put(key []byte, value []byte) error { return d.db.Put(key, value) }
|
||
|
func (d *dbWrapper) Delete(key []byte) error { return d.db.Delete(key) }
|
||
|
func (d *dbWrapper) Stat(property string) (string, error) { return d.db.Stat(property) }
|
||
|
func (d *dbWrapper) Compact(start []byte, limit []byte) error { return d.db.Compact(start, limit) }
|
||
|
func (d *dbWrapper) HasAncient(kind string, number uint64) (bool, error) { return d.db.HasAncient(kind, number) }
|
||
|
func (d *dbWrapper) Ancient(kind string, number uint64) ([]byte, error) { return d.db.Ancient(kind, number) }
|
||
|
func (d *dbWrapper) Ancients() (uint64, error) { return d.db.Ancients() }
|
||
|
func (d *dbWrapper) AncientSize(kind string) (uint64, error) { return d.db.AncientSize(kind) }
|
||
|
func (d *dbWrapper) AppendAncient(number uint64, hash, header, body, receipt, td []byte) error { return d.db.AppendAncient(number, hash, header, body, receipt, td) }
|
||
|
func (d *dbWrapper) TruncateAncients(n uint64) error { return d.db.TruncateAncients(n) }
|
||
|
func (d *dbWrapper) Sync() error { return d.db.Sync() }
|
||
|
func (d *dbWrapper) Close() error { return d.db.Close() }
|
||
|
func (d *dbWrapper) NewIterator(prefix []byte, start []byte) restricted.Iterator { return &iterWrapper{d.db.NewIterator(prefix, start)} }
|
||
|
|
||
|
type iterWrapper struct {
|
||
|
iter ethdb.Iterator
|
||
|
}
|
||
|
|
||
|
func (it *iterWrapper) Next() bool { return it.iter.Next() }
|
||
|
func (it *iterWrapper) Error() error { return it.iter.Error() }
|
||
|
func (it *iterWrapper) Key() []byte { return it.iter.Key() }
|
||
|
func (it *iterWrapper) Value() []byte { return it.iter.Value() }
|
||
|
func (it *iterWrapper) Release() { it.iter.Release() }
|