forked from TrueCloudLab/frostfs-node
[#961] *: Support NeoFS API status returns
Upgrade NeoFS API Go library to version with status returns. Make all API clients to pull out and return errors from failed statuses. Make signature service to respond with status if client version supports it. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
44d0d453ef
commit
7f5fb130c0
27 changed files with 618 additions and 415 deletions
|
@ -2,18 +2,17 @@ package internal
|
|||
|
||||
import (
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"io"
|
||||
"math"
|
||||
|
||||
"github.com/nspcc-dev/neofs-sdk-go/accounting"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/client"
|
||||
apistatus "github.com/nspcc-dev/neofs-sdk-go/client/status"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/container"
|
||||
cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/eacl"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/netmap"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/object"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/session"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/version"
|
||||
)
|
||||
|
||||
|
@ -25,12 +24,12 @@ type BalanceOfPrm struct {
|
|||
|
||||
// BalanceOfRes groups resulting values of BalanceOf operation.
|
||||
type BalanceOfRes struct {
|
||||
cliRes *accounting.Decimal
|
||||
cliRes *client.BalanceOfRes
|
||||
}
|
||||
|
||||
// Balance returns current balance.
|
||||
func (x BalanceOfRes) Balance() *accounting.Decimal {
|
||||
return x.cliRes
|
||||
return x.cliRes.Amount()
|
||||
}
|
||||
|
||||
// BalanceOf requests current balance of NeoFS user.
|
||||
|
@ -40,6 +39,10 @@ func BalanceOf(prm BalanceOfPrm) (res BalanceOfRes, err error) {
|
|||
res.cliRes, err = prm.cli.GetBalance(context.Background(), prm.ownerID,
|
||||
client.WithKey(prm.privKey),
|
||||
)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(res.cliRes.Status())
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -52,12 +55,12 @@ type ListContainersPrm struct {
|
|||
|
||||
// ListContainersRes groups resulting values of ListContainers operation.
|
||||
type ListContainersRes struct {
|
||||
cliRes []*cid.ID
|
||||
cliRes *client.ContainerListRes
|
||||
}
|
||||
|
||||
// IDList returns list of identifiers of user's containers.
|
||||
func (x ListContainersRes) IDList() []*cid.ID {
|
||||
return x.cliRes
|
||||
return x.cliRes.IDList()
|
||||
}
|
||||
|
||||
// ListContainers requests list of NeoFS user's containers.
|
||||
|
@ -67,6 +70,10 @@ func ListContainers(prm ListContainersPrm) (res ListContainersRes, err error) {
|
|||
res.cliRes, err = prm.cli.ListContainers(context.Background(), prm.ownerID,
|
||||
client.WithKey(prm.privKey),
|
||||
)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(res.cliRes.Status())
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -86,12 +93,12 @@ func (x *PutContainerPrm) SetContainer(cnr *container.Container) {
|
|||
|
||||
// PutContainerRes groups resulting values of PutContainer operation.
|
||||
type PutContainerRes struct {
|
||||
cliRes *cid.ID
|
||||
cliRes *client.ContainerPutRes
|
||||
}
|
||||
|
||||
// ID returns identifier of the created container.
|
||||
func (x PutContainerRes) ID() *cid.ID {
|
||||
return x.cliRes
|
||||
return x.cliRes.ID()
|
||||
}
|
||||
|
||||
// PutContainer sends request to save container in NeoFS.
|
||||
|
@ -107,6 +114,10 @@ func PutContainer(prm PutContainerPrm) (res PutContainerRes, err error) {
|
|||
client.WithKey(prm.privKey),
|
||||
client.WithSession(prm.sessionToken),
|
||||
)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(res.cliRes.Status())
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -119,12 +130,12 @@ type GetContainerPrm struct {
|
|||
|
||||
// GetContainerRes groups resulting values of GetContainer operation.
|
||||
type GetContainerRes struct {
|
||||
cliRes *container.Container
|
||||
cliRes *client.ContainerGetRes
|
||||
}
|
||||
|
||||
// Container returns structured of the requested container.
|
||||
func (x GetContainerRes) Container() *container.Container {
|
||||
return x.cliRes
|
||||
return x.cliRes.Container()
|
||||
}
|
||||
|
||||
// GetContainer reads container from NeoFS by ID.
|
||||
|
@ -134,6 +145,10 @@ func GetContainer(prm GetContainerPrm) (res GetContainerRes, err error) {
|
|||
res.cliRes, err = prm.cli.GetContainer(context.Background(), prm.cnrID,
|
||||
client.WithKey(prm.privKey),
|
||||
)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(res.cliRes.Status())
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -157,10 +172,16 @@ type DeleteContainerRes struct{}
|
|||
//
|
||||
// Returns any error prevented the operation from completing correctly in error return.
|
||||
func DeleteContainer(prm DeleteContainerPrm) (res DeleteContainerRes, err error) {
|
||||
err = prm.cli.DeleteContainer(context.Background(), prm.cnrID,
|
||||
var cliRes *client.ContainerDeleteRes
|
||||
|
||||
cliRes, err = prm.cli.DeleteContainer(context.Background(), prm.cnrID,
|
||||
client.WithKey(prm.privKey),
|
||||
client.WithSession(prm.sessionToken),
|
||||
)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(cliRes.Status())
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -173,21 +194,25 @@ type EACLPrm struct {
|
|||
|
||||
// EACLRes groups resulting values of EACL operation.
|
||||
type EACLRes struct {
|
||||
cliRes *client.EACLWithSignature
|
||||
cliRes *client.EACLRes
|
||||
}
|
||||
|
||||
// EACL returns requested eACL table.
|
||||
func (x EACLRes) EACL() *eacl.Table {
|
||||
return x.cliRes.EACL()
|
||||
return x.cliRes.Table()
|
||||
}
|
||||
|
||||
// EACL reads eACL table from NeoFS by container ID.
|
||||
//
|
||||
// Returns any error prevented the operation from completing correctly in error return.
|
||||
func EACL(prm EACLPrm) (res EACLRes, err error) {
|
||||
res.cliRes, err = prm.cli.GetEACL(context.Background(), prm.cnrID,
|
||||
res.cliRes, err = prm.cli.EACL(context.Background(), prm.cnrID,
|
||||
client.WithKey(prm.privKey),
|
||||
)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(res.cliRes.Status())
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -217,10 +242,16 @@ type SetEACLRes struct{}
|
|||
//
|
||||
// Returns any error prevented the operation from completing correctly in error return.
|
||||
func SetEACL(prm SetEACLPrm) (res SetEACLRes, err error) {
|
||||
err = prm.cli.SetEACL(context.Background(), prm.eaclTable,
|
||||
var cliRes *client.SetEACLRes
|
||||
|
||||
cliRes, err = prm.cli.SetEACL(context.Background(), prm.eaclTable,
|
||||
client.WithKey(prm.privKey),
|
||||
client.WithSession(prm.sessionToken),
|
||||
)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(cliRes.Status())
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -232,12 +263,12 @@ type NetworkInfoPrm struct {
|
|||
|
||||
// NetworkInfoRes groups resulting values of NetworkInfo operation.
|
||||
type NetworkInfoRes struct {
|
||||
cliRes *netmap.NetworkInfo
|
||||
cliRes *client.NetworkInfoRes
|
||||
}
|
||||
|
||||
// NetworkInfo returns structured information about the NeoFS network.
|
||||
func (x NetworkInfoRes) NetworkInfo() *netmap.NetworkInfo {
|
||||
return x.cliRes
|
||||
return x.cliRes.Info()
|
||||
}
|
||||
|
||||
// NetworkInfo reads information about the NeoFS network.
|
||||
|
@ -247,6 +278,10 @@ func NetworkInfo(prm NetworkInfoPrm) (res NetworkInfoRes, err error) {
|
|||
res.cliRes, err = prm.cli.NetworkInfo(context.Background(),
|
||||
client.WithKey(prm.privKey),
|
||||
)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(res.cliRes.Status())
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -258,17 +293,17 @@ type NodeInfoPrm struct {
|
|||
|
||||
// NodeInfoRes groups resulting values of NodeInfo operation.
|
||||
type NodeInfoRes struct {
|
||||
cliRes *client.EndpointInfo
|
||||
cliRes *client.EndpointInfoRes
|
||||
}
|
||||
|
||||
// NodeInfo returns information about the node from netmap.
|
||||
func (x NodeInfoRes) NodeInfo() *netmap.NodeInfo {
|
||||
return x.cliRes.NodeInfo()
|
||||
return x.cliRes.Info().NodeInfo()
|
||||
}
|
||||
|
||||
// LatestVersion returns latest NeoFS API version in use.
|
||||
func (x NodeInfoRes) LatestVersion() *version.Version {
|
||||
return x.cliRes.LatestVersion()
|
||||
return x.cliRes.Info().LatestVersion()
|
||||
}
|
||||
|
||||
// NodeInfo requests information about the remote server from NeoFS netmap.
|
||||
|
@ -278,6 +313,10 @@ func NodeInfo(prm NodeInfoPrm) (res NodeInfoRes, err error) {
|
|||
res.cliRes, err = prm.cli.EndpointInfo(context.Background(),
|
||||
client.WithKey(prm.privKey),
|
||||
)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(res.cliRes.Status())
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -289,7 +328,7 @@ type CreateSessionPrm struct {
|
|||
|
||||
// CreateSessionRes groups resulting values of CreateSession operation.
|
||||
type CreateSessionRes struct {
|
||||
cliRes *session.Token
|
||||
cliRes *client.CreateSessionRes
|
||||
}
|
||||
|
||||
// ID returns session identifier.
|
||||
|
@ -309,6 +348,10 @@ func CreateSession(prm CreateSessionPrm) (res CreateSessionRes, err error) {
|
|||
res.cliRes, err = prm.cli.CreateSession(context.Background(), math.MaxUint64,
|
||||
client.WithKey(prm.privKey),
|
||||
)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(res.cliRes.Status())
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -334,12 +377,12 @@ func (x *PutObjectPrm) SetPayloadReader(rdr io.Reader) {
|
|||
|
||||
// PutObjectRes groups resulting values of PutObject operation.
|
||||
type PutObjectRes struct {
|
||||
cliRes *object.ID
|
||||
cliRes *client.ObjectPutRes
|
||||
}
|
||||
|
||||
// ID returns identifier of the created object.
|
||||
func (x PutObjectRes) ID() *object.ID {
|
||||
return x.cliRes
|
||||
return x.cliRes.ID()
|
||||
}
|
||||
|
||||
// PutObject saves the object in NeoFS network.
|
||||
|
@ -356,6 +399,10 @@ func PutObject(prm PutObjectPrm) (res PutObjectRes, err error) {
|
|||
client.WithSession(prm.sessionToken),
|
||||
client.WithBearer(prm.bearerToken),
|
||||
)...)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(res.cliRes.Status())
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -368,12 +415,12 @@ type DeleteObjectPrm struct {
|
|||
|
||||
// DeleteObjectRes groups resulting values of DeleteObject operation.
|
||||
type DeleteObjectRes struct {
|
||||
cliRes *object.Address
|
||||
cliRes *client.ObjectDeleteRes
|
||||
}
|
||||
|
||||
// TombstoneAddress returns address of the created object with tombstone.
|
||||
func (x DeleteObjectRes) TombstoneAddress() *object.Address {
|
||||
return x.cliRes
|
||||
return x.cliRes.TombstoneAddress()
|
||||
}
|
||||
|
||||
// DeleteObject marks object to be removed from NeoFS through tombstone placement.
|
||||
|
@ -384,11 +431,15 @@ func DeleteObject(prm DeleteObjectPrm) (res DeleteObjectRes, err error) {
|
|||
|
||||
delPrm.WithAddress(prm.objAddr)
|
||||
|
||||
res.cliRes, err = client.DeleteObject(context.Background(), prm.cli, &delPrm, append(prm.opts,
|
||||
res.cliRes, err = prm.cli.DeleteObject(context.Background(), &delPrm, append(prm.opts,
|
||||
client.WithKey(prm.privKey),
|
||||
client.WithSession(prm.sessionToken),
|
||||
client.WithBearer(prm.bearerToken),
|
||||
)...)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(res.cliRes.Status())
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -403,12 +454,12 @@ type GetObjectPrm struct {
|
|||
|
||||
// GetObjectRes groups resulting values of GetObject operation.
|
||||
type GetObjectRes struct {
|
||||
cliRes *object.Object
|
||||
cliRes *client.ObjectGetRes
|
||||
}
|
||||
|
||||
// Object returns header of the request object.
|
||||
func (x GetObjectRes) Header() *object.Object {
|
||||
return x.cliRes
|
||||
return x.cliRes.Object()
|
||||
}
|
||||
|
||||
// GetObject reads the object by address.
|
||||
|
@ -429,6 +480,10 @@ func GetObject(prm GetObjectPrm) (res GetObjectRes, err error) {
|
|||
client.WithSession(prm.sessionToken),
|
||||
client.WithBearer(prm.bearerToken),
|
||||
)...)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(res.cliRes.Status())
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -449,12 +504,12 @@ func (x *HeadObjectPrm) SetMainOnlyFlag(v bool) {
|
|||
|
||||
// HeadObjectRes groups resulting values of HeadObject operation.
|
||||
type HeadObjectRes struct {
|
||||
cliRes *object.Object
|
||||
cliRes *client.ObjectHeadRes
|
||||
}
|
||||
|
||||
// Header returns requested object header.
|
||||
func (x HeadObjectRes) Header() *object.Object {
|
||||
return x.cliRes
|
||||
return x.cliRes.Object()
|
||||
}
|
||||
|
||||
// HeadObject reads object header by address.
|
||||
|
@ -473,11 +528,15 @@ func HeadObject(prm HeadObjectPrm) (res HeadObjectRes, err error) {
|
|||
cliPrm.WithAllFields()
|
||||
}
|
||||
|
||||
res.cliRes, err = prm.cli.GetObjectHeader(context.Background(), &cliPrm, append(prm.opts,
|
||||
res.cliRes, err = prm.cli.HeadObject(context.Background(), &cliPrm, append(prm.opts,
|
||||
client.WithKey(prm.privKey),
|
||||
client.WithSession(prm.sessionToken),
|
||||
client.WithBearer(prm.bearerToken),
|
||||
)...)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(res.cliRes.Status())
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -497,12 +556,12 @@ func (x *SearchObjectsPrm) SetFilters(filters object.SearchFilters) {
|
|||
|
||||
// SearchObjectsRes groups resulting values of SearchObjects operation.
|
||||
type SearchObjectsRes struct {
|
||||
cliRes []*object.ID
|
||||
cliRes *client.ObjectSearchRes
|
||||
}
|
||||
|
||||
// IDList returns identifiers of the matched objects.
|
||||
func (x SearchObjectsRes) IDList() []*object.ID {
|
||||
return x.cliRes
|
||||
return x.cliRes.IDList()
|
||||
}
|
||||
|
||||
// SearchObjects selects objects from container which match the filters.
|
||||
|
@ -514,11 +573,15 @@ func SearchObjects(prm SearchObjectsPrm) (res SearchObjectsRes, err error) {
|
|||
cliPrm.WithSearchFilters(prm.filters)
|
||||
cliPrm.WithContainerID(prm.cnrID)
|
||||
|
||||
res.cliRes, err = prm.cli.SearchObject(context.Background(), &cliPrm, append(prm.opts,
|
||||
res.cliRes, err = prm.cli.SearchObjects(context.Background(), &cliPrm, append(prm.opts,
|
||||
client.WithKey(prm.privKey),
|
||||
client.WithSession(prm.sessionToken),
|
||||
client.WithBearer(prm.bearerToken),
|
||||
)...)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(res.cliRes.Status())
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -552,12 +615,12 @@ func (x *HashPayloadRangesPrm) SetSalt(salt []byte) {
|
|||
|
||||
// HashPayloadRangesRes groups resulting values of HashPayloadRanges operation.
|
||||
type HashPayloadRangesRes struct {
|
||||
cliRes [][]byte
|
||||
cliRes *client.ObjectRangeHashRes
|
||||
}
|
||||
|
||||
// HashList returns list of hashes of the payload ranges keeping order.
|
||||
func (x HashPayloadRangesRes) HashList() [][]byte {
|
||||
return x.cliRes
|
||||
return x.cliRes.Hashes()
|
||||
}
|
||||
|
||||
// HashPayloadRanges requests hashes (by default SHA256) of the object payload ranges.
|
||||
|
@ -572,35 +635,17 @@ func HashPayloadRanges(prm HashPayloadRangesPrm) (res HashPayloadRangesRes, err
|
|||
cliPrm.WithRangeList(prm.rngs...)
|
||||
|
||||
if prm.tz {
|
||||
var hs [][sha256.Size]byte
|
||||
cliPrm.TZ()
|
||||
}
|
||||
|
||||
hs, err = prm.cli.ObjectPayloadRangeSHA256(context.Background(), &cliPrm, append(prm.opts,
|
||||
client.WithKey(prm.privKey),
|
||||
client.WithSession(prm.sessionToken),
|
||||
client.WithBearer(prm.bearerToken),
|
||||
)...)
|
||||
if err == nil {
|
||||
res.cliRes = make([][]byte, 0, len(hs))
|
||||
|
||||
for i := range hs {
|
||||
res.cliRes = append(res.cliRes, hs[i][:])
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var hs [][client.TZSize]byte
|
||||
|
||||
hs, err = prm.cli.ObjectPayloadRangeTZ(context.Background(), &cliPrm, append(prm.opts,
|
||||
client.WithKey(prm.privKey),
|
||||
client.WithSession(prm.sessionToken),
|
||||
client.WithBearer(prm.bearerToken),
|
||||
)...)
|
||||
if err == nil {
|
||||
res.cliRes = make([][]byte, 0, len(hs))
|
||||
|
||||
for i := range hs {
|
||||
res.cliRes = append(res.cliRes, hs[i][:])
|
||||
}
|
||||
}
|
||||
res.cliRes, err = prm.cli.HashObjectPayloadRanges(context.Background(), &cliPrm, append(prm.opts,
|
||||
client.WithKey(prm.privKey),
|
||||
client.WithSession(prm.sessionToken),
|
||||
client.WithBearer(prm.bearerToken),
|
||||
)...)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(res.cliRes.Status())
|
||||
}
|
||||
|
||||
return
|
||||
|
@ -638,11 +683,17 @@ func PayloadRange(prm PayloadRangePrm) (res PayloadRangeRes, err error) {
|
|||
cliPrm.WithDataWriter(prm.wrt)
|
||||
cliPrm.WithRange(prm.rng)
|
||||
|
||||
_, err = prm.cli.ObjectPayloadRangeData(context.Background(), &cliPrm, append(prm.opts,
|
||||
var cliRes *client.ObjectRangeRes
|
||||
|
||||
cliRes, err = prm.cli.ObjectPayloadRangeData(context.Background(), &cliPrm, append(prm.opts,
|
||||
client.WithKey(prm.privKey),
|
||||
client.WithSession(prm.sessionToken),
|
||||
client.WithBearer(prm.bearerToken),
|
||||
)...)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(cliRes.Status())
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
|
|
@ -312,7 +312,8 @@ func (r *remoteLoadAnnounceWriter) Put(a containerSDK.UsedSpaceAnnouncement) err
|
|||
}
|
||||
|
||||
func (r *remoteLoadAnnounceWriter) Close() error {
|
||||
return r.client.AnnounceContainerUsedSpace(r.ctx, r.buf, apiClient.WithKey(r.key))
|
||||
_, err := r.client.AnnounceContainerUsedSpace(r.ctx, r.buf, apiClient.WithKey(r.key))
|
||||
return err
|
||||
}
|
||||
|
||||
type loadPlacementBuilder struct {
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"bytes"
|
||||
"context"
|
||||
"crypto/ecdsa"
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/object"
|
||||
|
@ -474,68 +473,60 @@ func (c *reputationClient) submitResult(err error) {
|
|||
c.cons.trustStorage.Update(prm)
|
||||
}
|
||||
|
||||
func (c *reputationClient) PutObject(ctx context.Context, prm *client.PutObjectParams, opts ...client.CallOption) (*objectSDK.ID, error) {
|
||||
id, err := c.Client.PutObject(ctx, prm, opts...)
|
||||
func (c *reputationClient) PutObject(ctx context.Context, prm *client.PutObjectParams, opts ...client.CallOption) (*client.ObjectPutRes, error) {
|
||||
res, err := c.Client.PutObject(ctx, prm, opts...)
|
||||
|
||||
c.submitResult(err)
|
||||
|
||||
return id, err
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (c *reputationClient) DeleteObject(ctx context.Context, prm *client.DeleteObjectParams, opts ...client.CallOption) error {
|
||||
err := c.Client.DeleteObject(ctx, prm, opts...)
|
||||
func (c *reputationClient) DeleteObject(ctx context.Context, prm *client.DeleteObjectParams, opts ...client.CallOption) (*client.ObjectDeleteRes, error) {
|
||||
res, err := c.Client.DeleteObject(ctx, prm, opts...)
|
||||
|
||||
c.submitResult(err)
|
||||
|
||||
return err
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (c *reputationClient) GetObject(ctx context.Context, prm *client.GetObjectParams, opts ...client.CallOption) (*objectSDK.Object, error) {
|
||||
obj, err := c.Client.GetObject(ctx, prm, opts...)
|
||||
func (c *reputationClient) GetObject(ctx context.Context, prm *client.GetObjectParams, opts ...client.CallOption) (*client.ObjectGetRes, error) {
|
||||
res, err := c.Client.GetObject(ctx, prm, opts...)
|
||||
|
||||
c.submitResult(err)
|
||||
|
||||
return obj, err
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (c *reputationClient) GetObjectHeader(ctx context.Context, prm *client.ObjectHeaderParams, opts ...client.CallOption) (*objectSDK.Object, error) {
|
||||
obj, err := c.Client.GetObjectHeader(ctx, prm, opts...)
|
||||
func (c *reputationClient) HeadObject(ctx context.Context, prm *client.ObjectHeaderParams, opts ...client.CallOption) (*client.ObjectHeadRes, error) {
|
||||
res, err := c.Client.HeadObject(ctx, prm, opts...)
|
||||
|
||||
c.submitResult(err)
|
||||
|
||||
return obj, err
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (c *reputationClient) ObjectPayloadRangeData(ctx context.Context, prm *client.RangeDataParams, opts ...client.CallOption) ([]byte, error) {
|
||||
rng, err := c.Client.ObjectPayloadRangeData(ctx, prm, opts...)
|
||||
func (c *reputationClient) ObjectPayloadRangeData(ctx context.Context, prm *client.RangeDataParams, opts ...client.CallOption) (*client.ObjectRangeRes, error) {
|
||||
res, err := c.Client.ObjectPayloadRangeData(ctx, prm, opts...)
|
||||
|
||||
c.submitResult(err)
|
||||
|
||||
return rng, err
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (c *reputationClient) ObjectPayloadRangeSHA256(ctx context.Context, prm *client.RangeChecksumParams, opts ...client.CallOption) ([][sha256.Size]byte, error) {
|
||||
hashes, err := c.Client.ObjectPayloadRangeSHA256(ctx, prm, opts...)
|
||||
func (c *reputationClient) HashObjectPayloadRanges(ctx context.Context, prm *client.RangeChecksumParams, opts ...client.CallOption) (*client.ObjectRangeHashRes, error) {
|
||||
res, err := c.Client.HashObjectPayloadRanges(ctx, prm, opts...)
|
||||
|
||||
c.submitResult(err)
|
||||
|
||||
return hashes, err
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (c *reputationClient) ObjectPayloadRangeTZ(ctx context.Context, prm *client.RangeChecksumParams, opts ...client.CallOption) ([][client.TZSize]byte, error) {
|
||||
hashes, err := c.Client.ObjectPayloadRangeTZ(ctx, prm, opts...)
|
||||
func (c *reputationClient) SearchObjects(ctx context.Context, prm *client.SearchObjectParams, opts ...client.CallOption) (*client.ObjectSearchRes, error) {
|
||||
res, err := c.Client.SearchObjects(ctx, prm, opts...)
|
||||
|
||||
c.submitResult(err)
|
||||
|
||||
return hashes, err
|
||||
}
|
||||
|
||||
func (c *reputationClient) SearchObject(ctx context.Context, prm *client.SearchObjectParams, opts ...client.CallOption) ([]*objectSDK.ID, error) {
|
||||
ids, err := c.Client.SearchObject(ctx, prm, opts...)
|
||||
|
||||
c.submitResult(err)
|
||||
|
||||
return ids, err
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (c *reputationClientConstructor) Get(info coreclient.NodeInfo) (client.Client, error) {
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"crypto/ecdsa"
|
||||
|
||||
"github.com/nspcc-dev/neofs-sdk-go/client"
|
||||
apistatus "github.com/nspcc-dev/neofs-sdk-go/client/status"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/reputation"
|
||||
)
|
||||
|
||||
|
@ -65,7 +66,13 @@ type AnnounceLocalRes struct{}
|
|||
//
|
||||
// Returns any error prevented the operation from completing correctly in error return.
|
||||
func AnnounceLocal(prm AnnounceLocalPrm) (res AnnounceLocalRes, err error) {
|
||||
_, err = prm.cli.AnnounceLocalTrust(prm.ctx, prm.cliPrm, prm.opts...)
|
||||
var cliRes *client.AnnounceLocalTrustRes
|
||||
|
||||
cliRes, err = prm.cli.AnnounceLocalTrust(prm.ctx, prm.cliPrm, prm.opts...)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(cliRes.Status())
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -102,7 +109,13 @@ type AnnounceIntermediateRes struct{}
|
|||
//
|
||||
// Returns any error prevented the operation from completing correctly in error return.
|
||||
func AnnounceIntermediate(prm AnnounceIntermediatePrm) (res AnnounceIntermediateRes, err error) {
|
||||
_, err = prm.cli.AnnounceIntermediateTrust(prm.ctx, prm.cliPrm, prm.opts...)
|
||||
var cliRes *client.AnnounceIntermediateTrustRes
|
||||
|
||||
cliRes, err = prm.cli.AnnounceIntermediateTrust(prm.ctx, prm.cliPrm, prm.opts...)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(cliRes.Status())
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
|
6
go.mod
6
go.mod
|
@ -11,9 +11,9 @@ require (
|
|||
github.com/mr-tron/base58 v1.2.0
|
||||
github.com/multiformats/go-multiaddr v0.4.0
|
||||
github.com/nspcc-dev/hrw v1.0.9
|
||||
github.com/nspcc-dev/neo-go v0.97.3
|
||||
github.com/nspcc-dev/neofs-api-go v1.30.0
|
||||
github.com/nspcc-dev/neofs-sdk-go v0.0.0-20211110152919-10b78e74afbd
|
||||
github.com/nspcc-dev/neo-go v0.97.4-pre.0.20211123163659-b25c3775e847
|
||||
github.com/nspcc-dev/neofs-api-go/v2 v2.11.0-pre.0.20211118144033-580f6c5554ff
|
||||
github.com/nspcc-dev/neofs-sdk-go v0.0.0-20211123100340-d9317cbea191
|
||||
github.com/nspcc-dev/tzhash v1.4.0
|
||||
github.com/panjf2000/ants/v2 v2.4.0
|
||||
github.com/paulmach/orb v0.2.2
|
||||
|
|
97
go.sum
97
go.sum
|
@ -43,13 +43,8 @@ github.com/CityOfZion/neo-go v0.62.1-pre.0.20191114145240-e740fbe708f8/go.mod h1
|
|||
github.com/CityOfZion/neo-go v0.70.1-pre.0.20191209120015-fccb0085941e/go.mod h1:0enZl0az8xA6PVkwzEOwPWVJGqlt/GO4hA4kmQ5Xzig=
|
||||
github.com/CityOfZion/neo-go v0.70.1-pre.0.20191212173117-32ac01130d4c/go.mod h1:JtlHfeqLywZLswKIKFnAp+yzezY4Dji9qlfQKB2OD/I=
|
||||
github.com/CityOfZion/neo-go v0.71.1-pre.0.20200129171427-f773ec69fb84/go.mod h1:FLI526IrRWHmcsO+mHsCbj64pJZhwQFTLJZu+A4PGOA=
|
||||
github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM=
|
||||
github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
|
||||
github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=
|
||||
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
||||
github.com/Workiva/go-datastructures v1.0.50/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA=
|
||||
github.com/Workiva/go-datastructures v1.0.53 h1:J6Y/52yX10Xc5JjXmGtWoSSxs3mZnGSaq37xZZh7Yig=
|
||||
github.com/Workiva/go-datastructures v1.0.53/go.mod h1:1yZL+zfsztete+ePzZz/Zb1/t5BnDuE2Ya2MMGhzP6A=
|
||||
github.com/abiosoft/ishell v2.0.0+incompatible/go.mod h1:HQR9AqF2R3P4XXpMpI0NAzgHf/aS6+zVXRj14cVk9qg=
|
||||
github.com/abiosoft/ishell/v2 v2.0.2/go.mod h1:E4oTCXfo6QjoCart0QYa5m9w4S+deXs/P/9jA77A9Bs=
|
||||
github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db/go.mod h1:rB3B4rKii8V21ydCbIzH5hZiCQE7f5E9SzUb/ZZx530=
|
||||
|
@ -60,20 +55,11 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF
|
|||
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
|
||||
github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
|
||||
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a h1:HbKu58rmZpUGpz5+4FfNmIU+FmZg2P3Xaj2v2bfNWmk=
|
||||
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
|
||||
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
|
||||
github.com/alicebob/miniredis v2.5.0+incompatible h1:yBHoLpsyjupjz3NL3MhKMVkR41j82Yjf3KFv7ApYzUI=
|
||||
github.com/alicebob/miniredis v2.5.0+incompatible h1:yBHoLpsyjupjz3NL3MhKMVkR41j82Yjf3KFv7ApYzUI=
|
||||
github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk=
|
||||
github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk=
|
||||
github.com/alicebob/miniredis/v2 v2.15.1 h1:Fw+ixAJPmKhCLBqDwHlTDqxUxp0xjEwXczEpt1B6r7k=
|
||||
github.com/alicebob/miniredis/v2 v2.15.1/go.mod h1:gquAfGbzn92jvtrSC69+6zZnwSODVXVpYDRaGhWaL6I=
|
||||
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
||||
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20210521073959-f0d4d129b7f1 h1:zFRi26YWd7NIorBXe8UkevRl0dIvk/AnXHWaAiZG+Yk=
|
||||
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20210521073959-f0d4d129b7f1/go.mod h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY=
|
||||
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
|
||||
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
|
||||
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
|
||||
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
||||
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
|
||||
|
@ -111,51 +97,37 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk
|
|||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
||||
github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
||||
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
|
||||
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
||||
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
||||
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
|
||||
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
||||
github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk=
|
||||
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218=
|
||||
github.com/dgraph-io/badger/v2 v2.0.3 h1:inzdf6VF/NZ+tJ8RwwYMjJMvsOALTHYdozn0qSl6XJI=
|
||||
github.com/dgraph-io/badger/v2 v2.0.3/go.mod h1:3KY8+bsP8wI0OEnQJAKpd4wIJW/Mm32yw2j/9FUVnIM=
|
||||
github.com/dgraph-io/ristretto v0.0.2-0.20200115201040-8f368f2f2ab3 h1:MQLRM35Pp0yAyBYksjbj1nZI/w6eyRY/mWoM1sFf4kU=
|
||||
github.com/dgraph-io/ristretto v0.0.2-0.20200115201040-8f368f2f2ab3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E=
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA=
|
||||
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
|
||||
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
|
||||
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
|
||||
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||
github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
|
||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ=
|
||||
github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw=
|
||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
|
||||
github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:rZfgFAXFS/z/lEd6LJmf9HVZ1LkgYiHx5pHhV5DR16M=
|
||||
github.com/frankban/quicktest v1.10.0/go.mod h1:ui7WezCLWMWxVWr1GETZY3smRy0G4KWq9vcPtJmFl7Y=
|
||||
github.com/frankban/quicktest v1.14.0/go.mod h1:NeW+ay9A/U67EYXNFA1nPE8e/tnQv/09mUdL/ijj8og=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||
|
@ -170,8 +142,6 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9
|
|||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
|
||||
github.com/go-redis/redis v6.10.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
|
||||
github.com/go-redis/redis v6.15.9+incompatible h1:K0pv1D7EQUjfyoMql+r/jZqCLizCGKFlFgcHWWmHQjg=
|
||||
github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0=
|
||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
|
@ -250,7 +220,6 @@ github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLe
|
|||
github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs=
|
||||
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
|
@ -320,12 +289,12 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxv
|
|||
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
|
||||
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||
github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls=
|
||||
github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
|
||||
|
@ -385,30 +354,22 @@ github.com/nspcc-dev/dbft v0.0.0-20191205084618-dacb1a30c254/go.mod h1:w1Ln2aT+d
|
|||
github.com/nspcc-dev/dbft v0.0.0-20191209120240-0d6b7568d9ae/go.mod h1:3FjXOoHmA51EGfb5GS/HOv7VdmngNRTssSeQ729dvGY=
|
||||
github.com/nspcc-dev/dbft v0.0.0-20200117124306-478e5cfbf03a/go.mod h1:/YFK+XOxxg0Bfm6P92lY5eDSLYfp06XOdL8KAVgXjVk=
|
||||
github.com/nspcc-dev/dbft v0.0.0-20200219114139-199d286ed6c1/go.mod h1:O0qtn62prQSqizzoagHmuuKoz8QMkU3SzBoKdEvm3aQ=
|
||||
github.com/nspcc-dev/dbft v0.0.0-20200711144034-c526ccc6f570/go.mod h1:1FYQXSbb6/9HQIkoF8XO7W/S8N7AZRkBsgwbcXRvk0E=
|
||||
github.com/nspcc-dev/dbft v0.0.0-20210302103605-cc75991b7cfb/go.mod h1:U8MSnEShH+o5hexfWJdze6uMFJteP0ko7J2frO7Yu1Y=
|
||||
github.com/nspcc-dev/dbft v0.0.0-20210721160347-1b03241391ac/go.mod h1:U8MSnEShH+o5hexfWJdze6uMFJteP0ko7J2frO7Yu1Y=
|
||||
github.com/nspcc-dev/go-ordered-json v0.0.0-20210915112629-e1b6cce73d02 h1:JgRx27vfGw5WV5QbaNDy0iy2WD1XJO964wwAapaYKLg=
|
||||
github.com/nspcc-dev/go-ordered-json v0.0.0-20210915112629-e1b6cce73d02/go.mod h1:79bEUDEviBHJMFV6Iq6in57FEOCMcRhfQnfaf0ETA5U=
|
||||
github.com/nspcc-dev/hrw v1.0.9 h1:17VcAuTtrstmFppBjfRiia4K2wA/ukXZhLFS8Y8rz5Y=
|
||||
github.com/nspcc-dev/hrw v1.0.9/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU=
|
||||
github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:pPYwPZ2ks+uMnlRLUyXOpLieaDQSEaf4NM3zHVbRjmg=
|
||||
github.com/nspcc-dev/neo-go v0.91.0/go.mod h1:G6HdOWvzQ6tlvFdvFSN/PgCzLPN/X/X4d5hTjFRUDcc=
|
||||
github.com/nspcc-dev/neo-go v0.95.1/go.mod h1:bW07ge1WFXsBgqrcPpLUr6OcyQxHqM26MZNesWMdH0c=
|
||||
github.com/nspcc-dev/neo-go v0.95.3/go.mod h1:t15xRFDVhz5o/pstptdoW9N9JJBNn1hZ6APMNiC6MrY=
|
||||
github.com/nspcc-dev/neo-go v0.96.1/go.mod h1:yguwQBpWMTHx07INKoElJT8Gga1LUdTSi0gT75ywJ68=
|
||||
github.com/nspcc-dev/neo-go v0.97.3 h1:qui/ZYJhga14UwFwrLJj+8t/ms8enTSUwBxKAsjlIes=
|
||||
github.com/nspcc-dev/neo-go v0.97.3/go.mod h1:31LelE8G5NZwGmePCykqui6BpPyEklTVbOvEh5xEvz8=
|
||||
github.com/nspcc-dev/neofs-api-go v1.24.0/go.mod h1:G7dqincfdjBrAbL5nxVp82emF05fSVEqe59ICsoRDI8=
|
||||
github.com/nspcc-dev/neofs-api-go v1.27.1/go.mod h1:i0Cwgvcu9A4M4e58pydbXFisUhSxpfljmuWFPIp2btE=
|
||||
github.com/nspcc-dev/neofs-api-go v1.30.0 h1:Nns7QjmQGk9I5lWMCtmeD9D3de46uyH3H07WBeXTEI0=
|
||||
github.com/nspcc-dev/neofs-api-go v1.30.0/go.mod h1:KC8T91skIg8juvUh7lQabswQ9J6KmnXErpH8qwDitXA=
|
||||
github.com/nspcc-dev/neo-go v0.97.4-pre.0.20211123163659-b25c3775e847 h1:9cRAXmYoMxWhCJnlh0c9twr6/1faDC57pdOv2ABxqLs=
|
||||
github.com/nspcc-dev/neo-go v0.97.4-pre.0.20211123163659-b25c3775e847/go.mod h1:ThDwtZ1KXjpz2n0UyKkS0sEth5weNqMkZ2cWSIKaxaE=
|
||||
github.com/nspcc-dev/neofs-api-go/v2 v2.11.0-pre.0.20211118144033-580f6c5554ff h1:j3NbdVKYPMh9/cQLD/LhY7gGKyVA6qtOIsJ/cKiXWUQ=
|
||||
github.com/nspcc-dev/neofs-api-go/v2 v2.11.0-pre.0.20211118144033-580f6c5554ff/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs=
|
||||
github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9KAEAUQR7dMxZmNA=
|
||||
github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw=
|
||||
github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM=
|
||||
github.com/nspcc-dev/neofs-crypto v0.3.0/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw=
|
||||
github.com/nspcc-dev/neofs-sdk-go v0.0.0-20211110152919-10b78e74afbd h1:5Ts2IyJ2UWtJ75VdUPzeF8SUv/WLvVNKsfhUphyIEdE=
|
||||
github.com/nspcc-dev/neofs-sdk-go v0.0.0-20211110152919-10b78e74afbd/go.mod h1:3FlwG2PCM+Im87g3vNMBi131FoniIr8WdkF88m9zSLU=
|
||||
github.com/nspcc-dev/neofs-sdk-go v0.0.0-20211123100340-d9317cbea191 h1:UgUnroRAeWTpuiws6IQfMfvwwZ3UPctz2ykPU0BbGf0=
|
||||
github.com/nspcc-dev/neofs-sdk-go v0.0.0-20211123100340-d9317cbea191/go.mod h1:zpeoUpflmlq9aDOTC72+E2JyJZDNzoqbZJFtqClBuu4=
|
||||
github.com/nspcc-dev/rfc6979 v0.1.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso=
|
||||
github.com/nspcc-dev/rfc6979 v0.2.0 h1:3e1WNxrN60/6N0DW7+UYisLeZJyfqZTNOjeV/toYvOE=
|
||||
github.com/nspcc-dev/rfc6979 v0.2.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso=
|
||||
|
@ -438,8 +399,6 @@ github.com/paulmach/protoscan v0.2.1-0.20210522164731-4e53c6875432/go.mod h1:2sV
|
|||
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||
github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ=
|
||||
github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
|
||||
github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU=
|
||||
github.com/pierrec/lz4 v2.5.2+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
||||
github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
|
@ -479,8 +438,8 @@ github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40T
|
|||
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
||||
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
|
||||
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
|
||||
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
|
||||
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
|
||||
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
|
||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||
|
@ -504,7 +463,6 @@ github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z
|
|||
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||
github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng=
|
||||
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
|
||||
github.com/spf13/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M=
|
||||
github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo=
|
||||
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
||||
|
@ -513,7 +471,6 @@ github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0
|
|||
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
|
||||
github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
|
||||
github.com/spf13/viper v1.8.1 h1:Kq1fyeebqsBfbjZj4EL7gj2IO0mMaiyjYUWcUsl2O44=
|
||||
github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns=
|
||||
|
@ -531,19 +488,15 @@ github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69
|
|||
github.com/syndtr/goleveldb v0.0.0-20180307113352-169b1b37be73/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954 h1:xQdMZ1WLrgkkvOZ/LDQxjVxMLdby7osSh4ZEVa5sIjs=
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM=
|
||||
github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg=
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||
github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q=
|
||||
github.com/twmb/murmur3 v1.1.5 h1:i9OLS9fkuLzBXjt6dptlAEyk58fJsSTXbRg3SgVyqgk=
|
||||
github.com/twmb/murmur3 v1.1.5/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ=
|
||||
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
|
||||
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
||||
github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU=
|
||||
github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||
github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74 h1:JwtAtbp7r/7QSyGz8mKUbYJBg2+6Cd7OjM8o/GNOcVo=
|
||||
github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74/go.mod h1:RmMWU37GKR2s6pgrIEB4ixgpVCt/cf7dnJv3fuH1J1c=
|
||||
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
||||
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
|
||||
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
|
@ -551,11 +504,8 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec
|
|||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
github.com/yuin/gopher-lua v0.0.0-20190514113301-1cd887cd7036/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ=
|
||||
github.com/yuin/gopher-lua v0.0.0-20191128022950-c6266f4fe8d7/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ=
|
||||
github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da h1:NimzV1aGyq29m5ukMK0AMWEhFaL/lrEOaephfuoiARg=
|
||||
github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da/go.mod h1:E1AXubJBdNmFERAOucpDIxNzeGfLzg0mYh+UfMWdChA=
|
||||
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||
go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
|
||||
go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU=
|
||||
go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4=
|
||||
go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs=
|
||||
|
@ -586,7 +536,6 @@ go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI=
|
|||
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
|
@ -679,9 +628,8 @@ golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v
|
|||
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
|
||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0=
|
||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||
golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b h1:eB48h3HiRycXNy8E0Gf5e0hv7YT6Kt14L/D73G1fuwo=
|
||||
golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
|
@ -713,7 +661,6 @@ golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5h
|
|||
golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
|
@ -724,7 +671,6 @@ golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
|
@ -768,14 +714,11 @@ golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 h1:foEbQz/B0Oz6YIqu/69kfXPYeFQAuuMYFkjaqXzl5Wo=
|
||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210429154555-c04ba851c2a4 h1:UPou2i3GzKgi6igR+/0C5XyHKBngHxBp/CL5CQ0p3Zk=
|
||||
golang.org/x/term v0.0.0-20210429154555-c04ba851c2a4/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
|
@ -785,9 +728,8 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
|||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
|
@ -838,7 +780,6 @@ golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc
|
|||
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE=
|
||||
golang.org/x/tools v0.0.0-20201022035929-9cf592e881e9/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
|
@ -922,9 +863,8 @@ google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6D
|
|||
google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A=
|
||||
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c h1:wtujag7C+4D6KMoulW9YauvK2lgdvCMS260jsqqBXr0=
|
||||
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
|
||||
google.golang.org/genproto v0.0.0-20210928142010-c7af6a1a74c9 h1:XTH066D35LyHehRwlYhoK3qA+Hcgvg5xREG4kFQEW1Y=
|
||||
google.golang.org/genproto v0.0.0-20210928142010-c7af6a1a74c9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||
|
@ -945,7 +885,6 @@ google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG
|
|||
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
||||
google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
||||
google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
|
||||
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
|
||||
google.golang.org/grpc v1.41.0 h1:f+PlOh7QV4iIJkPrx5NQ7qaNGFQ3OTse67yaDHfju4E=
|
||||
google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package client
|
||||
|
||||
import (
|
||||
rawclient "github.com/nspcc-dev/neofs-api-go/rpc/client"
|
||||
rawclient "github.com/nspcc-dev/neofs-api-go/v2/rpc/client"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/network"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/client"
|
||||
)
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/object_manager/storagegroup"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/client"
|
||||
apistatus "github.com/nspcc-dev/neofs-sdk-go/client/status"
|
||||
cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/object"
|
||||
)
|
||||
|
@ -42,12 +43,12 @@ func (x *SearchSGPrm) SetContainerID(id *cid.ID) {
|
|||
|
||||
// SearchSGRes groups resulting values of SearchSG operation.
|
||||
type SearchSGRes struct {
|
||||
cliRes []*object.ID
|
||||
cliRes *client.ObjectSearchRes
|
||||
}
|
||||
|
||||
// IDList returns list of IDs of storage groups in container.
|
||||
func (x SearchSGRes) IDList() []*object.ID {
|
||||
return x.cliRes
|
||||
return x.cliRes.IDList()
|
||||
}
|
||||
|
||||
var sgFilter = storagegroup.SearchQuery()
|
||||
|
@ -61,9 +62,13 @@ func (x Client) SearchSG(prm SearchSGPrm) (res SearchSGRes, err error) {
|
|||
cliPrm.WithContainerID(prm.cnrID)
|
||||
cliPrm.WithSearchFilters(sgFilter)
|
||||
|
||||
res.cliRes, err = x.c.SearchObject(prm.ctx, &cliPrm,
|
||||
res.cliRes, err = x.c.SearchObjects(prm.ctx, &cliPrm,
|
||||
client.WithKey(x.key),
|
||||
)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(res.cliRes.Status())
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -75,12 +80,12 @@ type GetObjectPrm struct {
|
|||
|
||||
// GetObjectRes groups resulting values of GetObject operation.
|
||||
type GetObjectRes struct {
|
||||
cliRes *object.Object
|
||||
cliRes *client.ObjectGetRes
|
||||
}
|
||||
|
||||
// Object returns received object.
|
||||
func (x GetObjectRes) Object() *object.Object {
|
||||
return x.cliRes
|
||||
return x.cliRes.Object()
|
||||
}
|
||||
|
||||
// GetObject reads the object by address.
|
||||
|
@ -94,6 +99,10 @@ func (x Client) GetObject(prm GetObjectPrm) (res GetObjectRes, err error) {
|
|||
res.cliRes, err = x.c.GetObject(prm.ctx, &cliPrm,
|
||||
client.WithKey(x.key),
|
||||
)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(res.cliRes.Status())
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -119,12 +128,12 @@ func (x *HeadObjectPrm) SetTTL(ttl uint32) {
|
|||
|
||||
// HeadObjectRes groups resulting values of HeadObject operation.
|
||||
type HeadObjectRes struct {
|
||||
cliRes *object.Object
|
||||
cliRes *client.ObjectHeadRes
|
||||
}
|
||||
|
||||
// Header returns received object header.
|
||||
func (x HeadObjectRes) Header() *object.Object {
|
||||
return x.cliRes
|
||||
return x.cliRes.Object()
|
||||
}
|
||||
|
||||
// HeadObject reads short object header by address.
|
||||
|
@ -138,10 +147,14 @@ func (x Client) HeadObject(prm HeadObjectPrm) (res HeadObjectRes, err error) {
|
|||
cliPrm.WithRawFlag(prm.raw)
|
||||
cliPrm.WithMainFields()
|
||||
|
||||
res.cliRes, err = x.c.GetObjectHeader(prm.ctx, &cliPrm,
|
||||
res.cliRes, err = x.c.HeadObject(prm.ctx, &cliPrm,
|
||||
client.WithKey(x.key),
|
||||
client.WithTTL(prm.ttl),
|
||||
)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(res.cliRes.Status())
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -225,15 +238,22 @@ func (x Client) HashPayloadRange(prm HashPayloadRangePrm) (res HashPayloadRangeR
|
|||
cliPrm.WithAddress(prm.objAddr)
|
||||
cliPrm.WithRangeList(prm.rng)
|
||||
|
||||
hs, err := x.c.ObjectPayloadRangeTZ(prm.ctx, &cliPrm,
|
||||
cliRes, err := x.c.HashObjectPayloadRanges(prm.ctx, &cliPrm,
|
||||
client.WithKey(x.key),
|
||||
client.WithTTL(1),
|
||||
)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(cliRes.Status())
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
hs := cliRes.Hashes()
|
||||
if ln := len(hs); ln != 1 {
|
||||
err = fmt.Errorf("wrong number of hashes %d", ln)
|
||||
} else {
|
||||
res.h = hs[0][:]
|
||||
res.h = hs[0]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
226
pkg/network/cache/multi.go
vendored
226
pkg/network/cache/multi.go
vendored
|
@ -2,23 +2,18 @@ package cache
|
|||
|
||||
import (
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"io"
|
||||
"sync"
|
||||
|
||||
rawclient "github.com/nspcc-dev/neofs-api-go/rpc/client"
|
||||
rawclient "github.com/nspcc-dev/neofs-api-go/v2/rpc/client"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/network"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/accounting"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/client"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/container"
|
||||
cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/eacl"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/netmap"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/object"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/owner"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/session"
|
||||
)
|
||||
|
||||
type multiClient struct {
|
||||
|
@ -87,215 +82,184 @@ func (x *multiClient) iterateClients(ctx context.Context, f func(client.Client)
|
|||
return firstErr
|
||||
}
|
||||
|
||||
func (x *multiClient) PutObject(ctx context.Context, p *client.PutObjectParams, opts ...client.CallOption) (*object.ID, error) {
|
||||
var res *object.ID
|
||||
|
||||
err := x.iterateClients(ctx, func(c client.Client) (err error) {
|
||||
func (x *multiClient) PutObject(ctx context.Context, p *client.PutObjectParams, opts ...client.CallOption) (res *client.ObjectPutRes, err error) {
|
||||
err = x.iterateClients(ctx, func(c client.Client) error {
|
||||
res, err = c.PutObject(ctx, p, opts...)
|
||||
return
|
||||
return err
|
||||
})
|
||||
|
||||
return res, err
|
||||
return
|
||||
}
|
||||
|
||||
func (x *multiClient) GetBalance(ctx context.Context, id *owner.ID, opts ...client.CallOption) (*accounting.Decimal, error) {
|
||||
var res *accounting.Decimal
|
||||
|
||||
err := x.iterateClients(ctx, func(c client.Client) (err error) {
|
||||
func (x *multiClient) GetBalance(ctx context.Context, id *owner.ID, opts ...client.CallOption) (res *client.BalanceOfRes, err error) {
|
||||
err = x.iterateClients(ctx, func(c client.Client) error {
|
||||
res, err = c.GetBalance(ctx, id, opts...)
|
||||
return
|
||||
return err
|
||||
})
|
||||
|
||||
return res, err
|
||||
return
|
||||
}
|
||||
|
||||
func (x *multiClient) PutContainer(ctx context.Context, cnr *container.Container, opts ...client.CallOption) (*cid.ID, error) {
|
||||
var res *cid.ID
|
||||
|
||||
err := x.iterateClients(ctx, func(c client.Client) (err error) {
|
||||
func (x *multiClient) PutContainer(ctx context.Context, cnr *container.Container, opts ...client.CallOption) (res *client.ContainerPutRes, err error) {
|
||||
err = x.iterateClients(ctx, func(c client.Client) error {
|
||||
res, err = c.PutContainer(ctx, cnr, opts...)
|
||||
return
|
||||
return err
|
||||
})
|
||||
|
||||
return res, err
|
||||
return
|
||||
}
|
||||
|
||||
func (x *multiClient) GetContainer(ctx context.Context, id *cid.ID, opts ...client.CallOption) (*container.Container, error) {
|
||||
var res *container.Container
|
||||
|
||||
err := x.iterateClients(ctx, func(c client.Client) (err error) {
|
||||
func (x *multiClient) GetContainer(ctx context.Context, id *cid.ID, opts ...client.CallOption) (res *client.ContainerGetRes, err error) {
|
||||
err = x.iterateClients(ctx, func(c client.Client) error {
|
||||
res, err = c.GetContainer(ctx, id, opts...)
|
||||
return
|
||||
return err
|
||||
})
|
||||
|
||||
return res, err
|
||||
return
|
||||
}
|
||||
|
||||
func (x *multiClient) ListContainers(ctx context.Context, id *owner.ID, opts ...client.CallOption) ([]*cid.ID, error) {
|
||||
var res []*cid.ID
|
||||
|
||||
err := x.iterateClients(ctx, func(c client.Client) (err error) {
|
||||
func (x *multiClient) ListContainers(ctx context.Context, id *owner.ID, opts ...client.CallOption) (res *client.ContainerListRes, err error) {
|
||||
err = x.iterateClients(ctx, func(c client.Client) error {
|
||||
res, err = c.ListContainers(ctx, id, opts...)
|
||||
return
|
||||
return err
|
||||
})
|
||||
|
||||
return res, err
|
||||
return
|
||||
}
|
||||
|
||||
func (x *multiClient) DeleteContainer(ctx context.Context, id *cid.ID, opts ...client.CallOption) error {
|
||||
return x.iterateClients(ctx, func(c client.Client) error {
|
||||
return c.DeleteContainer(ctx, id, opts...)
|
||||
})
|
||||
}
|
||||
|
||||
func (x *multiClient) GetEACL(ctx context.Context, id *cid.ID, opts ...client.CallOption) (*client.EACLWithSignature, error) {
|
||||
var res *client.EACLWithSignature
|
||||
|
||||
err := x.iterateClients(ctx, func(c client.Client) (err error) {
|
||||
res, err = c.GetEACL(ctx, id, opts...)
|
||||
return
|
||||
func (x *multiClient) DeleteContainer(ctx context.Context, id *cid.ID, opts ...client.CallOption) (res *client.ContainerDeleteRes, err error) {
|
||||
err = x.iterateClients(ctx, func(c client.Client) error {
|
||||
res, err = c.DeleteContainer(ctx, id, opts...)
|
||||
return err
|
||||
})
|
||||
|
||||
return res, err
|
||||
return
|
||||
}
|
||||
|
||||
func (x *multiClient) SetEACL(ctx context.Context, t *eacl.Table, opts ...client.CallOption) error {
|
||||
return x.iterateClients(ctx, func(c client.Client) error {
|
||||
return c.SetEACL(ctx, t, opts...)
|
||||
func (x *multiClient) EACL(ctx context.Context, id *cid.ID, opts ...client.CallOption) (res *client.EACLRes, err error) {
|
||||
err = x.iterateClients(ctx, func(c client.Client) error {
|
||||
res, err = c.EACL(ctx, id, opts...)
|
||||
return err
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (x *multiClient) AnnounceContainerUsedSpace(ctx context.Context, as []container.UsedSpaceAnnouncement, opts ...client.CallOption) error {
|
||||
return x.iterateClients(ctx, func(c client.Client) error {
|
||||
return c.AnnounceContainerUsedSpace(ctx, as, opts...)
|
||||
func (x *multiClient) SetEACL(ctx context.Context, t *eacl.Table, opts ...client.CallOption) (res *client.SetEACLRes, err error) {
|
||||
err = x.iterateClients(ctx, func(c client.Client) error {
|
||||
res, err = c.SetEACL(ctx, t, opts...)
|
||||
return err
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (x *multiClient) EndpointInfo(ctx context.Context, opts ...client.CallOption) (*client.EndpointInfo, error) {
|
||||
var res *client.EndpointInfo
|
||||
func (x *multiClient) AnnounceContainerUsedSpace(ctx context.Context, as []container.UsedSpaceAnnouncement, opts ...client.CallOption) (res *client.AnnounceSpaceRes, err error) {
|
||||
err = x.iterateClients(ctx, func(c client.Client) error {
|
||||
res, err = c.AnnounceContainerUsedSpace(ctx, as, opts...)
|
||||
return err
|
||||
})
|
||||
|
||||
err := x.iterateClients(ctx, func(c client.Client) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (x *multiClient) EndpointInfo(ctx context.Context, opts ...client.CallOption) (res *client.EndpointInfoRes, err error) {
|
||||
err = x.iterateClients(ctx, func(c client.Client) error {
|
||||
res, err = c.EndpointInfo(ctx, opts...)
|
||||
return
|
||||
return err
|
||||
})
|
||||
|
||||
return res, err
|
||||
return
|
||||
}
|
||||
|
||||
func (x *multiClient) NetworkInfo(ctx context.Context, opts ...client.CallOption) (*netmap.NetworkInfo, error) {
|
||||
var res *netmap.NetworkInfo
|
||||
|
||||
err := x.iterateClients(ctx, func(c client.Client) (err error) {
|
||||
func (x *multiClient) NetworkInfo(ctx context.Context, opts ...client.CallOption) (res *client.NetworkInfoRes, err error) {
|
||||
err = x.iterateClients(ctx, func(c client.Client) error {
|
||||
res, err = c.NetworkInfo(ctx, opts...)
|
||||
return
|
||||
return err
|
||||
})
|
||||
|
||||
return res, err
|
||||
return
|
||||
}
|
||||
|
||||
func (x *multiClient) DeleteObject(ctx context.Context, p *client.DeleteObjectParams, opts ...client.CallOption) error {
|
||||
return x.iterateClients(ctx, func(c client.Client) error {
|
||||
return c.DeleteObject(ctx, p, opts...)
|
||||
func (x *multiClient) DeleteObject(ctx context.Context, p *client.DeleteObjectParams, opts ...client.CallOption) (res *client.ObjectDeleteRes, err error) {
|
||||
err = x.iterateClients(ctx, func(c client.Client) error {
|
||||
res, err = c.DeleteObject(ctx, p, opts...)
|
||||
return err
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (x *multiClient) GetObject(ctx context.Context, p *client.GetObjectParams, opts ...client.CallOption) (*object.Object, error) {
|
||||
var res *object.Object
|
||||
|
||||
err := x.iterateClients(ctx, func(c client.Client) (err error) {
|
||||
func (x *multiClient) GetObject(ctx context.Context, p *client.GetObjectParams, opts ...client.CallOption) (res *client.ObjectGetRes, err error) {
|
||||
err = x.iterateClients(ctx, func(c client.Client) error {
|
||||
res, err = c.GetObject(ctx, p, opts...)
|
||||
return
|
||||
return err
|
||||
})
|
||||
|
||||
return res, err
|
||||
return
|
||||
}
|
||||
|
||||
func (x *multiClient) GetObjectHeader(ctx context.Context, p *client.ObjectHeaderParams, opts ...client.CallOption) (*object.Object, error) {
|
||||
var res *object.Object
|
||||
|
||||
err := x.iterateClients(ctx, func(c client.Client) (err error) {
|
||||
res, err = c.GetObjectHeader(ctx, p, opts...)
|
||||
return
|
||||
})
|
||||
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (x *multiClient) ObjectPayloadRangeData(ctx context.Context, p *client.RangeDataParams, opts ...client.CallOption) ([]byte, error) {
|
||||
var res []byte
|
||||
|
||||
err := x.iterateClients(ctx, func(c client.Client) (err error) {
|
||||
func (x *multiClient) ObjectPayloadRangeData(ctx context.Context, p *client.RangeDataParams, opts ...client.CallOption) (res *client.ObjectRangeRes, err error) {
|
||||
err = x.iterateClients(ctx, func(c client.Client) error {
|
||||
res, err = c.ObjectPayloadRangeData(ctx, p, opts...)
|
||||
return
|
||||
return err
|
||||
})
|
||||
|
||||
return res, err
|
||||
return
|
||||
}
|
||||
|
||||
func (x *multiClient) ObjectPayloadRangeSHA256(ctx context.Context, p *client.RangeChecksumParams, opts ...client.CallOption) ([][sha256.Size]byte, error) {
|
||||
var res [][sha256.Size]byte
|
||||
|
||||
err := x.iterateClients(ctx, func(c client.Client) (err error) {
|
||||
res, err = c.ObjectPayloadRangeSHA256(ctx, p, opts...)
|
||||
return
|
||||
func (x *multiClient) HeadObject(ctx context.Context, p *client.ObjectHeaderParams, opts ...client.CallOption) (res *client.ObjectHeadRes, err error) {
|
||||
err = x.iterateClients(ctx, func(c client.Client) error {
|
||||
res, err = c.HeadObject(ctx, p, opts...)
|
||||
return err
|
||||
})
|
||||
|
||||
return res, err
|
||||
return
|
||||
}
|
||||
|
||||
func (x *multiClient) ObjectPayloadRangeTZ(ctx context.Context, p *client.RangeChecksumParams, opts ...client.CallOption) ([][client.TZSize]byte, error) {
|
||||
var res [][client.TZSize]byte
|
||||
|
||||
err := x.iterateClients(ctx, func(c client.Client) (err error) {
|
||||
res, err = c.ObjectPayloadRangeTZ(ctx, p, opts...)
|
||||
return
|
||||
func (x *multiClient) HashObjectPayloadRanges(ctx context.Context, p *client.RangeChecksumParams, opts ...client.CallOption) (res *client.ObjectRangeHashRes, err error) {
|
||||
err = x.iterateClients(ctx, func(c client.Client) error {
|
||||
res, err = c.HashObjectPayloadRanges(ctx, p, opts...)
|
||||
return err
|
||||
})
|
||||
|
||||
return res, err
|
||||
return
|
||||
}
|
||||
|
||||
func (x *multiClient) SearchObject(ctx context.Context, p *client.SearchObjectParams, opts ...client.CallOption) ([]*object.ID, error) {
|
||||
var res []*object.ID
|
||||
|
||||
err := x.iterateClients(ctx, func(c client.Client) (err error) {
|
||||
res, err = c.SearchObject(ctx, p, opts...)
|
||||
return
|
||||
func (x *multiClient) SearchObjects(ctx context.Context, p *client.SearchObjectParams, opts ...client.CallOption) (res *client.ObjectSearchRes, err error) {
|
||||
err = x.iterateClients(ctx, func(c client.Client) error {
|
||||
res, err = c.SearchObjects(ctx, p, opts...)
|
||||
return err
|
||||
})
|
||||
|
||||
return res, err
|
||||
return
|
||||
}
|
||||
|
||||
func (x *multiClient) CreateSession(ctx context.Context, exp uint64, opts ...client.CallOption) (*session.Token, error) {
|
||||
var res *session.Token
|
||||
|
||||
err := x.iterateClients(ctx, func(c client.Client) (err error) {
|
||||
func (x *multiClient) CreateSession(ctx context.Context, exp uint64, opts ...client.CallOption) (res *client.CreateSessionRes, err error) {
|
||||
err = x.iterateClients(ctx, func(c client.Client) error {
|
||||
res, err = c.CreateSession(ctx, exp, opts...)
|
||||
return
|
||||
return err
|
||||
})
|
||||
|
||||
return res, err
|
||||
return
|
||||
}
|
||||
|
||||
func (x *multiClient) AnnounceLocalTrust(ctx context.Context, p client.AnnounceLocalTrustPrm, opts ...client.CallOption) (*client.AnnounceLocalTrustRes, error) {
|
||||
var res *client.AnnounceLocalTrustRes
|
||||
|
||||
err := x.iterateClients(ctx, func(c client.Client) (err error) {
|
||||
func (x *multiClient) AnnounceLocalTrust(ctx context.Context, p client.AnnounceLocalTrustPrm, opts ...client.CallOption) (res *client.AnnounceLocalTrustRes, err error) {
|
||||
err = x.iterateClients(ctx, func(c client.Client) error {
|
||||
res, err = c.AnnounceLocalTrust(ctx, p, opts...)
|
||||
return
|
||||
return err
|
||||
})
|
||||
|
||||
return res, err
|
||||
return
|
||||
}
|
||||
|
||||
func (x *multiClient) AnnounceIntermediateTrust(ctx context.Context, p client.AnnounceIntermediateTrustPrm, opts ...client.CallOption) (*client.AnnounceIntermediateTrustRes, error) {
|
||||
var res *client.AnnounceIntermediateTrustRes
|
||||
|
||||
err := x.iterateClients(ctx, func(c client.Client) (err error) {
|
||||
func (x *multiClient) AnnounceIntermediateTrust(ctx context.Context, p client.AnnounceIntermediateTrustPrm, opts ...client.CallOption) (res *client.AnnounceIntermediateTrustRes, err error) {
|
||||
err = x.iterateClients(ctx, func(c client.Client) error {
|
||||
res, err = c.AnnounceIntermediateTrust(ctx, p, opts...)
|
||||
return
|
||||
return err
|
||||
})
|
||||
|
||||
return res, err
|
||||
return
|
||||
}
|
||||
|
||||
func (x *multiClient) Raw() *rawclient.Client {
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"github.com/nspcc-dev/neofs-api-go/v2/object"
|
||||
objectGRPC "github.com/nspcc-dev/neofs-api-go/v2/object/grpc"
|
||||
objectSvc "github.com/nspcc-dev/neofs-node/pkg/services/object"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/util"
|
||||
)
|
||||
|
||||
// Server wraps NeoFS API Object service and
|
||||
|
@ -52,6 +53,15 @@ func (s *Server) Put(gStream objectGRPC.ObjectService_PutServer) error {
|
|||
}
|
||||
|
||||
if err := stream.Send(putReq); err != nil {
|
||||
if errors.Is(err, util.ErrAbortStream) {
|
||||
resp, err := stream.CloseAndRecv()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return gStream.SendAndClose(resp.ToGRPCMessage().(*objectGRPC.PutResponse))
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,9 @@ func (s *signService) Balance(ctx context.Context, req *accounting.BalanceReques
|
|||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
||||
return s.svc.Balance(ctx, req.(*accounting.BalanceRequest))
|
||||
},
|
||||
func() util.ResponseMessage {
|
||||
return new(accounting.BalanceResponse)
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -26,6 +26,9 @@ func (s *signService) Put(ctx context.Context, req *container.PutRequest) (*cont
|
|||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
||||
return s.svc.Put(ctx, req.(*container.PutRequest))
|
||||
},
|
||||
func() util.ResponseMessage {
|
||||
return new(container.PutResponse)
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -39,6 +42,9 @@ func (s *signService) Delete(ctx context.Context, req *container.DeleteRequest)
|
|||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
||||
return s.svc.Delete(ctx, req.(*container.DeleteRequest))
|
||||
},
|
||||
func() util.ResponseMessage {
|
||||
return new(container.DeleteResponse)
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -52,6 +58,9 @@ func (s *signService) Get(ctx context.Context, req *container.GetRequest) (*cont
|
|||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
||||
return s.svc.Get(ctx, req.(*container.GetRequest))
|
||||
},
|
||||
func() util.ResponseMessage {
|
||||
return new(container.GetResponse)
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -65,6 +74,9 @@ func (s *signService) List(ctx context.Context, req *container.ListRequest) (*co
|
|||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
||||
return s.svc.List(ctx, req.(*container.ListRequest))
|
||||
},
|
||||
func() util.ResponseMessage {
|
||||
return new(container.ListResponse)
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -78,6 +90,9 @@ func (s *signService) SetExtendedACL(ctx context.Context, req *container.SetExte
|
|||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
||||
return s.svc.SetExtendedACL(ctx, req.(*container.SetExtendedACLRequest))
|
||||
},
|
||||
func() util.ResponseMessage {
|
||||
return new(container.SetExtendedACLResponse)
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -91,6 +106,9 @@ func (s *signService) GetExtendedACL(ctx context.Context, req *container.GetExte
|
|||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
||||
return s.svc.GetExtendedACL(ctx, req.(*container.GetExtendedACLRequest))
|
||||
},
|
||||
func() util.ResponseMessage {
|
||||
return new(container.GetExtendedACLResponse)
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -104,6 +122,9 @@ func (s *signService) AnnounceUsedSpace(ctx context.Context, req *container.Anno
|
|||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
||||
return s.svc.AnnounceUsedSpace(ctx, req.(*container.AnnounceUsedSpaceRequest))
|
||||
},
|
||||
func() util.ResponseMessage {
|
||||
return new(container.AnnounceUsedSpaceResponse)
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package control
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neofs-api-go/rpc/grpc"
|
||||
"github.com/nspcc-dev/neofs-api-go/rpc/message"
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc"
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/rpc/message"
|
||||
)
|
||||
|
||||
type requestWrapper struct {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package control
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neofs-api-go/rpc/grpc"
|
||||
"github.com/nspcc-dev/neofs-api-go/rpc/message"
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc"
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/rpc/message"
|
||||
)
|
||||
|
||||
type requestWrapper struct {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package control
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neofs-api-go/rpc/client"
|
||||
"github.com/nspcc-dev/neofs-api-go/rpc/common"
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/rpc/client"
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/rpc/common"
|
||||
)
|
||||
|
||||
const serviceName = "ircontrol.ControlService"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package control
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neofs-api-go/util/proto"
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/util/proto"
|
||||
)
|
||||
|
||||
// StableMarshal reads binary representation of health check request body
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package control
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neofs-api-go/rpc/client"
|
||||
"github.com/nspcc-dev/neofs-api-go/rpc/common"
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/rpc/client"
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/rpc/common"
|
||||
)
|
||||
|
||||
const serviceName = "control.ControlService"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package control
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neofs-api-go/util/proto"
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/util/proto"
|
||||
)
|
||||
|
||||
// StableMarshal reads binary representation of health check request body
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package control
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neofs-api-go/util/proto"
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/util/proto"
|
||||
"google.golang.org/protobuf/encoding/protojson"
|
||||
)
|
||||
|
||||
|
|
|
@ -28,6 +28,9 @@ func (s *signService) LocalNodeInfo(
|
|||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
||||
return s.svc.LocalNodeInfo(ctx, req.(*netmap.LocalNodeInfoRequest))
|
||||
},
|
||||
func() util.ResponseMessage {
|
||||
return new(netmap.LocalNodeInfoResponse)
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -41,6 +44,9 @@ func (s *signService) NetworkInfo(ctx context.Context, req *netmap.NetworkInfoRe
|
|||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
||||
return s.svc.NetworkInfo(ctx, req.(*netmap.NetworkInfoRequest))
|
||||
},
|
||||
func() util.ResponseMessage {
|
||||
return new(netmap.NetworkInfoResponse)
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -9,10 +9,10 @@ import (
|
|||
"io"
|
||||
"sync"
|
||||
|
||||
rpcclient "github.com/nspcc-dev/neofs-api-go/rpc/client"
|
||||
objectV2 "github.com/nspcc-dev/neofs-api-go/v2/object"
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/refs"
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/rpc"
|
||||
rpcclient "github.com/nspcc-dev/neofs-api-go/v2/rpc/client"
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/session"
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/signature"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/core/client"
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
|
||||
session2 "github.com/nspcc-dev/neofs-api-go/v2/session"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/client"
|
||||
apistatus "github.com/nspcc-dev/neofs-sdk-go/client/status"
|
||||
cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/object"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/session"
|
||||
|
@ -112,12 +113,12 @@ func (x *GetObjectPrm) SetAddress(addr *object.Address) {
|
|||
|
||||
// GetObjectRes groups resulting values of GetObject operation.
|
||||
type GetObjectRes struct {
|
||||
cliRes *object.Object
|
||||
cliRes *client.ObjectGetRes
|
||||
}
|
||||
|
||||
// Object returns requested object.
|
||||
func (x GetObjectRes) Object() *object.Object {
|
||||
return x.cliRes
|
||||
return x.cliRes.Object()
|
||||
}
|
||||
|
||||
// GetObject reads the object by address.
|
||||
|
@ -130,6 +131,10 @@ func (x GetObjectRes) Object() *object.Object {
|
|||
// object.ErrAlreadyRemoved error if requested object is marked to be removed.
|
||||
func GetObject(prm GetObjectPrm) (res GetObjectRes, err error) {
|
||||
res.cliRes, err = prm.cli.GetObject(prm.ctx, &prm.cliPrm, prm.opts...)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(res.cliRes.Status())
|
||||
}
|
||||
|
||||
// FIXME: object.ErrAlreadyRemoved never returns
|
||||
|
||||
|
@ -159,12 +164,12 @@ func (x *HeadObjectPrm) SetAddress(addr *object.Address) {
|
|||
|
||||
// GetObjectRes groups resulting values of GetObject operation.
|
||||
type HeadObjectRes struct {
|
||||
cliRes *object.Object
|
||||
cliRes *client.ObjectHeadRes
|
||||
}
|
||||
|
||||
// Header returns requested object header.
|
||||
func (x HeadObjectRes) Header() *object.Object {
|
||||
return x.cliRes
|
||||
return x.cliRes.Object()
|
||||
}
|
||||
|
||||
// HeadObject reads object header by address.
|
||||
|
@ -176,7 +181,11 @@ func (x HeadObjectRes) Header() *object.Object {
|
|||
// error of type *object.SplitInfoError if object if raw flag is set and requested object is virtual;
|
||||
// object.ErrAlreadyRemoved error if requested object is marked to be removed.
|
||||
func HeadObject(prm HeadObjectPrm) (res HeadObjectRes, err error) {
|
||||
res.cliRes, err = prm.cli.GetObjectHeader(prm.ctx, &prm.cliPrm, prm.opts...)
|
||||
res.cliRes, err = prm.cli.HeadObject(prm.ctx, &prm.cliPrm, prm.opts...)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(res.cliRes.Status())
|
||||
}
|
||||
|
||||
// FIXME: object.ErrAlreadyRemoved never returns
|
||||
|
||||
|
@ -213,12 +222,12 @@ func (x *PayloadRangePrm) SetRange(rng *object.Range) {
|
|||
|
||||
// PayloadRangeRes groups resulting values of GetObject operation.
|
||||
type PayloadRangeRes struct {
|
||||
cliRes []byte
|
||||
cliRes *client.ObjectRangeRes
|
||||
}
|
||||
|
||||
// PayloadRange returns data of the requested payload range.
|
||||
func (x PayloadRangeRes) PayloadRange() []byte {
|
||||
return x.cliRes
|
||||
return x.cliRes.Data()
|
||||
}
|
||||
|
||||
// PayloadRange reads object payload range by address.
|
||||
|
@ -231,6 +240,10 @@ func (x PayloadRangeRes) PayloadRange() []byte {
|
|||
// object.ErrAlreadyRemoved error if requested object is marked to be removed.
|
||||
func PayloadRange(prm PayloadRangePrm) (res PayloadRangeRes, err error) {
|
||||
res.cliRes, err = prm.cli.ObjectPayloadRangeData(prm.ctx, &prm.cliPrm, prm.opts...)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(res.cliRes.Status())
|
||||
}
|
||||
|
||||
// FIXME: object.ErrAlreadyRemoved never returns
|
||||
|
||||
|
@ -253,12 +266,12 @@ func (x *PutObjectPrm) SetObject(obj *object.Object) {
|
|||
|
||||
// PutObjectRes groups resulting values of PutObject operation.
|
||||
type PutObjectRes struct {
|
||||
cliRes *object.ID
|
||||
cliRes *client.ObjectPutRes
|
||||
}
|
||||
|
||||
// ID returns identifier of the stored object.
|
||||
func (x PutObjectRes) ID() *object.ID {
|
||||
return x.cliRes
|
||||
return x.cliRes.ID()
|
||||
}
|
||||
|
||||
// PutObject saves the object in local storage of the remote node.
|
||||
|
@ -270,6 +283,10 @@ func PutObject(prm PutObjectPrm) (res PutObjectRes, err error) {
|
|||
res.cliRes, err = prm.cli.PutObject(prm.ctx, &prm.cliPrm,
|
||||
append(prm.opts, client.WithTTL(1))...,
|
||||
)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(res.cliRes.Status())
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -295,19 +312,23 @@ func (x *SearchObjectsPrm) SetFilters(fs object.SearchFilters) {
|
|||
|
||||
// SearchObjectsRes groups resulting values of SearchObjects operation.
|
||||
type SearchObjectsRes struct {
|
||||
cliRes []*object.ID
|
||||
cliRes *client.ObjectSearchRes
|
||||
}
|
||||
|
||||
// IDList returns identifiers of the matched objects.
|
||||
func (x SearchObjectsRes) IDList() []*object.ID {
|
||||
return x.cliRes
|
||||
return x.cliRes.IDList()
|
||||
}
|
||||
|
||||
// SearchObjects selects objects from container which match the filters.
|
||||
//
|
||||
// Returns any error prevented the operation from completing correctly in error return.
|
||||
func SearchObjects(prm SearchObjectsPrm) (res SearchObjectsRes, err error) {
|
||||
res.cliRes, err = prm.cli.SearchObject(prm.ctx, &prm.cliPrm, prm.opts...)
|
||||
res.cliRes, err = prm.cli.SearchObjects(prm.ctx, &prm.cliPrm, prm.opts...)
|
||||
if err == nil {
|
||||
// pull out an error from status
|
||||
err = apistatus.ErrFromStatus(res.cliRes.Status())
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@ import (
|
|||
"io"
|
||||
"sync"
|
||||
|
||||
rpcclient "github.com/nspcc-dev/neofs-api-go/rpc/client"
|
||||
objectV2 "github.com/nspcc-dev/neofs-api-go/v2/object"
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/rpc"
|
||||
rpcclient "github.com/nspcc-dev/neofs-api-go/v2/rpc/client"
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/session"
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/signature"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/core/client"
|
||||
|
|
|
@ -21,6 +21,8 @@ type searchStreamSigner struct {
|
|||
util.ServerStream
|
||||
|
||||
respWriter util.ResponseMessageWriter
|
||||
|
||||
nonEmptyResp bool // set on first Send call
|
||||
}
|
||||
|
||||
type getStreamSigner struct {
|
||||
|
@ -52,19 +54,20 @@ func (s *getStreamSigner) Send(resp *object.GetResponse) error {
|
|||
}
|
||||
|
||||
func (s *SignService) Get(req *object.GetRequest, stream GetObjectStream) error {
|
||||
respWriter, err := s.sigSvc.HandleServerStreamRequest(req,
|
||||
return s.sigSvc.HandleServerStreamRequest(req,
|
||||
func(resp util.ResponseMessage) error {
|
||||
return stream.Send(resp.(*object.GetResponse))
|
||||
},
|
||||
func() util.ResponseMessage {
|
||||
return new(object.GetResponse)
|
||||
},
|
||||
func(respWriter util.ResponseMessageWriter) error {
|
||||
return s.svc.Get(req, &getStreamSigner{
|
||||
ServerStream: stream,
|
||||
respWriter: respWriter,
|
||||
})
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return s.svc.Get(req, &getStreamSigner{
|
||||
ServerStream: stream,
|
||||
respWriter: respWriter,
|
||||
})
|
||||
}
|
||||
|
||||
func (s *putStreamSigner) Send(req *object.PutRequest) error {
|
||||
|
@ -94,6 +97,9 @@ func (s *SignService) Put(ctx context.Context) (PutObjectStream, error) {
|
|||
func() (util.ResponseMessage, error) {
|
||||
return stream.CloseAndRecv()
|
||||
},
|
||||
func() util.ResponseMessage {
|
||||
return new(object.PutResponse)
|
||||
},
|
||||
),
|
||||
}, nil
|
||||
}
|
||||
|
@ -103,6 +109,9 @@ func (s *SignService) Head(ctx context.Context, req *object.HeadRequest) (*objec
|
|||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
||||
return s.svc.Head(ctx, req.(*object.HeadRequest))
|
||||
},
|
||||
func() util.ResponseMessage {
|
||||
return new(object.HeadResponse)
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -112,23 +121,38 @@ func (s *SignService) Head(ctx context.Context, req *object.HeadRequest) (*objec
|
|||
}
|
||||
|
||||
func (s *searchStreamSigner) Send(resp *object.SearchResponse) error {
|
||||
s.nonEmptyResp = true
|
||||
return s.respWriter(resp)
|
||||
}
|
||||
|
||||
func (s *SignService) Search(req *object.SearchRequest, stream SearchStream) error {
|
||||
respWriter, err := s.sigSvc.HandleServerStreamRequest(req,
|
||||
return s.sigSvc.HandleServerStreamRequest(req,
|
||||
func(resp util.ResponseMessage) error {
|
||||
return stream.Send(resp.(*object.SearchResponse))
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
func() util.ResponseMessage {
|
||||
return new(object.SearchResponse)
|
||||
},
|
||||
func(respWriter util.ResponseMessageWriter) error {
|
||||
stream := &searchStreamSigner{
|
||||
ServerStream: stream,
|
||||
respWriter: respWriter,
|
||||
}
|
||||
|
||||
return s.svc.Search(req, &searchStreamSigner{
|
||||
ServerStream: stream,
|
||||
respWriter: respWriter,
|
||||
})
|
||||
err := s.svc.Search(req, stream)
|
||||
|
||||
if err == nil && !stream.nonEmptyResp {
|
||||
// The higher component does not write any response in the case of an empty result (which is correct).
|
||||
// With the introduction of status returns at least one answer must be signed and sent to the client.
|
||||
// This approach is supported by clients who do not know how to work with statuses (one could make
|
||||
// a switch according to the protocol version from the request, but the costs of sending an empty
|
||||
// answer can be neglected due to the gradual refusal to use the "old" clients).
|
||||
return stream.Send(new(object.SearchResponse))
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
func (s *SignService) Delete(ctx context.Context, req *object.DeleteRequest) (*object.DeleteResponse, error) {
|
||||
|
@ -136,6 +160,9 @@ func (s *SignService) Delete(ctx context.Context, req *object.DeleteRequest) (*o
|
|||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
||||
return s.svc.Delete(ctx, req.(*object.DeleteRequest))
|
||||
},
|
||||
func() util.ResponseMessage {
|
||||
return new(object.DeleteResponse)
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -149,19 +176,20 @@ func (s *getRangeStreamSigner) Send(resp *object.GetRangeResponse) error {
|
|||
}
|
||||
|
||||
func (s *SignService) GetRange(req *object.GetRangeRequest, stream GetObjectRangeStream) error {
|
||||
respWriter, err := s.sigSvc.HandleServerStreamRequest(req,
|
||||
return s.sigSvc.HandleServerStreamRequest(req,
|
||||
func(resp util.ResponseMessage) error {
|
||||
return stream.Send(resp.(*object.GetRangeResponse))
|
||||
},
|
||||
func() util.ResponseMessage {
|
||||
return new(object.GetRangeResponse)
|
||||
},
|
||||
func(respWriter util.ResponseMessageWriter) error {
|
||||
return s.svc.GetRange(req, &getRangeStreamSigner{
|
||||
ServerStream: stream,
|
||||
respWriter: respWriter,
|
||||
})
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return s.svc.GetRange(req, &getRangeStreamSigner{
|
||||
ServerStream: stream,
|
||||
respWriter: respWriter,
|
||||
})
|
||||
}
|
||||
|
||||
func (s *SignService) GetRangeHash(ctx context.Context, req *object.GetRangeHashRequest) (*object.GetRangeHashResponse, error) {
|
||||
|
@ -169,6 +197,9 @@ func (s *SignService) GetRangeHash(ctx context.Context, req *object.GetRangeHash
|
|||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
||||
return s.svc.GetRangeHash(ctx, req.(*object.GetRangeHashRequest))
|
||||
},
|
||||
func() util.ResponseMessage {
|
||||
return new(object.GetRangeHashResponse)
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -26,6 +26,9 @@ func (s *signService) AnnounceLocalTrust(ctx context.Context, req *reputation.An
|
|||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
||||
return s.svc.AnnounceLocalTrust(ctx, req.(*reputation.AnnounceLocalTrustRequest))
|
||||
},
|
||||
func() util.ResponseMessage {
|
||||
return new(reputation.AnnounceLocalTrustResponse)
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -39,6 +42,9 @@ func (s *signService) AnnounceIntermediateResult(ctx context.Context, req *reput
|
|||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
||||
return s.svc.AnnounceIntermediateResult(ctx, req.(*reputation.AnnounceIntermediateResultRequest))
|
||||
},
|
||||
func() util.ResponseMessage {
|
||||
return new(reputation.AnnounceIntermediateResultResponse)
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -26,6 +26,9 @@ func (s *signService) Create(ctx context.Context, req *session.CreateRequest) (*
|
|||
func(ctx context.Context, req interface{}) (util.ResponseMessage, error) {
|
||||
return s.svc.Create(ctx, req.(*session.CreateRequest))
|
||||
},
|
||||
func() util.ResponseMessage {
|
||||
return new(session.CreateResponse)
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -3,12 +3,18 @@ package util
|
|||
import (
|
||||
"context"
|
||||
"crypto/ecdsa"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/session"
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/signature"
|
||||
apistatus "github.com/nspcc-dev/neofs-sdk-go/client/status"
|
||||
)
|
||||
|
||||
type RequestMessage interface {
|
||||
GetMetaHeader() *session.RequestMetaHeader
|
||||
}
|
||||
|
||||
// ResponseMessage is an interface of NeoFS response message.
|
||||
type ResponseMessage interface {
|
||||
GetMetaHeader() *session.ResponseMetaHeader
|
||||
|
@ -27,11 +33,9 @@ type ServerStreamHandler func(context.Context, interface{}) (ResponseMessageRead
|
|||
|
||||
type ResponseMessageReader func() (ResponseMessage, error)
|
||||
|
||||
type ResponseMessageStreamer struct {
|
||||
key *ecdsa.PrivateKey
|
||||
var ErrAbortStream = errors.New("abort message stream")
|
||||
|
||||
recv ResponseMessageReader
|
||||
}
|
||||
type ResponseConstructor func() ResponseMessage
|
||||
|
||||
type RequestMessageWriter func(interface{}) error
|
||||
|
||||
|
@ -43,6 +47,12 @@ type RequestMessageStreamer struct {
|
|||
send RequestMessageWriter
|
||||
|
||||
close ClientStreamCloser
|
||||
|
||||
respCons ResponseConstructor
|
||||
|
||||
statusSupported bool
|
||||
|
||||
sendErr error
|
||||
}
|
||||
|
||||
func NewUnarySignService(key *ecdsa.PrivateKey) *SignService {
|
||||
|
@ -52,79 +62,192 @@ func NewUnarySignService(key *ecdsa.PrivateKey) *SignService {
|
|||
}
|
||||
|
||||
func (s *RequestMessageStreamer) Send(req interface{}) error {
|
||||
// req argument should be strengthen with type RequestMessage
|
||||
s.statusSupported = isStatusSupported(req.(RequestMessage)) // panic is OK here for now
|
||||
|
||||
var err error
|
||||
|
||||
// verify request signatures
|
||||
if err := signature.VerifyServiceMessage(req); err != nil {
|
||||
return fmt.Errorf("could not verify request: %w", err)
|
||||
if err = signature.VerifyServiceMessage(req); err != nil {
|
||||
err = fmt.Errorf("could not verify request: %w", err)
|
||||
} else {
|
||||
err = s.send(req)
|
||||
}
|
||||
|
||||
return s.send(req)
|
||||
if err != nil {
|
||||
if !s.statusSupported {
|
||||
return err
|
||||
}
|
||||
|
||||
s.sendErr = err
|
||||
|
||||
return ErrAbortStream
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *RequestMessageStreamer) CloseAndRecv() (ResponseMessage, error) {
|
||||
resp, err := s.close()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not close stream and receive response: %w", err)
|
||||
var (
|
||||
resp ResponseMessage
|
||||
err error
|
||||
)
|
||||
|
||||
if s.sendErr != nil {
|
||||
err = s.sendErr
|
||||
} else {
|
||||
resp, err = s.close()
|
||||
if err != nil {
|
||||
err = fmt.Errorf("could not close stream and receive response: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
if err := signature.SignServiceMessage(s.key, resp); err != nil {
|
||||
return nil, fmt.Errorf("could not sign response: %w", err)
|
||||
if err != nil {
|
||||
if !s.statusSupported {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var st apistatus.ServerInternal // specific API status should be set according to error
|
||||
|
||||
apistatus.WriteInternalServerErr(&st, err)
|
||||
|
||||
resp = s.respCons()
|
||||
|
||||
setStatusV2(resp, st)
|
||||
}
|
||||
|
||||
if err = signResponse(s.key, resp, s.statusSupported); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (s *SignService) CreateRequestStreamer(sender RequestMessageWriter, closer ClientStreamCloser) *RequestMessageStreamer {
|
||||
func (s *SignService) CreateRequestStreamer(sender RequestMessageWriter, closer ClientStreamCloser, blankResp ResponseConstructor) *RequestMessageStreamer {
|
||||
return &RequestMessageStreamer{
|
||||
key: s.key,
|
||||
send: sender,
|
||||
close: closer,
|
||||
|
||||
respCons: blankResp,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *ResponseMessageStreamer) Recv() (ResponseMessage, error) {
|
||||
m, err := s.recv()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not receive response message for signing: %w", err)
|
||||
}
|
||||
func (s *SignService) HandleServerStreamRequest(
|
||||
req interface{},
|
||||
respWriter ResponseMessageWriter,
|
||||
blankResp ResponseConstructor,
|
||||
respWriterCaller func(ResponseMessageWriter) error,
|
||||
) error {
|
||||
// handle protocol versions <=2.10 (API statuses was introduced in 2.11 only)
|
||||
|
||||
if err := signature.SignServiceMessage(s.key, m); err != nil {
|
||||
return nil, fmt.Errorf("could not sign response message: %w", err)
|
||||
}
|
||||
// req argument should be strengthen with type RequestMessage
|
||||
statusSupported := isStatusSupported(req.(RequestMessage)) // panic is OK here for now
|
||||
|
||||
return m, nil
|
||||
}
|
||||
var err error
|
||||
|
||||
func (s *SignService) HandleServerStreamRequest(req interface{}, respWriter ResponseMessageWriter) (ResponseMessageWriter, error) {
|
||||
// verify request signatures
|
||||
if err := signature.VerifyServiceMessage(req); err != nil {
|
||||
return nil, fmt.Errorf("could not verify request: %w", err)
|
||||
if err = signature.VerifyServiceMessage(req); err != nil {
|
||||
err = fmt.Errorf("could not verify request: %w", err)
|
||||
} else {
|
||||
err = respWriterCaller(func(resp ResponseMessage) error {
|
||||
if err := signResponse(s.key, resp, statusSupported); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return respWriter(resp)
|
||||
})
|
||||
}
|
||||
|
||||
return func(resp ResponseMessage) error {
|
||||
if err := signature.SignServiceMessage(s.key, resp); err != nil {
|
||||
return fmt.Errorf("could not sign response message: %w", err)
|
||||
if err != nil {
|
||||
if !statusSupported {
|
||||
return err
|
||||
}
|
||||
|
||||
return respWriter(resp)
|
||||
}, nil
|
||||
}
|
||||
var st apistatus.ServerInternal // specific API status should be set according to error
|
||||
|
||||
func (s *SignService) HandleUnaryRequest(ctx context.Context, req interface{}, handler UnaryHandler) (ResponseMessage, error) {
|
||||
// verify request signatures
|
||||
if err := signature.VerifyServiceMessage(req); err != nil {
|
||||
return nil, fmt.Errorf("could not verify request: %w", err)
|
||||
apistatus.WriteInternalServerErr(&st, err)
|
||||
|
||||
resp := blankResp()
|
||||
|
||||
setStatusV2(resp, st)
|
||||
|
||||
_ = signResponse(s.key, resp, false) // panics or returns nil with false arg
|
||||
|
||||
return respWriter(resp)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *SignService) HandleUnaryRequest(ctx context.Context, req interface{}, handler UnaryHandler, blankResp ResponseConstructor) (ResponseMessage, error) {
|
||||
// handle protocol versions <=2.10 (API statuses was introduced in 2.11 only)
|
||||
|
||||
// req argument should be strengthen with type RequestMessage
|
||||
statusSupported := isStatusSupported(req.(RequestMessage)) // panic is OK here for now
|
||||
|
||||
var (
|
||||
resp ResponseMessage
|
||||
err error
|
||||
)
|
||||
|
||||
// verify request signatures
|
||||
if err = signature.VerifyServiceMessage(req); err != nil {
|
||||
err = fmt.Errorf("could not verify request: %w", err)
|
||||
} else {
|
||||
// process request
|
||||
resp, err = handler(ctx, req)
|
||||
}
|
||||
|
||||
// process request
|
||||
resp, err := handler(ctx, req)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not handle request: %w", err)
|
||||
if !statusSupported {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var st apistatus.ServerInternal // specific API status should be set according to error
|
||||
|
||||
apistatus.WriteInternalServerErr(&st, err)
|
||||
|
||||
resp = blankResp()
|
||||
|
||||
setStatusV2(resp, st)
|
||||
}
|
||||
|
||||
// sign the response
|
||||
if err := signature.SignServiceMessage(s.key, resp); err != nil {
|
||||
return nil, fmt.Errorf("could not sign response: %w", err)
|
||||
if err = signResponse(s.key, resp, statusSupported); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func isStatusSupported(req RequestMessage) bool {
|
||||
version := req.GetMetaHeader().GetVersion()
|
||||
|
||||
mjr := version.GetMajor()
|
||||
|
||||
return mjr > 2 || mjr == 2 && version.GetMinor() >= 11
|
||||
}
|
||||
|
||||
func setStatusV2(resp ResponseMessage, st apistatus.Status) {
|
||||
session.SetStatus(resp, apistatus.ToStatusV2(st))
|
||||
}
|
||||
|
||||
// signs response with private key via signature.SignServiceMessage.
|
||||
// The signature error affects the result depending on the protocol version:
|
||||
// * if status return is supported, panics since we cannot return the failed status, because it will not be signed;
|
||||
// * otherwise, returns error in order to transport it directly.
|
||||
func signResponse(key *ecdsa.PrivateKey, resp interface{}, statusSupported bool) error {
|
||||
err := signature.SignServiceMessage(key, resp)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("could not sign response: %w", err)
|
||||
|
||||
if statusSupported {
|
||||
// We can't pass this error as status code since response will be unsigned.
|
||||
// Isn't expected in practice, so panic is ok here.
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue