Documentation
¶
Index ¶
- type BlockStorageHelper
- type ReconcilerHandler
- type ReconcilerHelper
- func (h *ReconcilerHelper) AccountBalance(ctx context.Context, account *types.AccountIdentifier, ...) (*types.Amount, *types.BlockIdentifier, error)
- func (h *ReconcilerHelper) BlockExists(ctx context.Context, block *types.BlockIdentifier) (bool, error)
- func (h *ReconcilerHelper) CurrentBlock(ctx context.Context) (*types.BlockIdentifier, error)
- type SyncerHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockStorageHelper ¶
type BlockStorageHelper struct {
// contains filtered or unexported fields
}
BlockStorageHelper implements the storage.Helper interface.
func NewBlockStorageHelper ¶
func NewBlockStorageHelper( network *types.NetworkIdentifier, fetcher *fetcher.Fetcher, lookupBalanceByBlock bool, exemptAccounts []*reconciler.AccountCurrency, ) *BlockStorageHelper
NewBlockStorageHelper returns a new BlockStorageHelper.
func (*BlockStorageHelper) AccountBalance ¶
func (h *BlockStorageHelper) AccountBalance( ctx context.Context, account *types.AccountIdentifier, currency *types.Currency, block *types.BlockIdentifier, ) (*types.Amount, error)
AccountBalance attempts to fetch the balance for a missing account in storage. This is necessary for running the "check" command at an arbitrary height instead of syncing from genesis.
func (*BlockStorageHelper) Asserter ¶
func (h *BlockStorageHelper) Asserter() *asserter.Asserter
Asserter returns a *asserter.Asserter.
func (*BlockStorageHelper) ExemptFunc ¶
func (h *BlockStorageHelper) ExemptFunc() parser.ExemptOperation
ExemptFunc returns a parser.ExemptOperation.
type ReconcilerHandler ¶
type ReconcilerHandler struct {
InactiveFailure *reconciler.AccountCurrency
InactiveFailureBlock *types.BlockIdentifier
ActiveFailureBlock *types.BlockIdentifier
// contains filtered or unexported fields
}
ReconcilerHandler implements the Reconciler.Handler interface.
func NewReconcilerHandler ¶
func NewReconcilerHandler( logger *logger.Logger, haltOnReconciliationError bool, ) *ReconcilerHandler
NewReconcilerHandler creates a new ReconcilerHandler.
func (*ReconcilerHandler) ReconciliationFailed ¶
func (h *ReconcilerHandler) ReconciliationFailed( ctx context.Context, reconciliationType string, account *types.AccountIdentifier, currency *types.Currency, computedBalance string, nodeBalance string, block *types.BlockIdentifier, ) error
ReconciliationFailed is called each time a reconciliation fails. In this Handler implementation, we halt if haltOnReconciliationError was set to true. We also cancel the context.
func (*ReconcilerHandler) ReconciliationSucceeded ¶
func (h *ReconcilerHandler) ReconciliationSucceeded( ctx context.Context, reconciliationType string, account *types.AccountIdentifier, currency *types.Currency, balance string, block *types.BlockIdentifier, ) error
ReconciliationSucceeded is called each time a reconciliation succeeds.
type ReconcilerHelper ¶
type ReconcilerHelper struct {
// contains filtered or unexported fields
}
ReconcilerHelper implements the Reconciler.Helper interface.
func NewReconcilerHelper ¶
func NewReconcilerHelper( storage *storage.BlockStorage, ) *ReconcilerHelper
NewReconcilerHelper returns a new ReconcilerHelper.
func (*ReconcilerHelper) AccountBalance ¶
func (h *ReconcilerHelper) AccountBalance( ctx context.Context, account *types.AccountIdentifier, currency *types.Currency, headBlock *types.BlockIdentifier, ) (*types.Amount, *types.BlockIdentifier, error)
AccountBalance returns the balance of an account in block storage. It is necessary to perform this check outside of the Reconciler package to allow for separation from a default storage backend.
func (*ReconcilerHelper) BlockExists ¶
func (h *ReconcilerHelper) BlockExists( ctx context.Context, block *types.BlockIdentifier, ) (bool, error)
BlockExists returns a boolean indicating if block_storage contains a block. This is necessary to reconcile across reorgs. If the block returned on an account balance fetch does not exist, reconciliation will be skipped.
func (*ReconcilerHelper) CurrentBlock ¶
func (h *ReconcilerHelper) CurrentBlock( ctx context.Context, ) (*types.BlockIdentifier, error)
CurrentBlock returns the last processed block and is used to determine which block to check account balances at during inactive reconciliation.
type SyncerHandler ¶
type SyncerHandler struct {
// contains filtered or unexported fields
}
SyncerHandler implements the syncer.Handler interface.
func NewSyncerHandler ¶
func NewSyncerHandler( blockStorage *storage.BlockStorage, logger *logger.Logger, reconciler *reconciler.Reconciler, fetcher *fetcher.Fetcher, interestingAccount *reconciler.AccountCurrency, ) *SyncerHandler
NewSyncerHandler returns a new SyncerHandler.
func (*SyncerHandler) BlockAdded ¶
BlockAdded is called by the syncer after a block is added.
func (*SyncerHandler) BlockRemoved ¶
func (h *SyncerHandler) BlockRemoved( ctx context.Context, blockIdentifier *types.BlockIdentifier, ) error
BlockRemoved is called by the syncer after a block is removed.