2021-02-01 12:40:07 +00:00
|
|
|
package common
|
|
|
|
|
|
|
|
import (
|
|
|
|
"math/big"
|
|
|
|
|
2022-12-23 17:35:35 +00:00
|
|
|
cid "github.com/TrueCloudLab/frostfs-sdk-go/container/id"
|
|
|
|
"github.com/TrueCloudLab/frostfs-sdk-go/user"
|
2021-02-01 12:40:07 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// NodeInfo groups the data about the storage node
|
|
|
|
// necessary for calculating audit fees.
|
|
|
|
type NodeInfo interface {
|
|
|
|
// Must return storage price of the node for one epoch in GASe-12.
|
|
|
|
Price() *big.Int
|
|
|
|
|
|
|
|
// Must return public key of the node.
|
|
|
|
PublicKey() []byte
|
|
|
|
}
|
|
|
|
|
|
|
|
// ContainerInfo groups the data about NeoFS container
|
|
|
|
// necessary for calculating audit fee.
|
|
|
|
type ContainerInfo interface {
|
|
|
|
// Must return identifier of the container owner.
|
2022-05-31 17:00:41 +00:00
|
|
|
Owner() user.ID
|
2021-02-01 12:40:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ContainerStorage is an interface of
|
|
|
|
// storage of the NeoFS containers.
|
|
|
|
type ContainerStorage interface {
|
|
|
|
// Must return information about the container by ID.
|
2022-05-31 17:00:41 +00:00
|
|
|
ContainerInfo(cid.ID) (ContainerInfo, error)
|
2021-02-01 12:40:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// PlacementCalculator is a component interface
|
|
|
|
// that builds placement vectors.
|
|
|
|
type PlacementCalculator interface {
|
2022-05-31 17:00:41 +00:00
|
|
|
// Must return information about the nodes from container by its ID of the given epoch.
|
|
|
|
ContainerNodes(uint64, cid.ID) ([]NodeInfo, error)
|
2021-02-01 12:40:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// AccountStorage is an network member accounts interface.
|
|
|
|
type AccountStorage interface {
|
|
|
|
// Must resolve information about the storage node
|
|
|
|
// to its ID in system.
|
2022-05-17 13:59:46 +00:00
|
|
|
ResolveKey(NodeInfo) (*user.ID, error)
|
2021-02-01 12:40:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Exchanger is an interface of monetary component.
|
|
|
|
type Exchanger interface {
|
|
|
|
// Must transfer amount of GASe-12 from sender to recipient.
|
|
|
|
//
|
|
|
|
// Amount must be positive.
|
2022-05-31 17:00:41 +00:00
|
|
|
Transfer(sender, recipient user.ID, amount *big.Int, details []byte)
|
2021-02-01 12:40:07 +00:00
|
|
|
}
|