Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CalculatePrm ¶
type CalculatePrm struct { // Number of epoch to perform the calculation. Epoch uint64 }
CalculatePrm groups required parameters of Calculator.CalculateForEpoch call.
type Calculator ¶
type Calculator struct {
// contains filtered or unexported fields
}
Calculator represents component for calculating payments based on data audit results and sending remittances to the chain.
func NewCalculator ¶
func NewCalculator(p *CalculatorPrm, opts ...CalculatorOption) *Calculator
NewCalculator creates, initializes and returns new Calculator instance.
func (*Calculator) Calculate ¶
func (c *Calculator) Calculate(p *CalculatePrm)
Calculate calculates payments for audit results in a specific epoch of the network. Wraps the results in a money transfer transaction and sends it to the network.
type CalculatorOption ¶
type CalculatorOption func(*options)
CalculatorOption is a Calculator constructor's option.
func WithLogger ¶
func WithLogger(l *logger.Logger) CalculatorOption
WithLogger returns option to specify logging component.
type CalculatorPrm ¶
type CalculatorPrm struct { ResultStorage ResultStorage ContainerStorage common.ContainerStorage PlacementCalculator common.PlacementCalculator SGStorage SGStorage AccountStorage common.AccountStorage Exchanger common.Exchanger AuditFeeFetcher FeeFetcher }
CalculatorPrm groups the parameters of Calculator's constructor.
type FeeFetcher ¶ added in v0.19.0
FeeFetcher wraps AuditFee method that returns audit fee price from the network configuration.
type ResultStorage ¶
type ResultStorage interface { // Must return all audit results by epoch number. AuditResultsForEpoch(epoch uint64) ([]*audit.Result, error) }
ResultStorage is an interface of storage of the audit results.