Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrStateNotSynchronized indicates the state database may be empty ErrStateNotSynchronized = errors.New("state not synchronized") )
Functions ¶
func InitContext ¶ added in v0.0.4
InitContext initializes DB connection by the given config
func RunMigrationsUp ¶
RunMigrationsUp runs migrate-up for the given config.
Types ¶
type Config ¶
type Config struct {
// Database name
Name string `mapstructure:"Name"`
// Database User name
User string `mapstructure:"User"`
// Database Password of the user
Password string `mapstructure:"Password"`
// Host address of database
Host string `mapstructure:"Host"`
// Port Number of database
Port string `mapstructure:"Port"`
// EnableLog
// DEPRECATED
EnableLog bool `mapstructure:"EnableLog"`
// MaxConns is the maximum number of connections in the pool.
MaxConns int `mapstructure:"MaxConns"`
// SSLMode: "require", "verify-full", "verify-ca", and "disable"
SSLMode string `mapstructure:"SSLMode"`
}
Config provide fields to configure the pool
type DB ¶
type DB interface {
StoreLastProcessedBlock(ctx context.Context, block uint64, task string) error
GetLastProcessedBlock(ctx context.Context, task string) (uint64, error)
StoreMissingBatchKeys(ctx context.Context, bks []types.BatchKey) error
GetMissingBatchKeys(ctx context.Context, limit uint) ([]types.BatchKey, error)
DeleteMissingBatchKeys(ctx context.Context, bks []types.BatchKey) error
GetOffChainData(ctx context.Context, key common.Hash) (*types.OffChainData, error)
ListOffChainData(ctx context.Context, keys []common.Hash) ([]types.OffChainData, error)
StoreOffChainData(ctx context.Context, od []types.OffChainData) error
CountOffchainData(ctx context.Context) (uint64, error)
}
DB defines functions that a DB instance should implement
Click to show internal directories.
Click to hide internal directories.