Documentation ¶
Index ¶
Constants ¶
const ( // SensibleMaxEntriesCount defines an amount of entries within receipts which allows a milestone with 8 parents and 2 sigs/pub keys // to fly under the next pow requirement step. SensibleMaxEntriesCount = 110 )
Variables ¶
var ( // ErrStateFileAlreadyExists is returned when a new state is tried to be initialized but a state file already exists. ErrStateFileAlreadyExists = errors.New("migrator state file already exists") // ErrInvalidState is returned when the content of the state file is invalid. ErrInvalidState = errors.New("invalid migrator state") )
Functions ¶
This section is empty.
Types ¶
type OnServiceErrorFunc ¶
OnServiceErrorFunc is a function which is called when the service encounters an error which prevents it from functioning properly. Returning false from the error handler tells the service to terminate.
type Queryer ¶
type Queryer interface { QueryMigratedFunds(iotago.MilestoneIndex) ([]*iotago.MigratedFundsEntry, error) QueryNextMigratedFunds(iotago.MilestoneIndex) (iotago.MilestoneIndex, []*iotago.MigratedFundsEntry, error) }
Queryer defines the interface used to query the migrated funds.
type Service ¶ added in v1.0.0
type Service struct { Events *ServiceEvents // contains filtered or unexported fields }
Service is a service querying and validating batches of migrated funds.
func NewService ¶
NewService creates a new MigratorService.
func (*Service) InitState ¶ added in v1.0.0
func (s *Service) InitState(msIndex *iotago.MilestoneIndex) error
InitState initializes the state of s. If msIndex is not nil, s is bootstrapped using that index as its initial state, otherwise the state is loaded from file. The optional utxoManager is used to validate the initialized state against the DB. InitState must be called before Start.
func (*Service) PersistState ¶ added in v1.0.0
PersistState persists the current state to a file. PersistState must be called when the receipt returned by the last call of Receipt has been send to the network.
func (*Service) Receipt ¶ added in v1.0.0
func (s *Service) Receipt() *iotago.ReceiptMilestoneOpt
Receipt returns the next receipt of migrated funds. Each receipt can only consists of migrations confirmed by one milestone, it will never be larger than MaxMigratedFundsEntryCount. Receipt returns nil, if there are currently no new migrations available. Although the actual API calls and validations happen in the background, Receipt might block until the next receipt is ready. When s is stopped, Receipt will always return nil.
type ServiceEvents ¶ added in v1.0.0
type ServiceEvents struct { // SoftError is triggered when a soft error is encountered. SoftError *event.Event1[error] // MigratedFundsFetched is triggered when new migration funds were fetched from a legacy node. MigratedFundsFetched *event.Event1[[]*iotago.MigratedFundsEntry] }
ServiceEvents are events happening around a MigratorService.