Documentation ¶
Index ¶
- type BlockAuthenticator
- type CatchpointCatchupNodeServices
- type CatchpointCatchupService
- func MakeNewCatchpointCatchupService(catchpoint string, node CatchpointCatchupNodeServices, log logging.Logger, ...) (service *CatchpointCatchupService, err error)
- func MakeResumedCatchpointCatchupService(ctx context.Context, node CatchpointCatchupNodeServices, log logging.Logger, ...) (service *CatchpointCatchupService, err error)
- func (cs *CatchpointCatchupService) Abort()
- func (cs *CatchpointCatchupService) GetLatestBlockHeader() bookkeeping.BlockHeader
- func (cs *CatchpointCatchupService) GetStatistics() (out CatchpointCatchupStats)
- func (cs *CatchpointCatchupService) Start(ctx context.Context)
- func (cs *CatchpointCatchupService) Stop()
- type CatchpointCatchupStats
- type HTTPFetcher
- type Ledger
- type PendingUnmatchedCertificate
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockAuthenticator ¶
type BlockAuthenticator interface { Authenticate(*bookkeeping.Block, *agreement.Certificate) error Quit() }
A BlockAuthenticator authenticates blocks given a certificate.
Note that Authenticate does not check if the block contents match their header as it only checks the block header. If the contents have not been checked yet, callers should also call block.ContentsMatchHeader and reject blocks that do not pass this check.
type CatchpointCatchupNodeServices ¶
type CatchpointCatchupNodeServices interface {
SetCatchpointCatchupMode(bool) (newContextCh <-chan context.Context)
}
CatchpointCatchupNodeServices defines the extenal node support needed for the catchpoint service to switch the node between "regular" operational mode and catchup mode.
type CatchpointCatchupService ¶
type CatchpointCatchupService struct {
// contains filtered or unexported fields
}
CatchpointCatchupService represents the catchpoint catchup service.
func MakeNewCatchpointCatchupService ¶
func MakeNewCatchpointCatchupService(catchpoint string, node CatchpointCatchupNodeServices, log logging.Logger, net network.GossipNode, l *ledger.Ledger, cfg config.Local) (service *CatchpointCatchupService, err error)
MakeNewCatchpointCatchupService creates a new catchpoint catchup service for a node that is not in catchpoint catchup mode
func MakeResumedCatchpointCatchupService ¶
func MakeResumedCatchpointCatchupService(ctx context.Context, node CatchpointCatchupNodeServices, log logging.Logger, net network.GossipNode, l *ledger.Ledger, cfg config.Local) (service *CatchpointCatchupService, err error)
MakeResumedCatchpointCatchupService creates a catchpoint catchup service for a node that is already in catchpoint catchup mode
func (*CatchpointCatchupService) Abort ¶
func (cs *CatchpointCatchupService) Abort()
Abort aborts the catchpoint catchup process
func (*CatchpointCatchupService) GetLatestBlockHeader ¶
func (cs *CatchpointCatchupService) GetLatestBlockHeader() bookkeeping.BlockHeader
GetLatestBlockHeader returns the last block header that was available at the time the catchpoint catchup service started
func (*CatchpointCatchupService) GetStatistics ¶
func (cs *CatchpointCatchupService) GetStatistics() (out CatchpointCatchupStats)
GetStatistics returns a copy of the current catchpoint catchup statistics
func (*CatchpointCatchupService) Start ¶
func (cs *CatchpointCatchupService) Start(ctx context.Context)
Start starts the catchpoint catchup service ( continue in the process )
func (*CatchpointCatchupService) Stop ¶
func (cs *CatchpointCatchupService) Stop()
Stop stops the catchpoint catchup service - unlike Abort, this is not intended to abort the process but rather to allow cleanup of in-memory resources for the purpose of clean shutdown.
type CatchpointCatchupStats ¶
type CatchpointCatchupStats struct { CatchpointLabel string TotalAccounts uint64 ProcessedAccounts uint64 VerifiedAccounts uint64 TotalBlocks uint64 AcquiredBlocks uint64 VerifiedBlocks uint64 ProcessedBytes uint64 StartTime time.Time }
CatchpointCatchupStats is used for querying and reporting the current state of the catchpoint catchup process
type HTTPFetcher ¶
type HTTPFetcher struct {
// contains filtered or unexported fields
}
HTTPFetcher implements FetcherClient doing an HTTP GET of the block
type Ledger ¶
type Ledger interface { agreement.LedgerReader AddBlock(bookkeeping.Block, agreement.Certificate) error EnsureBlock(block *bookkeeping.Block, c agreement.Certificate) LastRound() basics.Round Block(basics.Round) (bookkeeping.Block, error) IsWritingCatchpointFile() bool Validate(ctx context.Context, blk bookkeeping.Block, executionPool execpool.BacklogPool) (*ledger.ValidatedBlock, error) AddValidatedBlock(vb ledger.ValidatedBlock, cert agreement.Certificate) error }
Ledger represents the interface of a block database which the catchup server should interact with.
type PendingUnmatchedCertificate ¶
type PendingUnmatchedCertificate struct { Cert agreement.Certificate VoteVerifier *agreement.AsyncVoteVerifier }
PendingUnmatchedCertificate is a single certificate that is being waited upon to have its corresponding block fetched.
type Service ¶
type Service struct { // The channel gets closed when the initial sync is complete. This allows for other services to avoid // the overhead of starting prematurely (before this node is caught-up and can validate messages for example). InitialSyncDone chan struct{} // contains filtered or unexported fields }
Service represents the catchup service. Once started and until it is stopped, it ensures that the ledger is up to date with network.
func MakeService ¶
func MakeService(log logging.Logger, config config.Local, net network.GossipNode, ledger Ledger, auth BlockAuthenticator, unmatchedPendingCertificates <-chan PendingUnmatchedCertificate, blockValidationPool execpool.BacklogPool) (s *Service)
MakeService creates a catchup service instance from its constituent components
func (*Service) IsSynchronizing ¶
IsSynchronizing returns true if we're currently executing a sync() call - either initial catchup or attempting to catchup after too-long waiting for next block. Also returns a 2nd bool indicating if this is our initial sync
func (*Service) Stop ¶
func (s *Service) Stop()
Stop informs the catchup service that it should stop, and waits for it to stop (when periodicSync() exits)
func (*Service) SynchronizingTime ¶
SynchronizingTime returns the time we've been performing a catchup operation (0 if not currently catching up)