Documentation ¶
Index ¶
- type Job
- type Loader
- type TrxDBLoader
- func (l *TrxDBLoader) BuildPipelineBatch(startBlockNum uint64, numBlocksBeforeStart uint64)
- func (l *TrxDBLoader) BuildPipelineJob(startBlockNum uint64, numBlocksBeforeStart uint64, job Job)
- func (l *TrxDBLoader) BuildPipelineLive(allowLiveOnEmptyTable bool) error
- func (l *TrxDBLoader) BuildPipelinePatch(startBlockNum uint64, numBlocksBeforeStart uint64)
- func (l *TrxDBLoader) DoFlush(blockNum uint64, reason string) error
- func (l *TrxDBLoader) FlushIfNeeded(blockNum uint64, blockTime time.Time) error
- func (l *TrxDBLoader) FullJob(blockNum uint64, block *pbcodec.Block, fObj *forkable.ForkableObject) (err error)
- func (l *TrxDBLoader) Healthy() bool
- func (l *TrxDBLoader) Launch()
- func (l *TrxDBLoader) PatchJob(blockNum uint64, blk *pbcodec.Block, fObj *forkable.ForkableObject) (err error)
- func (l *TrxDBLoader) ProcessBlock(blk *bstream.Block, obj interface{}) (err error)
- func (l *TrxDBLoader) ShowProgress(blockNum uint64)
- func (l *TrxDBLoader) StopBeforeBlock(blockNum uint64)
- func (l *TrxDBLoader) UpdateIrreversibleData(nowIrreversibleBlocks []*bstream.PreprocessedBlock) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Loader ¶
type Loader interface { StopBeforeBlock(uint64) BuildPipelineLive(bool) error BuildPipelineBatch(startBlock uint64, beforeStart uint64) BuildPipelinePatch(startBlock uint64, beforeStart uint64) Launch() Healthy() bool // Shutter related Shutdown(err error) OnTerminated(f func(error)) Terminated() <-chan struct{} Err() error }
type TrxDBLoader ¶
func NewTrxDBLoader ¶
func NewTrxDBLoader( blockStreamAddr string, blocksStore dstore.Store, batchSize uint64, db trxdb.DBWriter, parallelFileDownloadCount int, blockFilter func(blk *bstream.Block) error, truncationWindow uint64, blockmeta pbblockmeta.BlockIDClient, ) *TrxDBLoader
func (*TrxDBLoader) BuildPipelineBatch ¶
func (l *TrxDBLoader) BuildPipelineBatch(startBlockNum uint64, numBlocksBeforeStart uint64)
func (*TrxDBLoader) BuildPipelineJob ¶
func (l *TrxDBLoader) BuildPipelineJob(startBlockNum uint64, numBlocksBeforeStart uint64, job Job)
func (*TrxDBLoader) BuildPipelineLive ¶
func (l *TrxDBLoader) BuildPipelineLive(allowLiveOnEmptyTable bool) error
func (*TrxDBLoader) BuildPipelinePatch ¶
func (l *TrxDBLoader) BuildPipelinePatch(startBlockNum uint64, numBlocksBeforeStart uint64)
func (*TrxDBLoader) FlushIfNeeded ¶
func (l *TrxDBLoader) FlushIfNeeded(blockNum uint64, blockTime time.Time) error
func (*TrxDBLoader) FullJob ¶
func (l *TrxDBLoader) FullJob(blockNum uint64, block *pbcodec.Block, fObj *forkable.ForkableObject) (err error)
fullJob does all the database insertions needed to load the blockchain into our database.
func (*TrxDBLoader) Healthy ¶
func (l *TrxDBLoader) Healthy() bool
func (*TrxDBLoader) Launch ¶
func (l *TrxDBLoader) Launch()
func (*TrxDBLoader) PatchJob ¶
func (l *TrxDBLoader) PatchJob(blockNum uint64, blk *pbcodec.Block, fObj *forkable.ForkableObject) (err error)
patchDatabase is a "scratch" pad to define patch code that can be applied on an ad-hoc basis. The idea is to leave this function empty when no patch needs to be applied.
When a patch is required, the suggested workflow is to develop the patch code in a side branch. When the code is ready, the "production" commit is tagged with the `patch-<tag>-<date>` where the tag is giving an overview of the patch and the date is the effective date (`<year>-<month>-<day>`): `patch-add-trx-meta-written-2019-06-30`. The branch is then deleted and the tag is pushed to the remote repository.
func (*TrxDBLoader) ProcessBlock ¶
func (l *TrxDBLoader) ProcessBlock(blk *bstream.Block, obj interface{}) (err error)
func (*TrxDBLoader) ShowProgress ¶
func (l *TrxDBLoader) ShowProgress(blockNum uint64)
func (*TrxDBLoader) StopBeforeBlock ¶
func (l *TrxDBLoader) StopBeforeBlock(blockNum uint64)
StopBeforeBlock indicates the stop block (exclusive), means that block num will not be inserted.
func (*TrxDBLoader) UpdateIrreversibleData ¶
func (l *TrxDBLoader) UpdateIrreversibleData(nowIrreversibleBlocks []*bstream.PreprocessedBlock) error