Documentation ¶
Index ¶
Constants ¶
View Source
const ( DriverExistErr = iota DriverNotRegisterErr // LevelDB OpenDbErr NotExistValue LvDbNotFound // BlockChain err NotImplHashMethod UnexpectedError KeyExisted )
Variables ¶
View Source
var ErrCodeMessage = map[int]struct { code int message string }{ DriverExistErr: {-1000, "Driver is already registered"}, DriverNotRegisterErr: {-1001, "Driver is not registered"}, OpenDbErr: {-2000, "Open database error"}, NotExistValue: {-2001, "H is not existed"}, LvDbNotFound: {-2002, "lvdb not found"}, NotImplHashMethod: {-3000, "Data does not implement this method"}, UnexpectedError: {-3002, "Unexpected error"}, KeyExisted: {-3003, "PubKey already existed in database"}, }
View Source
var Logger = DBMemmpoolLogger{}
Global instant to use
Functions ¶
Types ¶
type DBMemmpoolLogger ¶
type DBMemmpoolLogger struct {
// contains filtered or unexported fields
}
func (*DBMemmpoolLogger) Init ¶
func (dbLogger *DBMemmpoolLogger) Init(inst common.Logger)
type DatabaseInterface ¶
type DatabaseInterface interface { Put(key, value []byte) error Get(key []byte) ([]byte, error) Delete(key []byte) error HasValue(key []byte) (bool, error) AddTransaction(txHash *common.Hash, txType string, valueTx []byte, valueDesc []byte) error RemoveTransaction(key *common.Hash) error GetTransaction(key *common.Hash) ([]byte, error) HasTransaction(key *common.Hash) (bool, error) Reset() error Load() ([][]byte, [][]byte, error) Close() error }
func Open ¶
func Open(typ string, args ...interface{}) (DatabaseInterface, error)
Open opens the db connection.
type DatabaseMempoolError ¶
type DatabaseMempoolError struct {
// contains filtered or unexported fields
}
func NewDatabaseMempoolError ¶
func NewDatabaseMempoolError(key int, err error) *DatabaseMempoolError
func (DatabaseMempoolError) Error ¶
func (e DatabaseMempoolError) Error() string
func (DatabaseMempoolError) GetErrorCode ¶
func (e DatabaseMempoolError) GetErrorCode() int
type Driver ¶
type Driver struct { DbType string Open func(args ...interface{}) (DatabaseInterface, error) }
Driver defines a structure for backend drivers to use when they registered themselves as a backend which implements the DatabaseInterface interface.
Click to show internal directories.
Click to hide internal directories.