2021-06-21 14:13:08 +00:00
|
|
|
package client
|
|
|
|
|
|
|
|
import (
|
2022-01-13 15:01:50 +00:00
|
|
|
"context"
|
|
|
|
"io"
|
|
|
|
|
2021-11-06 11:13:04 +00:00
|
|
|
rawclient "github.com/nspcc-dev/neofs-api-go/v2/rpc/client"
|
2021-06-21 14:13:08 +00:00
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/network"
|
2021-11-10 07:08:33 +00:00
|
|
|
"github.com/nspcc-dev/neofs-sdk-go/client"
|
2021-06-21 14:13:08 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Client is an interface of NeoFS storage
|
|
|
|
// node's client.
|
|
|
|
type Client interface {
|
2022-01-21 16:53:06 +00:00
|
|
|
AnnounceContainerUsedSpace(context.Context, client.AnnounceSpacePrm) (*client.AnnounceSpaceRes, error)
|
2022-01-13 15:01:50 +00:00
|
|
|
|
|
|
|
PutObject(context.Context, *client.PutObjectParams, ...client.CallOption) (*client.ObjectPutRes, error)
|
|
|
|
DeleteObject(context.Context, *client.DeleteObjectParams, ...client.CallOption) (*client.ObjectDeleteRes, error)
|
|
|
|
GetObject(context.Context, *client.GetObjectParams, ...client.CallOption) (*client.ObjectGetRes, error)
|
|
|
|
HeadObject(context.Context, *client.ObjectHeaderParams, ...client.CallOption) (*client.ObjectHeadRes, error)
|
|
|
|
SearchObjects(context.Context, *client.SearchObjectParams, ...client.CallOption) (*client.ObjectSearchRes, error)
|
|
|
|
ObjectPayloadRangeData(context.Context, *client.RangeDataParams, ...client.CallOption) (*client.ObjectRangeRes, error)
|
|
|
|
HashObjectPayloadRanges(context.Context, *client.RangeChecksumParams, ...client.CallOption) (*client.ObjectRangeHashRes, error)
|
|
|
|
|
2022-01-21 16:53:06 +00:00
|
|
|
AnnounceLocalTrust(context.Context, client.AnnounceLocalTrustPrm) (*client.AnnounceLocalTrustRes, error)
|
|
|
|
AnnounceIntermediateTrust(context.Context, client.AnnounceIntermediateTrustPrm) (*client.AnnounceIntermediateTrustRes, error)
|
2022-01-13 15:01:50 +00:00
|
|
|
|
|
|
|
Raw() *rawclient.Client
|
|
|
|
|
|
|
|
Conn() io.Closer
|
|
|
|
}
|
|
|
|
|
|
|
|
// MultiAddressClient is an interface of the
|
|
|
|
// Client that supports multihost work.
|
|
|
|
type MultiAddressClient interface {
|
|
|
|
Client
|
2021-06-21 14:13:08 +00:00
|
|
|
|
|
|
|
// RawForAddress must return rawclient.Client
|
|
|
|
// for the passed network.Address.
|
|
|
|
RawForAddress(network.Address) *rawclient.Client
|
|
|
|
}
|
2021-09-28 04:42:31 +00:00
|
|
|
|
|
|
|
// NodeInfo groups information about NeoFS storage node needed for Client construction.
|
|
|
|
type NodeInfo struct {
|
|
|
|
addrGroup network.AddressGroup
|
2021-09-28 04:49:28 +00:00
|
|
|
|
|
|
|
key []byte
|
2021-09-28 04:42:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetAddressGroup sets group of network addresses.
|
|
|
|
func (x *NodeInfo) SetAddressGroup(v network.AddressGroup) {
|
|
|
|
x.addrGroup = v
|
|
|
|
}
|
|
|
|
|
|
|
|
// AddressGroup returns group of network addresses.
|
|
|
|
func (x NodeInfo) AddressGroup() network.AddressGroup {
|
|
|
|
return x.addrGroup
|
|
|
|
}
|
2021-09-28 04:49:28 +00:00
|
|
|
|
|
|
|
// SetPublicKey sets public key in a binary format.
|
|
|
|
//
|
|
|
|
// Argument must not be mutated.
|
|
|
|
func (x *NodeInfo) SetPublicKey(v []byte) {
|
|
|
|
x.key = v
|
|
|
|
}
|
|
|
|
|
|
|
|
// PublicKey returns public key in a binary format.
|
|
|
|
//
|
|
|
|
// Result must not be mutated.
|
|
|
|
func (x *NodeInfo) PublicKey() []byte {
|
|
|
|
return x.key
|
|
|
|
}
|