2021-01-26 10:27:30 +00:00
|
|
|
package audit
|
|
|
|
|
|
|
|
import (
|
2021-02-01 12:40:07 +00:00
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/innerring/processors/settlement/common"
|
2021-11-10 07:08:33 +00:00
|
|
|
"github.com/nspcc-dev/neofs-sdk-go/audit"
|
2022-05-31 17:00:41 +00:00
|
|
|
oid "github.com/nspcc-dev/neofs-sdk-go/object/id"
|
2021-01-26 10:27:30 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// CalculatorPrm groups the parameters of Calculator's constructor.
|
|
|
|
type CalculatorPrm struct {
|
|
|
|
ResultStorage ResultStorage
|
|
|
|
|
2021-02-01 12:40:07 +00:00
|
|
|
ContainerStorage common.ContainerStorage
|
2021-01-26 10:27:30 +00:00
|
|
|
|
2021-02-01 12:40:07 +00:00
|
|
|
PlacementCalculator common.PlacementCalculator
|
2021-01-26 10:27:30 +00:00
|
|
|
|
|
|
|
SGStorage SGStorage
|
|
|
|
|
2021-02-01 12:40:07 +00:00
|
|
|
AccountStorage common.AccountStorage
|
2021-01-26 10:27:30 +00:00
|
|
|
|
2021-02-01 12:40:07 +00:00
|
|
|
Exchanger common.Exchanger
|
2021-04-07 10:51:47 +00:00
|
|
|
|
|
|
|
AuditFeeFetcher FeeFetcher
|
2021-01-26 10:27:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ResultStorage is an interface of storage of the audit results.
|
|
|
|
type ResultStorage interface {
|
|
|
|
// Must return all audit results by epoch number.
|
|
|
|
AuditResultsForEpoch(epoch uint64) ([]*audit.Result, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
// SGInfo groups the data about NeoFS storage group
|
|
|
|
// necessary for calculating audit fee.
|
|
|
|
type SGInfo interface {
|
|
|
|
// Must return sum size of the all group members.
|
|
|
|
Size() uint64
|
|
|
|
}
|
|
|
|
|
|
|
|
// SGStorage is an interface of storage of the storage groups.
|
|
|
|
type SGStorage interface {
|
|
|
|
// Must return information about the storage group by address.
|
2022-05-31 17:00:41 +00:00
|
|
|
SGInfo(oid.Address) (SGInfo, error)
|
2021-01-26 10:27:30 +00:00
|
|
|
}
|
2021-04-07 10:51:47 +00:00
|
|
|
|
|
|
|
// FeeFetcher wraps AuditFee method that returns audit fee price from
|
|
|
|
// the network configuration.
|
|
|
|
type FeeFetcher interface {
|
|
|
|
AuditFee() (uint64, error)
|
|
|
|
}
|