sync

package
v1.3.3-testnet Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustSubEpoch

func MustSubEpoch(ctx context.Context, wg *sync.WaitGroup, cfx *sdk.Client, subscribers ...EpochSubscriber)

MustSubEpoch subscribes the latest mined epoch. Note, it will block the current thread.

Types

type DatabaseSyncer

type DatabaseSyncer struct {
	// contains filtered or unexported fields
}

DatabaseSyncer is used to sync blockchain data into database against the latest confirmed epoch.

func MustNewDatabaseSyncer

func MustNewDatabaseSyncer(cfx sdk.ClientOperator, db *mysql.MysqlStore) *DatabaseSyncer

MustNewDatabaseSyncer creates an instance of DatabaseSyncer to sync blockchain data.

func (*DatabaseSyncer) Sync

func (syncer *DatabaseSyncer) Sync(ctx context.Context, wg *sync.WaitGroup)

Sync starts to sync epoch blockchain data.

type EpochSubscriber

type EpochSubscriber interface {
	// contains filtered or unexported methods
}

EpochSubscriber is an interface to consume subscribed epochs.

func NewConsoleEpochSubscriber

func NewConsoleEpochSubscriber(cfx sdk.ClientOperator) EpochSubscriber

NewConsoleEpochSubscriber creates an instance of EpochSubscriber to consume epoch.

type EthSyncer

type EthSyncer struct {
	// contains filtered or unexported fields
}

EthSyncer is used to synchronize evm space blockchain data into db store.

func MustNewEthSyncer

func MustNewEthSyncer(ethC *web3go.Client, db *mysql.MysqlStore) *EthSyncer

MustNewEthSyncer creates an instance of EthSyncer to sync Conflux EVM space chaindata.

func (*EthSyncer) Sync

func (syncer *EthSyncer) Sync(ctx context.Context, wg *sync.WaitGroup)

Sync starts to sync Conflux EVM space blockchain data.

type KVCacheSyncer

type KVCacheSyncer struct {
	// contains filtered or unexported fields
}

KVCacheSyncer is used to sync core space blockchain data into kv cache against the latest state epoch.

func MustNewKVCacheSyncer

func MustNewKVCacheSyncer(cfx sdk.ClientOperator, cache store.CacheStore) *KVCacheSyncer

MustNewKVCacheSyncer creates an instance of KVCacheSyncer to sync the latest state epoch data.

func (*KVCacheSyncer) Sync

func (syncer *KVCacheSyncer) Sync(ctx context.Context, wg *sync.WaitGroup)

Sync starts to sync epoch data from blockchain to cache.

type PruneConfig

type PruneConfig struct {
	PruneInterval  time.Duration  `mapstructure:"interval"`  // interval to run pruning
	Threshold      PruneThresHold `mapstructure:"threshold"` // threshold for pruning
	MaxPruneEpochs uint64         `mapstructure:"maxEpochs"` // max epochs to prune if threshold condition met
}

type PruneThresHold

type PruneThresHold struct {
	MaxBlocks uint64 `mapstructure:"maxBlocks"` // max number of blocks to trigger block pruning
	MaxTxs    uint64 `mapstructure:"maxTxs"`    // max number of transactions to trigger transaction pruning
	MaxLogs   uint64 `mapstructure:"maxLogs"`   // max number of logs to trigger log pruning
}

Threshold settings for pruner

type Pruner

type Pruner struct {
	// contains filtered or unexported fields
}

Pruner is used to prune blockchain data in store periodly. It will prune blockchain data in store with epoch as the smallest unit to retain data atomicity.

func MustNewKVCachePruner

func MustNewKVCachePruner(cache store.Prunable) *Pruner

MustNewKVCachePruner creates an instance of Pruner to prune blockchain data in kv cache

func (*Pruner) Prune

func (pruner *Pruner) Prune(ctx context.Context, wg *sync.WaitGroup)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL