Documentation ¶
Index ¶
- Constants
- Variables
- func CheckProgress()
- func DeepCopyByGob(src, dst interface{}) error
- func DumpLogo() string
- func DumpVersion() string
- func NewBlockSyncerModular(app *gfspapp.GfSpBaseApp, cfg *gfspconfig.GfSpConfig) (coremodule.Modular, error)
- func NewIndexer(codec codec.Codec, proxy node.Node, db database.Database, ...) parser.Indexer
- func RegisterModular()
- func StopMainService() error
- func StorageProvider(ctx *cli.Context) error
- func SwitchMasterDBFlag() error
- type BlockSyncerE2eBaseSuite
- type BlockSyncerModular
- func (b *BlockSyncerModular) Name() string
- func (b *BlockSyncerModular) ReleaseResource(ctx context.Context, span rcmgr.ResourceScopeSpan)
- func (b *BlockSyncerModular) ReserveResource(ctx context.Context, state *rcmgr.ScopeStat) (rcmgr.ResourceScopeSpan, error)
- func (b *BlockSyncerModular) Start(ctx context.Context) error
- func (b *BlockSyncerModular) Stop(ctx context.Context) error
- type Impl
- func (i *Impl) CreateMasterTable() error
- func (i *Impl) ExportAccounts(block *coretypes.ResultBlock, txs []*types.Tx) error
- func (i *Impl) ExportBlock(block *coretypes.ResultBlock, events *coretypes.ResultBlockResults, ...) error
- func (i *Impl) ExportCommit(block *coretypes.ResultBlock, getTmcValidators modules.GetTmcValidators) error
- func (i *Impl) ExportEpoch(block *coretypes.ResultBlock) error
- func (i *Impl) ExportEvents(ctx context.Context, block *coretypes.ResultBlock, ...) error
- func (i *Impl) ExportEventsInTxs(ctx context.Context, block *coretypes.ResultBlock, ...) ([]map[string][]interface{}, error)
- func (i *Impl) ExportEventsWithoutTx(ctx context.Context, block *coretypes.ResultBlock, events []abci.Event) ([]map[string][]interface{}, error)
- func (i *Impl) ExportTxs(block *coretypes.ResultBlock, txs []*types.Tx) error
- func (i *Impl) ExtractEvent(ctx context.Context, block *coretypes.ResultBlock, txHash common.Hash, ...) (map[string][]interface{}, error)
- func (i *Impl) GetBlockRecordNum(_ context.Context) int64
- func (i *Impl) GetLastBlockRecordHeight(ctx context.Context) (uint64, error)
- func (i *Impl) GetLatestBlockHeight() *atomic.Value
- func (i *Impl) GetServiceName() string
- func (i *Impl) HandleBlock(block *coretypes.ResultBlock, events *coretypes.ResultBlockResults, ...)
- func (i *Impl) HandleEvent(ctx context.Context, block *coretypes.ResultBlock, txHash common.Hash, ...) error
- func (i *Impl) HandleGenesis(genesisDoc *tmtypes.GenesisDoc, appState map[string]json.RawMessage) error
- func (i *Impl) HandleMessage(block *coretypes.ResultBlock, index int, msg sdk.Msg, tx *types.Tx)
- func (i *Impl) HandleTx(tx *types.Tx)
- func (i *Impl) Process(height uint64) error
- func (i *Impl) Processed(ctx context.Context, height uint64) (bool, error)
- func (i *Impl) SaveBlockResult(blockHeight uint64, result *coretypes.ResultBlockResults)
- func (i *Impl) SaveEpoch(block *coretypes.ResultBlock) (string, []interface{})
- type MigrateDBKey
- type TxHashEvent
Constants ¶
const ( // MaxRetryCount defines getting the latest height from the RPC client max retry count MaxRetryCount = 50 // DefaultBlockHeightDiff defines default block height diff of main and backup service DefaultBlockHeightDiff = 100 // DefaultCheckDiffPeriod defines check interval of block height diff DefaultCheckDiffPeriod = 1 // MaxHeightGapFactor defines the gap coefficient between the block height in the Map and the processed block height MaxHeightGapFactor = 4 ObjectsNumberOfShards = 64 MinChargeSize = 128000 CommitNumber = 2000 )
const (
StorageProviderLogo = `` /* 460-byte string literal not displayed */
)
Variables ¶
var ( BlockSyncerModularBackupName = strings.ToLower("BlockSyncerBackup") // DsnBlockSyncer defines env variable name for block syncer dsn DsnBlockSyncer = "BLOCK_SYNCER_DSN" // DsnBlockSyncerSwitched defines env variable name for block syncer backup dsn DsnBlockSyncerSwitched = "BLOCK_SYNCER_DSN_SWITCHED" ErrDSNNotSet = errors.New("dsn config is not set in environment") ErrBlockNotFound = errors.New("failed to get block from map need retry") ErrHandleEvent = errors.New("failed to handle event") ErrEventNotFound = errors.New("failed to get event from tx map") )
var ( RealTimeStart *atomic.Bool CatchEndBlock *atomic.Int64 MainService *BlockSyncerModular BackupService *BlockSyncerModular FlagDB *db.DB NeedBackup bool CancelMain func() CtxMain context.Context )
Read concurrency required global variables
var ( Version string CommitID string BranchName string BuildTime string )
var App *cli.App
var VersionCmd = &cli.Command{ Action: versionAction, Name: "version", Aliases: []string{"v"}, Usage: "Print version information", Category: "MISCELLANEOUS COMMANDS", Description: `The output of this command is supposed to be machine-readable.`, }
Functions ¶
func CheckProgress ¶
func CheckProgress()
func DeepCopyByGob ¶
func DeepCopyByGob(src, dst interface{}) error
func DumpLogo ¶ added in v0.2.5
func DumpLogo() string
DumpLogo output greenfield storage provider logo
func DumpVersion ¶ added in v0.2.5
func DumpVersion() string
DumpVersion output the storage provider version information
func NewBlockSyncerModular ¶
func NewBlockSyncerModular(app *gfspapp.GfSpBaseApp, cfg *gfspconfig.GfSpConfig) (coremodule.Modular, error)
func NewIndexer ¶
func RegisterModular ¶ added in v0.2.5
func RegisterModular()
func StopMainService ¶
func StopMainService() error
func StorageProvider ¶ added in v0.2.5
func StorageProvider(ctx *cli.Context) error
func SwitchMasterDBFlag ¶
func SwitchMasterDBFlag() error
Types ¶
type BlockSyncerE2eBaseSuite ¶ added in v0.2.5
func (*BlockSyncerE2eBaseSuite) SetupSuite ¶ added in v0.2.5
func (s *BlockSyncerE2eBaseSuite) SetupSuite()
type BlockSyncerModular ¶
type BlockSyncerModular struct { DataMonitorEnable bool DataStatisticsDuration int64 BlockResultStorage bool MaxBlockNum int64 // contains filtered or unexported fields }
BlockSyncerModular synchronizes storage,payment,permission data to db by handling related events
func (*BlockSyncerModular) Name ¶
func (b *BlockSyncerModular) Name() string
func (*BlockSyncerModular) ReleaseResource ¶
func (b *BlockSyncerModular) ReleaseResource(ctx context.Context, span rcmgr.ResourceScopeSpan)
func (*BlockSyncerModular) ReserveResource ¶
func (b *BlockSyncerModular) ReserveResource(ctx context.Context, state *rcmgr.ScopeStat) (rcmgr.ResourceScopeSpan, error)
type Impl ¶
type Impl struct { Modules []modules.Module Node node.Node DB database.Database LatestBlockHeight atomic.Value ProcessedHeight uint64 CommitNumber uint64 BlockResultStorageEnable bool ServiceName string // contains filtered or unexported fields }
func (*Impl) CreateMasterTable ¶
func (*Impl) ExportAccounts ¶
ExportAccounts accepts a slice of transactions and persists accounts inside the database. An error is returned if write fails.
func (*Impl) ExportBlock ¶
func (i *Impl) ExportBlock(block *coretypes.ResultBlock, events *coretypes.ResultBlockResults, txs []*types.Tx, getTmcValidators modules.GetTmcValidators) error
ExportBlock accepts a finalized block and persists then inside the database. An error is returned if write fails.
func (*Impl) ExportCommit ¶
func (i *Impl) ExportCommit(block *coretypes.ResultBlock, getTmcValidators modules.GetTmcValidators) error
ExportCommit accepts ResultValidators and persists validator commit signatures inside the database. An error is returned if write fails.
func (*Impl) ExportEpoch ¶
func (i *Impl) ExportEpoch(block *coretypes.ResultBlock) error
func (*Impl) ExportEvents ¶
func (i *Impl) ExportEvents(ctx context.Context, block *coretypes.ResultBlock, events *coretypes.ResultBlockResults) error
ExportEvents accepts a slice of transactions and get events in order to save in database.
func (*Impl) ExportEventsInTxs ¶
func (i *Impl) ExportEventsInTxs(ctx context.Context, block *coretypes.ResultBlock, txs map[common.Hash][]abci.Event, txHash tmtypes.Txs) ([]map[string][]interface{}, error)
ExportEventsInTxs accepts a slice of events in tx in order to save in database.
func (*Impl) ExportEventsWithoutTx ¶
func (i *Impl) ExportEventsWithoutTx(ctx context.Context, block *coretypes.ResultBlock, events []abci.Event) ([]map[string][]interface{}, error)
ExportEventsWithoutTx accepts a slice of events not in tx in order to save in database. events here don't have txHash
func (*Impl) ExportTxs ¶
ExportTxs accepts a slice of transactions and persists then inside the database. An error is returned if write fails.
func (*Impl) ExtractEvent ¶ added in v0.2.3
func (i *Impl) ExtractEvent(ctx context.Context, block *coretypes.ResultBlock, txHash common.Hash, event sdk.Event) (map[string][]interface{}, error)
ExtractEvent accepts the transaction and handles events contained inside the transaction.
func (*Impl) GetBlockRecordNum ¶
GetBlockRecordNum returns total number of blocks stored in database.
func (*Impl) GetLastBlockRecordHeight ¶
GetLastBlockRecordHeight returns the last block height stored inside the database
func (*Impl) GetLatestBlockHeight ¶
func (*Impl) GetServiceName ¶
func (*Impl) HandleBlock ¶
func (i *Impl) HandleBlock(block *coretypes.ResultBlock, events *coretypes.ResultBlockResults, txs []*types.Tx, getTmcValidators modules.GetTmcValidators)
HandleBlock accepts block and calls the block handlers.
func (*Impl) HandleEvent ¶
func (*Impl) HandleGenesis ¶
func (i *Impl) HandleGenesis(genesisDoc *tmtypes.GenesisDoc, appState map[string]json.RawMessage) error
HandleGenesis accepts a GenesisDoc and calls all the registered genesis handlers in the order in which they have been registered.
func (*Impl) HandleMessage ¶
HandleMessage accepts the transaction and handles messages contained inside the transaction.
func (*Impl) Process ¶
Process fetches a block for a given height and associated metadata and export it to a database. It returns an error if any export process fails.
func (*Impl) Processed ¶
Processed tells whether the current Indexer has already processed the given height of Block An error is returned if the operation fails.
func (*Impl) SaveBlockResult ¶ added in v1.8.0
func (i *Impl) SaveBlockResult(blockHeight uint64, result *coretypes.ResultBlockResults)
type MigrateDBKey ¶
type MigrateDBKey struct{}