Documentation
¶
Index ¶
- Variables
- func GetAllAvailableHistory(snapshotsPath string, oldestHistoryBlock *entities.Block, ...) (string, *CurrentStateSnapshot, []HistorySnapshot, error)
- func GetAllTableNames(ctx context.Context, conn *pgxpool.Pool) ([]string, error)
- func GetChainID(currentStatesChainID string, historiesChainID string) (string, error)
- func GetCurrentStateSnapshots(snapshotsDir string) (string, map[int64]CurrentStateSnapshot, error)
- func GetFromHeight(toHeight int64, snapshotInterval int64) int64
- func GetHistoryIncludingDatanodeState(datanodeOldestHistoryBlock *entities.Block, datanodeLastBlock *entities.Block, ...) (*CurrentStateSnapshot, []HistorySnapshot, error)
- func GetHistoryMd5Hash(log *logging.Logger, snapshot Meta) (string, error)
- func GetOldestHistoryBlockAndLastBlock(ctx context.Context, connConfig sqlstore.ConnectionConfig, ...) (*entities.Block, *entities.Block, error)
- func GetSnapshotMd5Hash(log *logging.Logger, currentStateSnapshotFile string, ...) (string, error)
- func GetToAndFromHeightFromHistory(currentStateSnapshot *CurrentStateSnapshot, ...) (int64, int64)
- func HasVegaSchema(ctx context.Context, conf sqlstore.ConnectionConfig) (bool, error)
- func InProgressFileName(chainID string, height int64) string
- type Config
- type Conn
- type CurrentStateSnapshot
- type DatabaseMetadata
- type HistorySnapshot
- type IndexInfo
- type Meta
- type Publisher
- type Service
- func (b *Service) CreateSnapshotAsync(ctx context.Context, chainID string, fromHeight int64, toHeight int64) (Meta, error)
- func (b *Service) LoadAllAvailableHistory(ctx context.Context) (int64, int64, error)
- func (b *Service) OnBlockCommitted(ctx context.Context, chainID string, blockHeight int64) bool
- func (b *Service) Types() []events.Type
- type TableMetadata
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoCurrentStateSnapshotFound = errors.New("no current state snapshot found")
Functions ¶
func GetAllAvailableHistory ¶
func GetAllAvailableHistory(snapshotsPath string, oldestHistoryBlock *entities.Block, lastBlock *entities.Block) (string, *CurrentStateSnapshot, []HistorySnapshot, error)
func GetAllTableNames ¶
func GetChainID ¶
func GetCurrentStateSnapshots ¶
func GetCurrentStateSnapshots(snapshotsDir string) (string, map[int64]CurrentStateSnapshot, error)
func GetFromHeight ¶
func GetHistoryIncludingDatanodeState ¶
func GetHistoryIncludingDatanodeState(datanodeOldestHistoryBlock *entities.Block, datanodeLastBlock *entities.Block, chainID string, currentStateData map[int64]CurrentStateSnapshot, histories []HistorySnapshot, ) (*CurrentStateSnapshot, []HistorySnapshot, error)
GetHistoryIncludingDatanodeState returns currentStateSnapshot of the youngest snapshot or nil if none is found. Return the contiguous history in oldest first order or nil if none is found. If the datanode is populated with data, only snapshot data upto the datanodes current height will be returned.
func GetSnapshotMd5Hash ¶
func GetToAndFromHeightFromHistory ¶
func GetToAndFromHeightFromHistory(currentStateSnapshot *CurrentStateSnapshot, contiguousHistory []HistorySnapshot) (int64, int64)
func HasVegaSchema ¶
func InProgressFileName ¶
Types ¶
type Config ¶
type Config struct { Enabled encoding.Bool `long:"set to false to prevent datanode creating snapshots" description:"set to false to prevent datanode creating snapshots"` RemoveSnapshotsOnStartup encoding.Bool `long:"remove-snapshops-on-startup" description:"if true the nodes snapshot directory will be emptied at startup"` Publish encoding.Bool `long:"publish" description:"set to true if this node should publish snapshot data"` DatabaseSnapshotsPath string `long:"database-snapshot-path" description:"the snapshots path relative the database working directory"` }
func NewDefaultConfig ¶
func NewDefaultConfig() Config
NewDefaultConfig creates an instance of the package specific configuration, given a pointer to a logger instance to be used for logging within the package.
type CurrentStateSnapshot ¶
func NewCurrentSnapshot ¶
func NewCurrentSnapshot(chainID string, height int64) CurrentStateSnapshot
func (CurrentStateSnapshot) CompressedFileName ¶
func (s CurrentStateSnapshot) CompressedFileName() string
func (CurrentStateSnapshot) GetCopySQL ¶
func (s CurrentStateSnapshot) GetCopySQL(dbMetaData DatabaseMetadata, databaseSnapshotsPath string) []string
func (CurrentStateSnapshot) String ¶
func (s CurrentStateSnapshot) String() string
func (CurrentStateSnapshot) UncompressedDataDir ¶
func (s CurrentStateSnapshot) UncompressedDataDir() string
type DatabaseMetadata ¶
type DatabaseMetadata struct { TableNameToMetaData map[string]TableMetadata DatabaseVersion int64 }
func NewDatabaseMetaData ¶
func NewDatabaseMetaData(ctx context.Context, connConfig sqlstore.ConnectionConfig) (DatabaseMetadata, error)
func (DatabaseMetadata) GetHistoryTableNames ¶
func (d DatabaseMetadata) GetHistoryTableNames() []string
type HistorySnapshot ¶
func GetHistorySnapshots ¶
func GetHistorySnapshots(snapshotsDir string) (string, []HistorySnapshot, error)
func NewHistorySnapshot ¶
func NewHistorySnapshot(chainID string, heightFrom int64, heightTo int64) HistorySnapshot
func (HistorySnapshot) CompressedFileName ¶
func (h HistorySnapshot) CompressedFileName() string
func (HistorySnapshot) GetCopySQL ¶
func (h HistorySnapshot) GetCopySQL(dbMetaData DatabaseMetadata, databaseSnapshotsPath string) []string
func (HistorySnapshot) String ¶
func (h HistorySnapshot) String() string
func (HistorySnapshot) UncompressedDataDir ¶
func (h HistorySnapshot) UncompressedDataDir() string
type Meta ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewSnapshotService ¶
func NewSnapshotService(log *logging.Logger, config Config, brokerConfig broker.Config, blockStore *sqlstore.Blocks, networkParameterService func(ctx context.Context, key string) (entities.NetworkParameter, error), chainService *service.Chain, connConfig sqlstore.ConnectionConfig, snapshotsPath string, ) (*Service, error)
func (*Service) CreateSnapshotAsync ¶
func (*Service) LoadAllAvailableHistory ¶
func (*Service) OnBlockCommitted ¶
type TableMetadata ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.