Documentation ¶
Index ¶
- Constants
- Variables
- func DBFromConnectionConfig(log *logging.Logger, connConfig vega_sqlstore.ConnectionConfig) (*sql.DB, error)
- func MigrateToLatestSchema(log *logging.Logger, connConfig vega_sqlstore.ConnectionConfig) error
- func NewTransactionalConnectionSource(log *logging.Logger, connConfig vega_sqlstore.ConnectionConfig) (*vega_sqlstore.ConnectionSource, error)
- func NewUpsertErr(store StoreType, baseError, actualError error) error
- func RevertOneVersion(log *logging.Logger, connConfig vega_sqlstore.ConnectionConfig) error
- func RevertToSchemaVersionZero(log *logging.Logger, connConfig vega_sqlstore.ConnectionConfig) error
- func SetRetentionPolicies(connConfig vega_sqlstore.ConnectionConfig, basePolicy string, ...) error
- type AssetPrices
- type BlockSigner
- func (bs *BlockSigner) Add(data *entities.BlockSigner)
- func (bs *BlockSigner) Flush(ctx context.Context) ([]*entities.BlockSigner, error)
- func (bs *BlockSigner) FlushUpsert(ctx context.Context) ([]*entities.BlockSigner, error)
- func (bs *BlockSigner) GetLastestBlockInStore(ctx context.Context) (int64, error)
- func (bs *BlockSigner) Upsert(ctx context.Context, newBlockSigner *entities.BlockSigner) error
- type CometTxs
- func (nhs *CometTxs) AddWithoutTime(newTx comet.CometTx)
- func (c *CometTxs) FlushUpsertWithoutTime(ctx context.Context) ([]comet.CometTx, error)
- func (c *CometTxs) GetLastestBlockInStore(ctx context.Context) (int64, error)
- func (nhs *CometTxs) UpsertWithoutTime(ctx context.Context, newTx comet.CometTx) error
- type MonitoringStatus
- func (ms *MonitoringStatus) Add(status entities.MonitoringStatus)
- func (ms *MonitoringStatus) FlushClear(ctx context.Context) ([]entities.MonitoringStatus, error)
- func (ms *MonitoringStatus) FlushUpsert(ctx context.Context) ([]entities.MonitoringStatus, error)
- func (ms *MonitoringStatus) GetLatest(ctx context.Context) ([]entities.MonitoringStatus, error)
- func (ms *MonitoringStatus) IsPendingFor(service entities.MonitoringServiceType) bool
- func (ms *MonitoringStatus) UpsertSingle(ctx context.Context, entity entities.MonitoringStatus) error
- type NetworkBalances
- func (nhs *NetworkBalances) Add(newBalance entities.NetworkBalance)
- func (c *NetworkBalances) FlushUpsert(ctx context.Context) ([]entities.NetworkBalance, error)
- func (nhs *NetworkBalances) UpsertPartiesTotalBalance(ctx context.Context) error
- func (nhs *NetworkBalances) UpsertUnfinalizedDeposits(ctx context.Context) error
- func (nhs *NetworkBalances) UpsertUnrealisedWithdrawalsBalance(ctx context.Context) error
- func (nhs *NetworkBalances) UpsertWithoutAssetId(ctx context.Context, newBalance entities.NetworkBalance) error
- type NetworkHistorySegment
- func (nhs *NetworkHistorySegment) AddWithoutTime(data *datanode.NetworkHistorySegment)
- func (nhs *NetworkHistorySegment) FlushUpsertWithoutTime(ctx context.Context) ([]*datanode.NetworkHistorySegment, error)
- func (nhs *NetworkHistorySegment) GetLatestSegmentsPerDataNode(ctx context.Context) ([]datanode.NetworkHistorySegment, error)
- func (nhs *NetworkHistorySegment) UpsertWithoutTime(ctx context.Context, newSegment *datanode.NetworkHistorySegment) error
- type RetentionPolicies
- type RetentionPolicy
- type StoreType
Constants ¶
View Source
const ( SQLMigrationsDir = "migrations" GooseDBVersionTableName = config.MonitoringDbSchema + ".metrics_goose_db_version" )
View Source
const ( RetentionPolicyArchival = "archival" RetentionPolicyStandard = "standard" RetentionPolicyLite = "lite" )
View Source
const DefaultUpsertTxTimeout = 30 * time.Second
View Source
const InfiniteInterval = "inf"
Variables ¶
View Source
var ( ErrAcquireTx = errors.New("failed to acquire transaction") ErrUpsertSingle = errors.New("failed to upsert single row") ErrUpsertCommit = errors.New("failed to commit the upsert transaction") )
View Source
var ArchivalRetentionPolicy = RetentionPolicies{ { TableName: "metrics.block_signers", Interval: InfiniteInterval, }, { TableName: "metrics.network_history_segments", Interval: InfiniteInterval, }, { TableName: "metrics.comet_txs", Interval: InfiniteInterval, }, { TableName: "metrics.network_balances", Interval: InfiniteInterval, }, { TableName: "metrics.asset_prices", Interval: InfiniteInterval, }, { TableName: "metrics.monitoring_status", Interval: InfiniteInterval, }, }
View Source
var EmbedMigrations embed.FS
View Source
var LiteRetentionPolicy = RetentionPolicies{ RetentionPolicy{ TableName: "metrics.block_signers", Interval: "7 days", }, RetentionPolicy{ TableName: "metrics.network_history_segments", Interval: "7 days", }, RetentionPolicy{ TableName: "metrics.comet_txs", Interval: "7 days", }, RetentionPolicy{ TableName: "metrics.network_balances", Interval: "7 days", }, RetentionPolicy{ TableName: "metrics.asset_prices", Interval: "7 days", }, RetentionPolicy{ TableName: "metrics.monitoring_status", Interval: "7 days", }, }
View Source
var StandardRetentionPolicy = RetentionPolicies{ RetentionPolicy{ TableName: "metrics.block_signers", Interval: "4 months", }, RetentionPolicy{ TableName: "metrics.network_history_segments", Interval: "4 months", }, RetentionPolicy{ TableName: "metrics.comet_txs", Interval: "4 months", }, RetentionPolicy{ TableName: "metrics.network_balances", Interval: "4 months", }, RetentionPolicy{ TableName: "metrics.asset_prices", Interval: "4 months", }, RetentionPolicy{ TableName: "metrics.monitoring_status", Interval: "7 days", }, }
Functions ¶
func DBFromConnectionConfig ¶ added in v0.9.0
func DBFromConnectionConfig( log *logging.Logger, connConfig vega_sqlstore.ConnectionConfig, ) (*sql.DB, error)
func MigrateToLatestSchema ¶
func MigrateToLatestSchema(log *logging.Logger, connConfig vega_sqlstore.ConnectionConfig) error
func NewTransactionalConnectionSource ¶
func NewTransactionalConnectionSource(log *logging.Logger, connConfig vega_sqlstore.ConnectionConfig) (*vega_sqlstore.ConnectionSource, error)
func NewUpsertErr ¶ added in v0.9.0
func RevertOneVersion ¶
func RevertOneVersion(log *logging.Logger, connConfig vega_sqlstore.ConnectionConfig) error
func RevertToSchemaVersionZero ¶
func RevertToSchemaVersionZero( log *logging.Logger, connConfig vega_sqlstore.ConnectionConfig, ) error
func SetRetentionPolicies ¶ added in v0.9.0
func SetRetentionPolicies(connConfig vega_sqlstore.ConnectionConfig, basePolicy string, policyOverrides []config.RetentionPolicy, logger *logging.Logger) error
Types ¶
type AssetPrices ¶
type AssetPrices struct { *vega_sqlstore.ConnectionSource // contains filtered or unexported fields }
func NewAssetPrices ¶
func NewAssetPrices(connectionSource *vega_sqlstore.ConnectionSource) *AssetPrices
func (*AssetPrices) Add ¶
func (ap *AssetPrices) Add(data *coingecko.PriceData)
func (*AssetPrices) FlushUpsert ¶
type BlockSigner ¶
type BlockSigner struct { *vega_sqlstore.ConnectionSource // contains filtered or unexported fields }
func NewBlockSigner ¶
func NewBlockSigner(connectionSource *vega_sqlstore.ConnectionSource) *BlockSigner
func (*BlockSigner) Add ¶
func (bs *BlockSigner) Add(data *entities.BlockSigner)
func (*BlockSigner) Flush ¶
func (bs *BlockSigner) Flush(ctx context.Context) ([]*entities.BlockSigner, error)
func (*BlockSigner) FlushUpsert ¶
func (bs *BlockSigner) FlushUpsert(ctx context.Context) ([]*entities.BlockSigner, error)
func (*BlockSigner) GetLastestBlockInStore ¶
func (bs *BlockSigner) GetLastestBlockInStore(ctx context.Context) (int64, error)
func (*BlockSigner) Upsert ¶
func (bs *BlockSigner) Upsert(ctx context.Context, newBlockSigner *entities.BlockSigner) error
type CometTxs ¶
type CometTxs struct { *vega_sqlstore.ConnectionSource // contains filtered or unexported fields }
func NewCometTxs ¶
func NewCometTxs(connectionSource *vega_sqlstore.ConnectionSource) *CometTxs
func (*CometTxs) AddWithoutTime ¶
func (*CometTxs) FlushUpsertWithoutTime ¶
func (*CometTxs) GetLastestBlockInStore ¶
type MonitoringStatus ¶ added in v0.9.0
type MonitoringStatus struct { *vega_sqlstore.ConnectionSource // contains filtered or unexported fields }
func NewMonitoringStatus ¶ added in v0.9.0
func NewMonitoringStatus(connectionSource *vega_sqlstore.ConnectionSource) *MonitoringStatus
func (*MonitoringStatus) Add ¶ added in v0.9.0
func (ms *MonitoringStatus) Add(status entities.MonitoringStatus)
func (*MonitoringStatus) FlushClear ¶ added in v0.9.0
func (ms *MonitoringStatus) FlushClear(ctx context.Context) ([]entities.MonitoringStatus, error)
FlushClear does not flush the events, it just clear the buffer up and return all the events to the caller
func (*MonitoringStatus) FlushUpsert ¶ added in v0.9.0
func (ms *MonitoringStatus) FlushUpsert(ctx context.Context) ([]entities.MonitoringStatus, error)
func (*MonitoringStatus) GetLatest ¶ added in v0.9.0
func (ms *MonitoringStatus) GetLatest(ctx context.Context) ([]entities.MonitoringStatus, error)
func (*MonitoringStatus) IsPendingFor ¶ added in v0.9.0
func (ms *MonitoringStatus) IsPendingFor(service entities.MonitoringServiceType) bool
func (*MonitoringStatus) UpsertSingle ¶ added in v0.9.0
func (ms *MonitoringStatus) UpsertSingle(ctx context.Context, entity entities.MonitoringStatus) error
type NetworkBalances ¶
type NetworkBalances struct { *vega_sqlstore.ConnectionSource NetworkBalances []entities.NetworkBalance }
func NewNetworkBalances ¶
func NewNetworkBalances(connectionSource *vega_sqlstore.ConnectionSource) *NetworkBalances
func (*NetworkBalances) Add ¶
func (nhs *NetworkBalances) Add(newBalance entities.NetworkBalance)
func (*NetworkBalances) FlushUpsert ¶
func (c *NetworkBalances) FlushUpsert(ctx context.Context) ([]entities.NetworkBalance, error)
func (*NetworkBalances) UpsertPartiesTotalBalance ¶
func (nhs *NetworkBalances) UpsertPartiesTotalBalance(ctx context.Context) error
func (*NetworkBalances) UpsertUnfinalizedDeposits ¶
func (nhs *NetworkBalances) UpsertUnfinalizedDeposits(ctx context.Context) error
func (*NetworkBalances) UpsertUnrealisedWithdrawalsBalance ¶
func (nhs *NetworkBalances) UpsertUnrealisedWithdrawalsBalance(ctx context.Context) error
func (*NetworkBalances) UpsertWithoutAssetId ¶
func (nhs *NetworkBalances) UpsertWithoutAssetId(ctx context.Context, newBalance entities.NetworkBalance) error
type NetworkHistorySegment ¶
type NetworkHistorySegment struct { *vega_sqlstore.ConnectionSource // contains filtered or unexported fields }
func NewNetworkHistorySegment ¶
func NewNetworkHistorySegment(connectionSource *vega_sqlstore.ConnectionSource) *NetworkHistorySegment
func (*NetworkHistorySegment) AddWithoutTime ¶
func (nhs *NetworkHistorySegment) AddWithoutTime(data *datanode.NetworkHistorySegment)
func (*NetworkHistorySegment) FlushUpsertWithoutTime ¶
func (nhs *NetworkHistorySegment) FlushUpsertWithoutTime(ctx context.Context) ([]*datanode.NetworkHistorySegment, error)
func (*NetworkHistorySegment) GetLatestSegmentsPerDataNode ¶ added in v0.9.0
func (nhs *NetworkHistorySegment) GetLatestSegmentsPerDataNode(ctx context.Context) ([]datanode.NetworkHistorySegment, error)
func (*NetworkHistorySegment) UpsertWithoutTime ¶
func (nhs *NetworkHistorySegment) UpsertWithoutTime(ctx context.Context, newSegment *datanode.NetworkHistorySegment) error
type RetentionPolicies ¶ added in v0.9.0
type RetentionPolicies []RetentionPolicy
func RetentionPoliciesFromConfig ¶ added in v0.9.0
func RetentionPoliciesFromConfig(basePolicy string, overrides []config.RetentionPolicy) (RetentionPolicies, error)
type RetentionPolicy ¶ added in v0.9.0
func (RetentionPolicy) AsString ¶ added in v0.9.0
func (rp RetentionPolicy) AsString() string
type StoreType ¶ added in v0.9.0
type StoreType string
const ( StoreAssetPool StoreType = "asset pool" StoreBlockSigner StoreType = "block signer" StoreCometTxs StoreType = "comet txs" StoreNetworkBalances StoreType = "network balances" StoreNetworkHistorySegment StoreType = "network history segment" StoreMonitoringStatus StoreType = "monitoring status" )
Click to show internal directories.
Click to hide internal directories.