erigon-pulse/cmd/rpcdaemon/commands/db_api_deprecated.go

53 lines
1.9 KiB
Go
Raw Normal View History

package commands
import (
"context"
"fmt"
"github.com/ledgerwatch/turbo-geth/common/hexutil"
)
// DBAPI the interface for the db_ RPC commands (deprecated)
type DBAPI interface {
GetString(_ context.Context, _ string, _ string) (string, error)
PutString(_ context.Context, _ string, _ string, _ string) (bool, error)
GetHex(_ context.Context, _ string, _ string) (hexutil.Bytes, error)
PutHex(_ context.Context, _ string, _ string, _ hexutil.Bytes) (bool, error)
}
// DBAPIImpl data structure to store things needed for db_ commands
type DBAPIImpl struct {
unused uint64
}
// NewDBAPIImpl returns NetAPIImplImpl instance
func NewDBAPIImpl() *DBAPIImpl {
return &DBAPIImpl{
unused: uint64(0),
}
}
// GetString implements db_getString. Returns string from the local database.
// Deprecated: This function will be removed in the future.
func (api *DBAPIImpl) GetString(_ context.Context, _ string, _ string) (string, error) {
return "", fmt.Errorf(NotAvailableDeprecated, "db_getString")
}
// PutString implements db_putString. Stores a string in the local database.
// Deprecated: This function will be removed in the future.
func (api *DBAPIImpl) PutString(_ context.Context, _ string, _ string, _ string) (bool, error) {
return false, fmt.Errorf(NotAvailableDeprecated, "db_putString")
}
// GetHex implements db_getHex. Returns binary data from the local database.
// Deprecated: This function will be removed in the future.
func (api *DBAPIImpl) GetHex(_ context.Context, _ string, _ string) (hexutil.Bytes, error) {
return hexutil.Bytes(""), fmt.Errorf(NotAvailableDeprecated, "db_getHex")
}
// PutHex implements db_putHex. Stores binary data in the local database.
// Deprecated: This function will be removed in the future.
func (api *DBAPIImpl) PutHex(_ context.Context, _ string, _ string, _ hexutil.Bytes) (bool, error) {
return false, fmt.Errorf(NotAvailableDeprecated, "db_putHex")
}