d48fb81193
Implement a component for transmitting the value of the used container space along a route defined in the system. Implement WriterProvider interface on it. By implementation, it is the link between the route planner and the point-to-point transmitter, and abstracts from the implementation of both of them. In the future, this implementation will be used as a transmitter of local estimates of storage nodes among themselves. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
41 lines
1.2 KiB
Go
41 lines
1.2 KiB
Go
package loadroute
|
|
|
|
import (
|
|
"github.com/nspcc-dev/neofs-api-go/pkg/container"
|
|
loadcontroller "github.com/nspcc-dev/neofs-node/pkg/services/container/announcement/load/controller"
|
|
)
|
|
|
|
// ServerInfo describes a set of
|
|
// characteristics of a point in a route.
|
|
type ServerInfo interface {
|
|
// PublicKey returns public key of the node
|
|
// from the route in a binary representation.
|
|
PublicKey() []byte
|
|
|
|
// Returns network address of the node
|
|
// in the route.
|
|
//
|
|
// Can be empty.
|
|
Address() string
|
|
}
|
|
|
|
// Builder groups methods to route values in the network.
|
|
type Builder interface {
|
|
// NextStage must return next group of route points for the value a
|
|
// based on the passed route.
|
|
//
|
|
// Empty passed list means being at the starting point of the route.
|
|
//
|
|
// Must return empty list and no error if the endpoint of the route is reached.
|
|
NextStage(a container.UsedSpaceAnnouncement, passed []ServerInfo) ([]ServerInfo, error)
|
|
}
|
|
|
|
// RemoteWriterProvider describes the component
|
|
// for sending values to a fixed route point.
|
|
type RemoteWriterProvider interface {
|
|
// InitRemote must return WriterProvider to the route point
|
|
// corresponding to info.
|
|
//
|
|
// Nil info matches the end of the route.
|
|
InitRemote(info ServerInfo) (loadcontroller.WriterProvider, error)
|
|
}
|