Move api-v2 files into v2 subdir

This subdir contains generated proto files
and small wrappers.
This commit is contained in:
Alex Vanin 2020-08-13 15:43:47 +03:00 committed by Stanislav Bogatyrev
parent 0ee1c3653d
commit 1f143e54bd
48 changed files with 1479 additions and 1515 deletions

76
v2/accounting/service.go Normal file
View file

@ -0,0 +1,76 @@
package accounting
import (
"github.com/nspcc-dev/neofs-api-go/v2/refs"
"github.com/nspcc-dev/neofs-api-go/v2/service"
)
// SetValue sets value of the decimal number.
func (m *Decimal) SetValue(v int64) {
if m != nil {
m.Value = v
}
}
// SetPrecision sets precision of the decimal number.
func (m *Decimal) SetPrecision(v uint32) {
if m != nil {
m.Precision = v
}
}
// SetOwnerId sets identifier of the account owner.
func (m *BalanceRequest_Body) SetOwnerId(v *refs.OwnerID) {
if m != nil {
m.OwnerId = v
}
}
// SetBody sets body of the request.
func (m *BalanceRequest) SetBody(v *BalanceRequest_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the request.
func (m *BalanceRequest) SetMetaHeader(v *service.RequestMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the request.
func (m *BalanceRequest) SetVerifyHeader(v *service.RequestVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetBalance sets balance value of the response.
func (m *BalanceResponse_Body) SetBalance(v *Decimal) {
if m != nil {
m.Balance = v
}
}
// SetBody sets body of the response.
func (m *BalanceResponse) SetBody(v *BalanceResponse_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the response.
func (m *BalanceResponse) SetMetaHeader(v *service.ResponseMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the response.
func (m *BalanceResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}

1494
v2/accounting/service.pb.go Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,75 @@
syntax = "proto3";
package neo.fs.v2.accounting;
option go_package = "github.com/nspcc-dev/neofs-api-go/v2/accounting";
option csharp_namespace = "NeoFS.API.Accounting";
import "v2/refs/types.proto";
import "v2/service/meta.proto";
import "v2/service/verify.proto";
// The service provides methods for obtaining information
// about the account balance in NeoFS system.
service Accounting {
// Returns the amount of funds for the requested NeoFS account.
rpc Balance (BalanceRequest) returns (BalanceResponse);
}
// Message defines the request body of Balance method.
//
// To indicate the account for which the balance is requested, it's identifier
// is used.
//
// To gain access to the requested information, the request body must be formed
// according to the requirements from the system specification.
message BalanceRequest {
message Body {
// Carries user identifier in NeoFS system for which the balance
// is requested.
neo.fs.v2.refs.OwnerID owner_id = 1;
}
// Body of the balance request message.
Body body = 1;
// Carries request meta information. Header data is used only to regulate
// message transport and does not affect request execution.
neo.fs.v2.service.RequestMetaHeader meta_header = 2;
// Carries request verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
neo.fs.v2.service.RequestVerificationHeader verify_header = 3;
}
// Decimal represents the decimal numbers.
message Decimal {
// value carries number value.
int64 value = 1;
// precision carries value precision.
uint32 precision = 2;
}
// Message defines the response body of Balance method.
//
// The amount of funds is calculated in decimal numbers.
message BalanceResponse {
message Body {
// Carries the amount of funds on the account.
Decimal balance = 1;
}
// Body of the balance response message.
Body body = 1;
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
neo.fs.v2.service.ResponseMetaHeader meta_header = 2;
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
neo.fs.v2.service.ResponseVerificationHeader verify_header = 3;
}

89
v2/acl/types.go Normal file
View file

@ -0,0 +1,89 @@
package acl
import (
"github.com/nspcc-dev/neofs-api-go/v2/refs"
)
// SetContainerId sets container identifier of the eACL table.
func (m *EACLTable) SetContainerId(v *refs.ContainerID) {
if m != nil {
m.ContainerId = v
}
}
// SetRecords sets record list of the eACL table.
func (m *EACLTable) SetRecords(v []*EACLRecord) {
if m != nil {
m.Records = v
}
}
// SetOperation sets operation of the eACL record.
func (m *EACLRecord) SetOperation(v EACLRecord_Operation) {
if m != nil {
m.Operation = v
}
}
// SetAction sets action of the eACL record.
func (m *EACLRecord) SetAction(v EACLRecord_Action) {
if m != nil {
m.Action = v
}
}
// SetFilters sets filter list of the eACL record.
func (m *EACLRecord) SetFilters(v []*EACLRecord_FilterInfo) {
if m != nil {
m.Filters = v
}
}
// SetTargets sets target list of the eACL record.
func (m *EACLRecord) SetTargets(v []*EACLRecord_TargetInfo) {
if m != nil {
m.Targets = v
}
}
// SetHeader sets header type of the eACL filter.
func (m *EACLRecord_FilterInfo) SetHeader(v EACLRecord_FilterInfo_Header) {
if m != nil {
m.Header = v
}
}
// SetMatchType sets match type of the eACL filter.
func (m *EACLRecord_FilterInfo) SetMatchType(v EACLRecord_FilterInfo_MatchType) {
if m != nil {
m.MatchType = v
}
}
// SetHeaderName sets header name of the eACL filter.
func (m *EACLRecord_FilterInfo) SetHeaderName(v string) {
if m != nil {
m.HeaderName = v
}
}
// SetHeaderVal sets header value of the eACL filter.
func (m *EACLRecord_FilterInfo) SetHeaderVal(v string) {
if m != nil {
m.HeaderVal = v
}
}
// SetTarget sets target group of the eACL target.
func (m *EACLRecord_TargetInfo) SetTarget(v Target) {
if m != nil {
m.Target = v
}
}
// SetKeyList sets key list of the eACL target.
func (m *EACLRecord_TargetInfo) SetKeyList(v [][]byte) {
if m != nil {
m.KeyList = v
}
}

1478
v2/acl/types.pb.go Normal file

File diff suppressed because it is too large Load diff

106
v2/acl/types.proto Normal file
View file

@ -0,0 +1,106 @@
syntax = "proto3";
package neo.fs.v2.acl;
option go_package = "github.com/nspcc-dev/neofs-api-go/v2/acl";
option csharp_namespace = "NeoFS.API.Acl";
import "v2/refs/types.proto";
// Target of the access control rule in access control list.
enum Target {
// Unknown target, default value.
UNKNOWN = 0;
// User target rule is applied if sender is the owner of the container.
USER = 1;
// System target rule is applied if sender is the storage node within the
// container or inner ring node.
SYSTEM = 2;
// Others target rule is applied if sender is not user or system target.
OTHERS = 3;
}
// EACLRecord groups information about extended ACL rule.
message EACLRecord {
// Operation is an enumeration of operation types.
enum Operation {
OPERATION_UNKNOWN = 0;
GET = 1;
HEAD = 2;
PUT = 3;
DELETE = 4;
SEARCH = 5;
GETRANGE = 6;
GETRANGEHASH = 7;
}
// Operation carries type of operation.
Operation operation = 1 [json_name = "Operation"];
// Action is an enumeration of EACL actions.
enum Action {
ACTION_UNKNOWN = 0;
ALLOW = 1;
DENY = 2;
}
// Action carries ACL target action.
Action action = 2 [json_name = "Action"];
// FilterInfo groups information about filter.
message FilterInfo {
// Header is an enumeration of filtering header types.
enum Header {
HEADER_UNKNOWN = 0;
REQUEST = 1;
OBJECT = 2;
}
// Header carries type of header.
Header header = 1 [json_name = "HeaderType"];
// MatchType is an enumeration of match types.
enum MatchType {
MATCH_UNKNOWN = 0;
STRING_EQUAL = 1;
STRING_NOT_EQUAL = 2;
}
// MatchType carries type of match.
MatchType match_type = 2 [json_name = "MatchType"];
// header_name carries name of filtering header.
string header_name = 3 [json_name="Name"];
// header_val carries value of filtering header.
string header_val = 4 [json_name="Value"];
}
// filters carries set of filters.
repeated FilterInfo filters = 3 [json_name="Filters"];
// TargetInfo groups information about extended ACL target.
message TargetInfo {
// target carries target of ACL rule.
Target target = 1 [json_name="Role"];
// key_list carries public keys of ACL target.
repeated bytes key_list = 2 [json_name="Keys"];
}
// targets carries information about extended ACL target list.
repeated TargetInfo targets = 4 [json_name="Targets"];
}
// EACLRecord carries the information about extended ACL rules.
message EACLTable {
// Carries identifier of the container that should use given
// access control rules.
neo.fs.v2.refs.ContainerID container_id = 1 [json_name="ContainerID"];
// Records carries list of extended ACL rule records.
repeated EACLRecord records = 2 [json_name="Records"];
}

238
v2/container/marshal.go Normal file
View file

@ -0,0 +1,238 @@
package container
import (
"encoding/binary"
"math/bits"
"github.com/pkg/errors"
)
// StableMarshal marshals auto-generated container structure into
// protobuf-compatible stable byte sequence.
func (m *Container) StableMarshal(buf []byte) ([]byte, error) {
if m == nil {
return []byte{}, nil
}
if buf == nil {
buf = make([]byte, m.StableSize())
}
var (
i, n, offset int
)
// Write owner id field.
if m.OwnerId != nil {
buf[i] = 0x0A // id:0x1 << 3 | wiretype:0x2
n = m.OwnerId.StableSize()
offset = binary.PutUvarint(buf[i+1:], uint64(n))
_, err := m.OwnerId.StableMarshal(buf[i+1+offset:])
if err != nil {
return nil, errors.Wrapf(err, "can't marshal owner id")
}
i += 1 + offset + n
}
// Write salt field.
buf[i] = 0x12 // id:0x2 << 3 | wiretype:0x2
offset = binary.PutUvarint(buf[i+1:], uint64(len(m.Nonce)))
n = copy(buf[i+1+offset:], m.Nonce)
i += 1 + offset + n
// Write basic acl field.
buf[i] = 0x18 // id:0x3 << 3 | wiretype:0x0
offset = binary.PutUvarint(buf[i+1:], uint64(m.BasicAcl))
i += 1 + offset
// Write attributes field.
for j := range m.Attributes {
buf[i] = 0x22 // id:0x4 << 3 | wiretype:0x2
n = m.Attributes[j].StableSize()
offset = binary.PutUvarint(buf[i+1:], uint64(n))
_, err := m.Attributes[j].StableMarshal(buf[i+1+offset:])
if err != nil {
return nil, errors.Wrapf(err, "can't marshal attribute %v",
m.Attributes[i].Key)
}
i += 1 + offset + n
}
// Write placement rule field.
if m.Rules != nil {
buf[i] = 0x2A // id:0x5 << 3 | wiretype:0x2
n = m.Rules.StableSize()
offset = binary.PutUvarint(buf[i+1:], uint64(n))
_, err := m.Rules.StableMarshal(buf[i+1+offset:])
if err != nil {
return nil, errors.Wrapf(err, "can't marshal attribute %v",
m.Attributes[i].Key)
}
}
return buf, nil
}
func (m *Container) StableSize() int {
if m == nil {
return 0
}
var (
ln, size int
)
if m.OwnerId != nil {
ln = m.OwnerId.StableSize()
}
size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + bytes length + bytes
ln = len(m.Nonce) // size of salt field
size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + bytes length + bytes
// size of basic acl field
size += 1 + uvarIntSize(uint64(m.BasicAcl)) // wiretype + varint
// size of attributes
for i := range m.Attributes {
ln = m.Attributes[i].StableSize()
size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of struct + struct
}
// size of placement rule
if m.Rules != nil {
ln = m.Rules.StableSize()
size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of struct + struct
}
return size
}
func (m *Container_Attribute) StableMarshal(buf []byte) ([]byte, error) {
if m == nil {
return []byte{}, nil
}
if buf == nil {
buf = make([]byte, m.StableSize())
}
var (
i, n, offset int
)
// Write key field.
buf[i] = 0x0A // id:0x1 << 3 | wiretype:0x2
offset = binary.PutUvarint(buf[i+1:], uint64(len(m.Key)))
n = copy(buf[i+1+offset:], m.Key)
i += 1 + offset + n
// Write value field.
buf[i] = 0x12 // id:0x2 << 3 | wiretype:0x2
offset = binary.PutUvarint(buf[i+1:], uint64(len(m.Value)))
copy(buf[i+1+offset:], m.Value)
return buf, nil
}
func (m *Container_Attribute) StableSize() int {
if m == nil {
return 0
}
var (
ln, size int
)
ln = len(m.Key) // size of key field
size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of string + string
ln = len(m.Value) // size of value field
size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of string + string
return size
}
func (m *PutRequest_Body) StableMarshal(buf []byte) ([]byte, error) {
if m == nil {
return []byte{}, nil
}
if buf == nil {
buf = make([]byte, m.StableSize())
}
var (
i, n, offset int
)
// Write container field.
if m.Container != nil {
buf[i] = 0x0A // id:0x1 << 3 | wiretype:0x2
n = m.Container.StableSize()
offset = binary.PutUvarint(buf[i+1:], uint64(n))
_, err := m.Container.StableMarshal(buf[i+1+offset:])
if err != nil {
return nil, errors.Wrapf(err, "can't marshal container")
}
i += 1 + offset + n
}
// Write public key field.
buf[i] = 0x12 // id:0x2 << 3 | wiretype:0x2
offset = binary.PutUvarint(buf[i+1:], uint64(len(m.PublicKey)))
n = copy(buf[i+1+offset:], m.PublicKey)
i += 1 + offset + n
// Write signature field.
buf[i] = 0x1A // id:0x3 << 3 | wiretype:0x2
offset = binary.PutUvarint(buf[i+1:], uint64(len(m.Signature)))
copy(buf[i+1+offset:], m.Signature)
return buf, nil
}
func (m *PutRequest_Body) StableSize() int {
if m == nil {
return 0
}
var (
ln, size int
)
if m.Container != nil {
ln = m.Container.StableSize()
size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of string + string
}
ln = len(m.PublicKey)
size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of string + string
ln = len(m.Signature)
size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of string + string
return size
}
// uvarIntSize returns length of varint byte sequence for uint64 value 'x'.
func uvarIntSize(x uint64) int {
return (bits.Len64(x|1) + 6) / 7
}

View file

@ -0,0 +1,77 @@
package container
import (
"testing"
"github.com/nspcc-dev/neofs-api-go/v2/netmap"
"github.com/nspcc-dev/neofs-api-go/v2/refs"
"github.com/stretchr/testify/require"
)
var (
cnr = &Container{
OwnerId: &refs.OwnerID{Value: []byte("Owner")},
Nonce: []byte("Salt"),
BasicAcl: 505,
Attributes: []*Container_Attribute{
{
Key: "Hello",
Value: "World",
},
{
Key: "Privet",
Value: "Mir",
},
},
Rules: &netmap.PlacementRule{
ReplFactor: 4,
SfGroups: []*netmap.PlacementRule_SFGroup{
{
Selectors: []*netmap.PlacementRule_SFGroup_Selector{
{
Count: 1,
Key: "Node",
},
},
Filters: []*netmap.PlacementRule_SFGroup_Filter{
{
Key: "City",
},
{
Key: "Datacenter",
},
},
Exclude: []uint32{4, 5, 6},
},
},
},
}
)
func TestContainer_StableMarshal(t *testing.T) {
newCnr := new(Container)
wire, err := cnr.StableMarshal(nil)
require.NoError(t, err)
err = newCnr.Unmarshal(wire)
require.NoError(t, err)
require.Equal(t, cnr, newCnr)
}
func TestPutRequest_Body_StableMarshal(t *testing.T) {
expectedBody := new(PutRequest_Body)
expectedBody.Container = cnr
expectedBody.PublicKey = []byte{1, 2, 3, 4}
expectedBody.Signature = []byte{5, 6, 7, 8}
wire, err := expectedBody.StableMarshal(nil)
require.NoError(t, err)
gotBody := new(PutRequest_Body)
err = gotBody.Unmarshal(wire)
require.NoError(t, err)
require.Equal(t, expectedBody, gotBody)
}

362
v2/container/service.go Normal file
View file

@ -0,0 +1,362 @@
package container
import (
"github.com/nspcc-dev/neofs-api-go/v2/acl"
"github.com/nspcc-dev/neofs-api-go/v2/refs"
"github.com/nspcc-dev/neofs-api-go/v2/service"
)
// SetContainer sets container of the request.
func (m *PutRequest_Body) SetContainer(v *Container) {
if m != nil {
m.Container = v
}
}
// SetPublicKey sets public key of the container owner.
func (m *PutRequest_Body) SetPublicKey(v []byte) {
if m != nil {
m.PublicKey = v
}
}
// SetSignature sets signature of the container structure.
func (m *PutRequest_Body) SetSignature(v []byte) {
if m != nil {
m.Signature = v
}
}
// SetBody sets body of the request.
func (m *PutRequest) SetBody(v *PutRequest_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the request.
func (m *PutRequest) SetMetaHeader(v *service.RequestMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the request.
func (m *PutRequest) SetVerifyHeader(v *service.RequestVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetContainerId sets identifier of the container.
func (m *PutResponse_Body) SetContainerId(v *refs.ContainerID) {
if m != nil {
m.ContainerId = v
}
}
// SetBody sets body of the response.
func (m *PutResponse) SetBody(v *PutResponse_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the response.
func (m *PutResponse) SetMetaHeader(v *service.ResponseMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the response.
func (m *PutResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetContainerId sets identifier of the container.
func (m *DeleteRequest_Body) SetContainerId(v *refs.ContainerID) {
if m != nil {
m.ContainerId = v
}
}
// SetSignature sets signature of the container identifier.
func (m *DeleteRequest_Body) SetSignature(v []byte) {
if m != nil {
m.Signature = v
}
}
// SetBody sets body of the request.
func (m *DeleteRequest) SetBody(v *DeleteRequest_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the request.
func (m *DeleteRequest) SetMetaHeader(v *service.RequestMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the request.
func (m *DeleteRequest) SetVerifyHeader(v *service.RequestVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetBody sets body of the response.
func (m *DeleteResponse) SetBody(v *DeleteResponse_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the response.
func (m *DeleteResponse) SetMetaHeader(v *service.ResponseMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the response.
func (m *DeleteResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetContainerId sets identifier of the container.
func (m *GetRequest_Body) SetContainerId(v *refs.ContainerID) {
m.ContainerId = v
}
// SetBody sets body of the request.
func (m *GetRequest) SetBody(v *GetRequest_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the request.
func (m *GetRequest) SetMetaHeader(v *service.RequestMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the request.
func (m *GetRequest) SetVerifyHeader(v *service.RequestVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetContainer sets the container structure.
func (m *GetResponse_Body) SetContainer(v *Container) {
if m != nil {
m.Container = v
}
}
// SetBody sets body of the response.
func (m *GetResponse) SetBody(v *GetResponse_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the response.
func (m *GetResponse) SetMetaHeader(v *service.ResponseMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the response.
func (m *GetResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetOwnerId sets identifier of the container owner.
func (m *ListRequest_Body) SetOwnerId(v *refs.OwnerID) {
if m != nil {
m.OwnerId = v
}
}
// SetBody sets body of the request.
func (m *ListRequest) SetBody(v *ListRequest_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the request.
func (m *ListRequest) SetMetaHeader(v *service.RequestMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the request.
func (m *ListRequest) SetVerifyHeader(v *service.RequestVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetContainerIds sets list of the container identifiers.
func (m *ListResponse_Body) SetContainerIds(v []*refs.ContainerID) {
if m != nil {
m.ContainerIds = v
}
}
// SetBody sets body of the response.
func (m *ListResponse) SetBody(v *ListResponse_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the response.
func (m *ListResponse) SetMetaHeader(v *service.ResponseMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the response.
func (m *ListResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetEacl sets eACL table structure.
func (m *SetExtendedACLRequest_Body) SetEacl(v *acl.EACLTable) {
if m != nil {
m.Eacl = v
}
}
// SetSignature sets signature of the eACL table.
func (m *SetExtendedACLRequest_Body) SetSignature(v []byte) {
if m != nil {
m.Signature = v
}
}
// SetBody sets body of the request.
func (m *SetExtendedACLRequest) SetBody(v *SetExtendedACLRequest_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the request.
func (m *SetExtendedACLRequest) SetMetaHeader(v *service.RequestMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the request.
func (m *SetExtendedACLRequest) SetVerifyHeader(v *service.RequestVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetBody sets body of the response.
func (m *SetExtendedACLResponse) SetBody(v *SetExtendedACLResponse_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the response.
func (m *SetExtendedACLResponse) SetMetaHeader(v *service.ResponseMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the response.
func (m *SetExtendedACLResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetContainerId sets identifier of the container.
func (m *GetExtendedACLRequest_Body) SetContainerId(v *refs.ContainerID) {
if m != nil {
m.ContainerId = v
}
}
// SetBody sets body of the request.
func (m *GetExtendedACLRequest) SetBody(v *GetExtendedACLRequest_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the request.
func (m *GetExtendedACLRequest) SetMetaHeader(v *service.RequestMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the request.
func (m *GetExtendedACLRequest) SetVerifyHeader(v *service.RequestVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetEacl sets eACL table structure.
func (m *GetExtendedACLResponse_Body) SetEacl(v *acl.EACLTable) {
if m != nil {
m.Eacl = v
}
}
// SetSignature sets signature of the eACL table.
func (m *GetExtendedACLResponse_Body) SetSignature(v []byte) {
if m != nil {
m.Signature = v
}
}
// SetBody sets body of the response.
func (m *GetExtendedACLResponse) SetBody(v *GetExtendedACLResponse_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the response.
func (m *GetExtendedACLResponse) SetMetaHeader(v *service.ResponseMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the response.
func (m *GetExtendedACLResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}

6795
v2/container/service.pb.go Normal file

File diff suppressed because it is too large Load diff

285
v2/container/service.proto Normal file
View file

@ -0,0 +1,285 @@
syntax = "proto3";
package neo.fs.v2.container;
option go_package = "github.com/nspcc-dev/neofs-api-go/v2/container";
option csharp_namespace = "NeoFS.API.Container";
import "v2/acl/types.proto";
import "v2/container/types.proto";
import "v2/refs/types.proto";
import "v2/service/meta.proto";
import "v2/service/verify.proto";
// Service provides API to access container smart-contract in morph chain
// via NeoFS node.
service Service {
// Put invokes 'Put' method in container smart-contract and returns
// response immediately. After new block in morph chain, request is verified
// by inner ring nodes. After one more block in morph chain, container
// added into smart-contract storage.
rpc Put(PutRequest) returns (PutResponse);
// Delete invokes 'Delete' method in container smart-contract and returns
// response immediately. After new block in morph chain, request is verified
// by inner ring nodes. After one more block in morph chain, container
// removed from smart-contract storage.
rpc Delete(DeleteRequest) returns (DeleteResponse);
// Get returns container from container smart-contract storage.
rpc Get(GetRequest) returns (GetResponse);
// List returns all owner's containers from container smart-contract
// storage.
rpc List(ListRequest) returns (ListResponse);
// SetExtendedACL invokes 'SetEACL' method in container smart-contract and
// returns response immediately. After new block in morph chain,
// Extended ACL added into smart-contract storage.
rpc SetExtendedACL(SetExtendedACLRequest) returns (SetExtendedACLResponse);
// GetExtendedACL returns Extended ACL table and signature from container
// smart-contract storage.
rpc GetExtendedACL(GetExtendedACLRequest) returns (GetExtendedACLResponse);
}
message PutRequest {
message Body {
// Container to create in NeoFS.
neo.fs.v2.container.Container container = 1;
// Public Key of container owner. It can be public key of the owner
// or it can be public key that bound in neofs.id smart-contract.
bytes public_key = 2;
// Signature of stable-marshalled container according to RFC-6979.
bytes signature = 3;
}
// Body of container put request message.
Body body = 1;
// Carries request meta information. Header data is used only to regulate
// message transport and does not affect request execution.
neo.fs.v2.service.RequestMetaHeader meta_header = 2;
// Carries request verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
neo.fs.v2.service.RequestVerificationHeader verify_header = 3;
}
message PutResponse {
message Body {
// container_id carries identifier of the new container.
neo.fs.v2.refs.ContainerID container_id = 1;
}
// Body of container put response message.
Body body = 1;
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
neo.fs.v2.service.ResponseMetaHeader meta_header = 2;
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
neo.fs.v2.service.ResponseVerificationHeader verify_header = 3;
}
message DeleteRequest {
message Body {
// container_id carries identifier of the container to delete
// from NeoFS.
neo.fs.v2.refs.ContainerID container_id = 1;
// Signature of container id according to RFC-6979.
bytes signature = 2;
}
// Body of container delete request message.
Body body = 1;
// Carries request meta information. Header data is used only to regulate
// message transport and does not affect request execution.
neo.fs.v2.service.RequestMetaHeader meta_header = 2;
// Carries request verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
neo.fs.v2.service.RequestVerificationHeader verify_header = 3;
}
// DeleteResponse is empty because delete operation is asynchronous and done
// via consensus in inner ring nodes
message DeleteResponse {
message Body {}
// Body of container delete response message.
Body body = 1;
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
neo.fs.v2.service.ResponseMetaHeader meta_header = 2;
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
neo.fs.v2.service.ResponseVerificationHeader verify_header = 3;
}
message GetRequest {
message Body {
// container_id carries identifier of the container to get.
neo.fs.v2.refs.ContainerID container_id = 1;
}
// Body of container get request message.
Body body = 1;
// Carries request meta information. Header data is used only to regulate
// message transport and does not affect request execution.
neo.fs.v2.service.RequestMetaHeader meta_header = 2;
// Carries request verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
neo.fs.v2.service.RequestVerificationHeader verify_header = 3;
}
message GetResponse {
message Body {
// Container that has been requested.
neo.fs.v2.container.Container container = 1;
}
// Body of container get response message.
Body body = 1;
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
neo.fs.v2.service.ResponseMetaHeader meta_header = 2;
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
neo.fs.v2.service.ResponseVerificationHeader verify_header = 3;
}
message ListRequest {
message Body {
// owner_id carries identifier of the container owner.
neo.fs.v2.refs.OwnerID owner_id = 1;
}
// Body of list containers request message.
Body body = 1;
// Carries request meta information. Header data is used only to regulate
// message transport and does not affect request execution.
neo.fs.v2.service.RequestMetaHeader meta_header = 2;
// Carries request verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
neo.fs.v2.service.RequestVerificationHeader verify_header = 3;
}
message ListResponse {
message Body {
// ContainerIDs carries list of identifiers of the containers that belong to the owner.
repeated refs.ContainerID container_ids = 1;
}
// Body of list containers response message.
Body body = 1;
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
neo.fs.v2.service.ResponseMetaHeader meta_header = 2;
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
neo.fs.v2.service.ResponseVerificationHeader verify_header = 3;
}
message SetExtendedACLRequest {
message Body {
// Extended ACL to set for the container.
neo.fs.v2.acl.EACLTable eacl = 1;
// Signature of stable-marshalled Extended ACL according to RFC-6979.
bytes signature = 2;
}
// Body of set extended acl request message.
Body body = 1;
// Carries request meta information. Header data is used only to regulate
// message transport and does not affect request execution.
neo.fs.v2.service.RequestMetaHeader meta_header = 2;
// Carries request verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
neo.fs.v2.service.RequestVerificationHeader verify_header = 3;
}
message SetExtendedACLResponse {
message Body { }
// Body of set extended acl response message.
Body body = 1;
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
neo.fs.v2.service.ResponseMetaHeader meta_header = 2;
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
neo.fs.v2.service.ResponseVerificationHeader verify_header = 3;
}
message GetExtendedACLRequest {
message Body {
// container_id carries identifier of the container that has Extended ACL.
neo.fs.v2.refs.ContainerID container_id = 1;
}
// Body of get extended acl request message.
Body body = 1;
// Carries request meta information. Header data is used only to regulate
// message transport and does not affect request execution.
neo.fs.v2.service.RequestMetaHeader meta_header = 2;
// Carries request verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
neo.fs.v2.service.RequestVerificationHeader verify_header = 3;
}
message GetExtendedACLResponse {
message Body {
// Extended ACL that has been requested if it was set up.
neo.fs.v2.acl.EACLTable eacl = 1;
// Signature of stable-marshalled Extended ACL according to RFC-6979.
bytes signature = 2;
}
// Body of get extended acl response message.
Body body = 1;
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
neo.fs.v2.service.ResponseMetaHeader meta_header = 2;
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
neo.fs.v2.service.ResponseVerificationHeader verify_header = 3;
}

17
v2/container/signature.go Normal file
View file

@ -0,0 +1,17 @@
package container
func (m *Container) ReadSignedData(buf []byte) ([]byte, error) {
return m.StableMarshal(buf)
}
func (m *Container) SignedDataSize() int {
return m.StableSize()
}
func (m *PutRequest_Body) ReadSignedData(buf []byte) ([]byte, error) {
return m.StableMarshal(buf)
}
func (m *PutRequest_Body) SignedDataSize() int {
return m.StableSize()
}

55
v2/container/types.go Normal file
View file

@ -0,0 +1,55 @@
package container
import (
"github.com/nspcc-dev/neofs-api-go/v2/netmap"
"github.com/nspcc-dev/neofs-api-go/v2/refs"
)
// SetKey sets key to the container attribute.
func (m *Container_Attribute) SetKey(v string) {
if m != nil {
m.Key = v
}
}
// SetValue sets value of the container attribute.
func (m *Container_Attribute) SetValue(v string) {
if m != nil {
m.Value = v
}
}
// SetOwnerId sets identifier of the container owner,
func (m *Container) SetOwnerId(v *refs.OwnerID) {
if m != nil {
m.OwnerId = v
}
}
// SetNonce sets nonce of the container structure.
func (m *Container) SetNonce(v []byte) {
if m != nil {
m.Nonce = v
}
}
// SetBasicAcl sets basic ACL of the container.
func (m *Container) SetBasicAcl(v uint32) {
if m != nil {
m.BasicAcl = v
}
}
// SetAttributes sets list of the container attributes.
func (m *Container) SetAttributes(v []*Container_Attribute) {
if m != nil {
m.Attributes = v
}
}
// SetRules sets placement rules of the container.
func (m *Container) SetRules(v *netmap.PlacementRule) {
if m != nil {
m.Rules = v
}
}

809
v2/container/types.pb.go Normal file
View file

@ -0,0 +1,809 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: v2/container/types.proto
package container
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap"
refs "github.com/nspcc-dev/neofs-api-go/v2/refs"
io "io"
math "math"
math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Container is a structure that defines object placement behaviour. Objects
// can be stored only within containers. They define placement rule, attributes
// and access control information. ID of the container is a 32 byte long
// SHA256 hash of stable-marshalled container message.
type Container struct {
// OwnerID carries identifier of the container owner.
OwnerId *refs.OwnerID `protobuf:"bytes,1,opt,name=owner_id,json=ownerId,proto3" json:"owner_id,omitempty"`
// Nonce is a 16 byte UUID, used to avoid collisions of container id.
Nonce []byte `protobuf:"bytes,2,opt,name=nonce,proto3" json:"nonce,omitempty"`
// BasicACL contains access control rules for owner, system, others groups and
// permission bits for bearer token and Extended ACL.
BasicAcl uint32 `protobuf:"varint,3,opt,name=basic_acl,json=basicAcl,proto3" json:"basic_acl,omitempty"`
// Attributes define any immutable characteristics of container.
Attributes []*Container_Attribute `protobuf:"bytes,4,rep,name=attributes,proto3" json:"attributes,omitempty"`
// Rules define storage policy for the object inside the container.
Rules *netmap.PlacementRule `protobuf:"bytes,5,opt,name=rules,proto3" json:"rules,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Container) Reset() { *m = Container{} }
func (m *Container) String() string { return proto.CompactTextString(m) }
func (*Container) ProtoMessage() {}
func (*Container) Descriptor() ([]byte, []int) {
return fileDescriptor_ece71f25e6ae314e, []int{0}
}
func (m *Container) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Container) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Container.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Container) XXX_Merge(src proto.Message) {
xxx_messageInfo_Container.Merge(m, src)
}
func (m *Container) XXX_Size() int {
return m.Size()
}
func (m *Container) XXX_DiscardUnknown() {
xxx_messageInfo_Container.DiscardUnknown(m)
}
var xxx_messageInfo_Container proto.InternalMessageInfo
func (m *Container) GetOwnerId() *refs.OwnerID {
if m != nil {
return m.OwnerId
}
return nil
}
func (m *Container) GetNonce() []byte {
if m != nil {
return m.Nonce
}
return nil
}
func (m *Container) GetBasicAcl() uint32 {
if m != nil {
return m.BasicAcl
}
return 0
}
func (m *Container) GetAttributes() []*Container_Attribute {
if m != nil {
return m.Attributes
}
return nil
}
func (m *Container) GetRules() *netmap.PlacementRule {
if m != nil {
return m.Rules
}
return nil
}
// Attribute is a key-value pair of strings.
type Container_Attribute struct {
// Key of immutable container attribute.
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
// Value of immutable container attribute.
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Container_Attribute) Reset() { *m = Container_Attribute{} }
func (m *Container_Attribute) String() string { return proto.CompactTextString(m) }
func (*Container_Attribute) ProtoMessage() {}
func (*Container_Attribute) Descriptor() ([]byte, []int) {
return fileDescriptor_ece71f25e6ae314e, []int{0, 0}
}
func (m *Container_Attribute) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Container_Attribute) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Container_Attribute.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Container_Attribute) XXX_Merge(src proto.Message) {
xxx_messageInfo_Container_Attribute.Merge(m, src)
}
func (m *Container_Attribute) XXX_Size() int {
return m.Size()
}
func (m *Container_Attribute) XXX_DiscardUnknown() {
xxx_messageInfo_Container_Attribute.DiscardUnknown(m)
}
var xxx_messageInfo_Container_Attribute proto.InternalMessageInfo
func (m *Container_Attribute) GetKey() string {
if m != nil {
return m.Key
}
return ""
}
func (m *Container_Attribute) GetValue() string {
if m != nil {
return m.Value
}
return ""
}
func init() {
proto.RegisterType((*Container)(nil), "neo.fs.v2.container.Container")
proto.RegisterType((*Container_Attribute)(nil), "neo.fs.v2.container.Container.Attribute")
}
func init() { proto.RegisterFile("v2/container/types.proto", fileDescriptor_ece71f25e6ae314e) }
var fileDescriptor_ece71f25e6ae314e = []byte{
// 345 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xd1, 0x4a, 0xc3, 0x30,
0x14, 0x86, 0xed, 0xe6, 0x74, 0xcd, 0x14, 0xa4, 0x53, 0x2c, 0x13, 0x6a, 0xf1, 0xaa, 0x37, 0x4b,
0x20, 0xc3, 0x07, 0x98, 0x8a, 0xb8, 0x1b, 0x1d, 0x11, 0xbc, 0xf0, 0x66, 0xa4, 0xd9, 0xd9, 0x2c,
0x76, 0x49, 0x69, 0xd2, 0xca, 0xde, 0xc4, 0x47, 0x10, 0x9f, 0xc4, 0x4b, 0x1f, 0x41, 0xe6, 0x8b,
0x48, 0x5b, 0xb6, 0xf5, 0xc2, 0xbb, 0x9c, 0x93, 0xff, 0x3f, 0x39, 0x5f, 0x7e, 0xe4, 0xe6, 0x94,
0x08, 0x25, 0x0d, 0x8f, 0x24, 0xa4, 0xc4, 0x2c, 0x13, 0xd0, 0x38, 0x49, 0x95, 0x51, 0x4e, 0x57,
0x82, 0xc2, 0x33, 0x8d, 0x73, 0x8a, 0x37, 0x82, 0xde, 0x49, 0x4e, 0x89, 0x04, 0xb3, 0xe0, 0x49,
0x5d, 0xdb, 0xeb, 0xe6, 0x94, 0xa4, 0x30, 0xd3, 0xf5, 0xe6, 0xc5, 0x47, 0x03, 0xd9, 0xd7, 0x6b,
0xa7, 0x43, 0x51, 0x5b, 0xbd, 0x49, 0x48, 0x27, 0xd1, 0xd4, 0xb5, 0x7c, 0x2b, 0xe8, 0xd0, 0x53,
0xbc, 0x7d, 0xa1, 0x30, 0xe3, 0x87, 0xe2, 0x7e, 0x74, 0xc3, 0xf6, 0x4b, 0xe1, 0x68, 0xea, 0x1c,
0xa3, 0x96, 0x54, 0x52, 0x80, 0xdb, 0xf0, 0xad, 0xe0, 0x80, 0x55, 0x85, 0x73, 0x86, 0xec, 0x90,
0xeb, 0x48, 0x4c, 0xb8, 0x88, 0xdd, 0xa6, 0x6f, 0x05, 0x87, 0xac, 0x5d, 0x36, 0x86, 0x22, 0x76,
0xee, 0x10, 0xe2, 0xc6, 0xa4, 0x51, 0x98, 0x19, 0xd0, 0xee, 0xae, 0xdf, 0x0c, 0x3a, 0x34, 0xc0,
0xff, 0xa0, 0xe0, 0xcd, 0x6a, 0x78, 0xb8, 0x36, 0xb0, 0x9a, 0xd7, 0xb9, 0x44, 0xad, 0x34, 0x8b,
0x41, 0xbb, 0xad, 0x72, 0xdb, 0xf3, 0xda, 0x90, 0xea, 0x07, 0xf0, 0x38, 0xe6, 0x02, 0x16, 0x20,
0x0d, 0xcb, 0x62, 0x60, 0x95, 0xba, 0x37, 0x40, 0xf6, 0x66, 0x9e, 0x73, 0x84, 0x9a, 0xaf, 0xb0,
0x2c, 0x79, 0x6d, 0x56, 0x1c, 0x0b, 0xa4, 0x9c, 0xc7, 0x59, 0x85, 0x64, 0xb3, 0xaa, 0xb8, 0x7a,
0xfa, 0x5a, 0x79, 0xd6, 0xf7, 0xca, 0xb3, 0x7e, 0x56, 0x9e, 0xf5, 0xfe, 0xeb, 0xed, 0x3c, 0xe3,
0x79, 0x64, 0x5e, 0xb2, 0x10, 0x0b, 0xb5, 0x20, 0x52, 0x27, 0x42, 0xf4, 0xa7, 0x90, 0x13, 0x09,
0x6a, 0xa6, 0xfb, 0x3c, 0x89, 0xfa, 0x73, 0x45, 0xea, 0xc9, 0x7d, 0x36, 0xba, 0xf7, 0xa0, 0x6e,
0x1f, 0xf1, 0x70, 0x3c, 0xda, 0x92, 0x85, 0x7b, 0x65, 0x12, 0x83, 0xbf, 0x00, 0x00, 0x00, 0xff,
0xff, 0xde, 0x82, 0x60, 0x33, 0xe6, 0x01, 0x00, 0x00,
}
func (m *Container) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Container) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Container) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if m.Rules != nil {
{
size, err := m.Rules.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTypes(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x2a
}
if len(m.Attributes) > 0 {
for iNdEx := len(m.Attributes) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Attributes[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTypes(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
}
}
if m.BasicAcl != 0 {
i = encodeVarintTypes(dAtA, i, uint64(m.BasicAcl))
i--
dAtA[i] = 0x18
}
if len(m.Nonce) > 0 {
i -= len(m.Nonce)
copy(dAtA[i:], m.Nonce)
i = encodeVarintTypes(dAtA, i, uint64(len(m.Nonce)))
i--
dAtA[i] = 0x12
}
if m.OwnerId != nil {
{
size, err := m.OwnerId.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTypes(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *Container_Attribute) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Container_Attribute) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Container_Attribute) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if len(m.Value) > 0 {
i -= len(m.Value)
copy(dAtA[i:], m.Value)
i = encodeVarintTypes(dAtA, i, uint64(len(m.Value)))
i--
dAtA[i] = 0x12
}
if len(m.Key) > 0 {
i -= len(m.Key)
copy(dAtA[i:], m.Key)
i = encodeVarintTypes(dAtA, i, uint64(len(m.Key)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintTypes(dAtA []byte, offset int, v uint64) int {
offset -= sovTypes(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *Container) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.OwnerId != nil {
l = m.OwnerId.Size()
n += 1 + l + sovTypes(uint64(l))
}
l = len(m.Nonce)
if l > 0 {
n += 1 + l + sovTypes(uint64(l))
}
if m.BasicAcl != 0 {
n += 1 + sovTypes(uint64(m.BasicAcl))
}
if len(m.Attributes) > 0 {
for _, e := range m.Attributes {
l = e.Size()
n += 1 + l + sovTypes(uint64(l))
}
}
if m.Rules != nil {
l = m.Rules.Size()
n += 1 + l + sovTypes(uint64(l))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func (m *Container_Attribute) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Key)
if l > 0 {
n += 1 + l + sovTypes(uint64(l))
}
l = len(m.Value)
if l > 0 {
n += 1 + l + sovTypes(uint64(l))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func sovTypes(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozTypes(x uint64) (n int) {
return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *Container) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Container: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Container: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OwnerId", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTypes
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTypes
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.OwnerId == nil {
m.OwnerId = &refs.OwnerID{}
}
if err := m.OwnerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthTypes
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthTypes
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Nonce = append(m.Nonce[:0], dAtA[iNdEx:postIndex]...)
if m.Nonce == nil {
m.Nonce = []byte{}
}
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field BasicAcl", wireType)
}
m.BasicAcl = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.BasicAcl |= uint32(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTypes
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTypes
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Attributes = append(m.Attributes, &Container_Attribute{})
if err := m.Attributes[len(m.Attributes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Rules", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTypes
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTypes
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Rules == nil {
m.Rules = &netmap.PlacementRule{}
}
if err := m.Rules.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTypes(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTypes
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthTypes
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *Container_Attribute) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Attribute: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Attribute: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTypes
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTypes
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Key = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTypes
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTypes
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Value = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTypes(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTypes
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthTypes
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipTypes(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTypes
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTypes
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTypes
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthTypes
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupTypes
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthTypes
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group")
)

40
v2/container/types.proto Normal file
View file

@ -0,0 +1,40 @@
syntax = "proto3";
package neo.fs.v2.container;
option go_package = "github.com/nspcc-dev/neofs-api-go/v2/container";
option csharp_namespace = "NeoFS.API.Container";
import "v2/netmap/types.proto";
import "v2/refs/types.proto";
// Container is a structure that defines object placement behaviour. Objects
// can be stored only within containers. They define placement rule, attributes
// and access control information. ID of the container is a 32 byte long
// SHA256 hash of stable-marshalled container message.
message Container {
// OwnerID carries identifier of the container owner.
neo.fs.v2.refs.OwnerID owner_id = 1;
// Nonce is a 16 byte UUID, used to avoid collisions of container id.
bytes nonce = 2;
// BasicACL contains access control rules for owner, system, others groups and
// permission bits for bearer token and Extended ACL.
uint32 basic_acl = 3;
// Attribute is a key-value pair of strings.
message Attribute {
// Key of immutable container attribute.
string key = 1;
// Value of immutable container attribute.
string value = 2;
}
// Attributes define any immutable characteristics of container.
repeated Attribute attributes = 4;
// Rules define storage policy for the object inside the container.
neo.fs.v2.netmap.PlacementRule rules = 5;
}

362
v2/netmap/marshal.go Normal file
View file

@ -0,0 +1,362 @@
package netmap
import (
"encoding/binary"
"math/bits"
"github.com/pkg/errors"
)
func (m *PlacementRule) StableMarshal(buf []byte) ([]byte, error) {
if m == nil {
return []byte{}, nil
}
if buf == nil {
buf = make([]byte, m.StableSize())
}
var (
i, n, offset int
)
// Write replication factor field.
buf[i] = 0x08 // id:0x1 << 3 | wiretype:0x0
offset = binary.PutUvarint(buf[i+1:], uint64(m.ReplFactor))
i += 1 + offset
// write select/filter groups field
for j := range m.SfGroups {
buf[i] = 0x12 // id:0x2 << 3 | wiretype:0x2
n, _ = m.SfGroups[j].stableSizeWithExclude()
offset = binary.PutUvarint(buf[i+1:], uint64(n))
_, err := m.SfGroups[j].StableMarshal(buf[i+1+offset:])
if err != nil {
return nil, errors.Wrapf(err, "can't marshal SFGroup id:%d", j)
}
i += 1 + offset + n
}
return buf, nil
}
func (m *PlacementRule) StableSize() int {
if m == nil {
return 0
}
var (
ln, size int
)
_ = ln
// size of replication factor field
size += 1 + uvarIntSize(uint64(m.ReplFactor)) // wiretype + varint
for i := range m.SfGroups {
ln, _ = m.SfGroups[i].stableSizeWithExclude()
size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of struct + struct
}
return size
}
func (m *PlacementRule_SFGroup) StableMarshal(buf []byte) ([]byte, error) {
if m == nil {
return []byte{}, nil
}
size, excludeSize := m.stableSizeWithExclude()
if buf == nil {
buf = make([]byte, size)
}
var (
i, n, offset int
)
// write filters field
for j := range m.Filters {
buf[i] = 0x0A // id:0x1 << 3 | wiretype:0x2
n = m.Filters[j].stableSize()
offset = binary.PutUvarint(buf[i+1:], uint64(n))
_, err := m.Filters[j].StableMarshal(buf[i+1+offset:])
if err != nil {
return nil, errors.Wrapf(err, "can't marshal Filter id:%d", j)
}
i += 1 + offset + n
}
// write selectors field
for j := range m.Selectors {
buf[i] = 0x12 // id:0x2 << 3 | wiretype:0x2
n = m.Selectors[j].stableSize()
offset = binary.PutUvarint(buf[i+1:], uint64(n))
_, err := m.Selectors[j].StableMarshal(buf[i+1+offset:])
if err != nil {
return nil, errors.Wrapf(err, "can't marshal Selector id:%d", j)
}
i += 1 + offset + n
}
// write excluded field in packed format
buf[i] = 0x1A // id:0x3 << 3 | wiretype:0x2
offset = binary.PutUvarint(buf[i+1:], uint64(excludeSize))
i += 1 + offset
for j := range m.Exclude {
offset = binary.PutUvarint(buf[i:], uint64(m.Exclude[j]))
i += offset
}
return buf, nil
}
func (m *PlacementRule_SFGroup) stableSizeWithExclude() (int, int) {
if m == nil {
return 0, 0
}
var (
ln, size int
)
// size of filters field
for i := range m.Filters {
ln = m.Filters[i].stableSize()
size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of struct + struct
}
// size of selectors field
for i := range m.Selectors {
ln = m.Selectors[i].stableSize()
size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of struct + struct
}
// size of exclude field
ln = 0
for i := range m.Exclude {
ln += uvarIntSize(uint64(m.Exclude[i]))
}
size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + packed varints size + packed varints
return size, ln
}
func (m *PlacementRule_SFGroup_Selector) StableMarshal(buf []byte) ([]byte, error) {
if m == nil {
return []byte{}, nil
}
if buf == nil {
buf = make([]byte, m.stableSize())
}
var (
i, offset int
)
// write count field
buf[i] = 0x8 // id:0x1 << 3 | wiretype:0x0
offset = binary.PutUvarint(buf[i+1:], uint64(m.Count))
i += 1 + offset
// write key field
buf[i] = 0x12 // id:0x2 << 3 | wiretype:0x2
offset = binary.PutUvarint(buf[i+1:], uint64(len(m.Key)))
copy(buf[i+1+offset:], m.Key)
return buf, nil
}
func (m *PlacementRule_SFGroup_Selector) stableSize() int {
if m == nil {
return 0
}
var (
ln, size int
)
// size of count field
size += 1 + uvarIntSize(uint64(m.Count))
// size of key field
ln = len(m.Key)
size += 1 + uvarIntSize(uint64(ln)) + ln
return size
}
func (m *PlacementRule_SFGroup_Filter) StableMarshal(buf []byte) ([]byte, error) {
if m == nil {
return []byte{}, nil
}
if buf == nil {
buf = make([]byte, m.stableSize())
}
var (
i, n, offset int
)
// write key field
buf[i] = 0x0A // id:0x1 << 3 | wiretype:0x2
offset = binary.PutUvarint(buf[i+1:], uint64(len(m.Key)))
n = copy(buf[i+1+offset:], m.Key)
i += 1 + offset + n
// write simple filter field
if m.F != nil {
buf[i] = 0x12 // id:0x2 << 3 | wiretype:0x2
n = m.F.stableSize()
offset = binary.PutUvarint(buf[i+1:], uint64(n))
_, err := m.F.StableMarshal(buf[i+1+offset:])
if err != nil {
return nil, errors.Wrap(err, "can't marshal netmap filter")
}
}
return buf, nil
}
func (m *PlacementRule_SFGroup_Filter) stableSize() int {
if m == nil {
return 0
}
var (
ln, size int
)
// size of key field
ln = len(m.Key)
size += 1 + uvarIntSize(uint64(ln)) + ln
// size of simple filter
if m.F != nil {
ln = m.F.stableSize()
size += 1 + uvarIntSize(uint64(ln)) + ln
}
return size
}
func (m *PlacementRule_SFGroup_Filter_SimpleFilter) StableMarshal(buf []byte) ([]byte, error) {
if m == nil {
return []byte{}, nil
}
if buf == nil {
buf = make([]byte, m.stableSize())
}
var (
i, n, offset int
)
// write key field
buf[i] = 0x08 // id:0x1 << 3 | wiretype:0x0
offset = binary.PutUvarint(buf[i+1:], uint64(m.Op))
i += 1 + offset
// write value if present
if val, ok := m.Args.(*PlacementRule_SFGroup_Filter_SimpleFilter_Value); ok {
buf[i] = 0x12 // id:0x2 << 3 | wiretype:0x2
offset = binary.PutUvarint(buf[i+1:], uint64(len(val.Value)))
copy(buf[i+1+offset:], val.Value)
} else if filters, ok := m.Args.(*PlacementRule_SFGroup_Filter_SimpleFilter_FArgs); ok {
if filters.FArgs != nil {
buf[i] = 0x1A // id:0x3 << 3 | wiretype:0x2
n = filters.FArgs.stableSize()
offset = binary.PutUvarint(buf[i+1:], uint64(n))
_, err := filters.FArgs.StableMarshal(buf[i+1+offset:])
if err != nil {
return nil, errors.Wrap(err, "can't marshal simple filters")
}
}
}
return buf, nil
}
func (m *PlacementRule_SFGroup_Filter_SimpleFilter) stableSize() int {
if m == nil {
return 0
}
var (
ln, size int
)
// size of key field
size += 1 + uvarIntSize(uint64(m.Op))
if val, ok := m.Args.(*PlacementRule_SFGroup_Filter_SimpleFilter_Value); ok {
// size of value if present
ln = len(val.Value)
size += 1 + uvarIntSize(uint64(ln)) + ln
} else if filters, ok := m.Args.(*PlacementRule_SFGroup_Filter_SimpleFilter_FArgs); ok {
// size of simple filters if present
if filters.FArgs != nil {
ln = filters.FArgs.stableSize()
size += 1 + uvarIntSize(uint64(ln)) + ln
}
}
return size
}
func (m *PlacementRule_SFGroup_Filter_SimpleFilters) StableMarshal(buf []byte) ([]byte, error) {
if m == nil {
return []byte{}, nil
}
if buf == nil {
buf = make([]byte, m.stableSize())
}
var (
i, n, offset int
)
// write filters field
for j := range m.Filters {
buf[i] = 0x0A // id:0x1 << 3 | wiretype:0x2
n = m.Filters[j].stableSize()
offset = binary.PutUvarint(buf[i+1:], uint64(n))
_, err := m.Filters[j].StableMarshal(buf[i+1+offset:])
if err != nil {
return nil, errors.Wrapf(err, "can't marshal simple filter id:%d", j)
}
i += 1 + offset + n
}
return buf, nil
}
func (m *PlacementRule_SFGroup_Filter_SimpleFilters) stableSize() int {
if m == nil {
return 0
}
var (
ln, size int
)
// size of key field
for i := range m.Filters {
ln = m.Filters[i].stableSize()
size += 1 + uvarIntSize(uint64(ln)) + ln
}
return size
}
// uvarIntSize returns length of varint byte sequence for uint64 value 'x'.
func uvarIntSize(x uint64) int {
return (bits.Len64(x|1) + 6) / 7
}

138
v2/netmap/types.go Normal file
View file

@ -0,0 +1,138 @@
package netmap
// SetOp sets operation of the simple filter.
func (m *PlacementRule_SFGroup_Filter_SimpleFilter) SetOp(v PlacementRule_SFGroup_Filter_SimpleFilter_Operation) {
if m != nil {
m.Op = v
}
}
// SetValue sets value of the simple filter.
func (m *PlacementRule_SFGroup_Filter_SimpleFilter) SetValue(v string) {
if m != nil {
m.Args = &PlacementRule_SFGroup_Filter_SimpleFilter_Value{
Value: v,
}
}
}
// SetFArgs sets filter args of the simple filter.
func (m *PlacementRule_SFGroup_Filter_SimpleFilter) SetFArgs(v *PlacementRule_SFGroup_Filter_SimpleFilters) {
if m != nil {
m.Args = &PlacementRule_SFGroup_Filter_SimpleFilter_FArgs{
FArgs: v,
}
}
}
// SetFilters sets list of the simple filters.
func (m *PlacementRule_SFGroup_Filter_SimpleFilters) SetFilters(v []*PlacementRule_SFGroup_Filter_SimpleFilter) {
if m != nil {
m.Filters = v
}
}
// SeyKey sets key of the filter.
func (m *PlacementRule_SFGroup_Filter) SeyKey(v string) {
if m != nil {
m.Key = v
}
}
// SetF sets simple filter of the filter.
func (m *PlacementRule_SFGroup_Filter) SetF(v *PlacementRule_SFGroup_Filter_SimpleFilter) {
if m != nil {
m.F = v
}
}
// SetCount sets count value of the selector.
func (m *PlacementRule_SFGroup_Selector) SetCount(v uint32) {
if m != nil {
m.Count = v
}
}
// SetKey sets key of the selector.
func (m *PlacementRule_SFGroup_Selector) SetKey(v string) {
if m != nil {
m.Key = v
}
}
// SetFilters sets list of the filters.
func (m *PlacementRule_SFGroup) SetFilters(v []*PlacementRule_SFGroup_Filter) {
if m != nil {
m.Filters = v
}
}
// SetSelectors sets list of the selectors.
func (m *PlacementRule_SFGroup) SetSelectors(v []*PlacementRule_SFGroup_Selector) {
if m != nil {
m.Selectors = v
}
}
// SetExclude sets exclude list.
func (m *PlacementRule_SFGroup) SetExclude(v []uint32) {
if m != nil {
m.Exclude = v
}
}
// SetReplFactor sets replication factor of the placement rule.
func (m *PlacementRule) SetReplFactor(v uint32) {
if m != nil {
m.ReplFactor = v
}
}
// SetSfGroups sets list of the selector-filter groups.
func (m *PlacementRule) SetSfGroups(v []*PlacementRule_SFGroup) {
if m != nil {
m.SfGroups = v
}
}
// SetKey sets key to the node attribute.
func (m *NodeInfo_Attribute) SetKey(v string) {
if m != nil {
m.Key = v
}
}
// SetValue sets value of the node attribute.
func (m *NodeInfo_Attribute) SetValue(v string) {
if m != nil {
m.Value = v
}
}
// SetAddress sets node network address.
func (m *NodeInfo) SetAddress(v string) {
if m != nil {
m.Address = v
}
}
// SetPublicKey sets node public key in a binary format.
func (m *NodeInfo) SetPublicKey(v []byte) {
if m != nil {
m.PublicKey = v
}
}
// SetAttributes sets list of the node attributes.
func (m *NodeInfo) SetAttributes(v []*NodeInfo_Attribute) {
if m != nil {
m.Attributes = v
}
}
// SetState sets node state.
func (m *NodeInfo) SetState(v NodeInfo_State) {
if m != nil {
m.State = v
}
}

2449
v2/netmap/types.pb.go Normal file

File diff suppressed because it is too large Load diff

92
v2/netmap/types.proto Normal file
View file

@ -0,0 +1,92 @@
syntax = "proto3";
package neo.fs.v2.netmap;
option go_package = "github.com/nspcc-dev/neofs-api-go/v2/netmap";
option csharp_namespace = "NeoFS.API.Netmap";
message PlacementRule {
uint32 repl_factor = 1;
message SFGroup {
message Filter {
string key = 1;
message SimpleFilters {
repeated SimpleFilter filters = 1;
}
message SimpleFilter {
enum Operation {
NP = 0;
EQ = 1;
NE = 2;
GT = 3;
GE = 4;
LT = 5;
LE = 6;
OR = 7;
AND = 8;
}
Operation op = 1;
oneof args {
string value = 2;
SimpleFilters f_args = 3;
}
}
SimpleFilter f = 2;
}
repeated Filter filters = 1;
message Selector {
uint32 count = 1;
string key = 2;
}
repeated Selector selectors = 2;
repeated uint32 exclude = 3;
}
repeated SFGroup sf_groups = 2;
}
// Groups the information about the NeoFS node.
message NodeInfo {
// Carries network address of the NeoFS node.
string address = 1;
// Carries public key of the NeoFS node in a binary format.
bytes public_key = 2;
// Groups attributes of the NeoFS node.
message Attribute {
// Carries string key to the node attribute.
string key = 1;
// Carries string value of the node attribute.
string value = 2;
}
// Carries list of the NeoFS node attributes in a string key-value format.
repeated Attribute attributes = 3;
// Represents the enumeration of various states of the NeoFS node.
enum State {
// Undefined state.
UNKNOWN = 0;
// Active state in the network.
ONLINE = 1;
// Network unavailable state.
OFFLINE = 2;
}
// Carries state of the NeoFS node.
State state = 4;
}

585
v2/object/service.go Normal file
View file

@ -0,0 +1,585 @@
package object
import (
"github.com/nspcc-dev/neofs-api-go/v2/refs"
"github.com/nspcc-dev/neofs-api-go/v2/service"
)
// SetAddress sets address of the requested object.
func (m *GetRequest_Body) SetAddress(v *refs.Address) {
if m != nil {
m.Address = v
}
}
// SetRaw sets raw flag of the request.
func (m *GetRequest_Body) SetRaw(v bool) {
if m != nil {
m.Raw = v
}
}
// SetBody sets body of the request.
func (m *GetRequest) SetBody(v *GetRequest_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the request.
func (m *GetRequest) SetMetaHeader(v *service.RequestMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the request.
func (m *GetRequest) SetVerifyHeader(v *service.RequestVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetObjectId sets identifier of the object.
func (m *GetResponse_Body_Init) SetObjectId(v *refs.ObjectID) {
if m != nil {
m.ObjectId = v
}
}
// SetSignature sets signature of the object identifier.
func (m *GetResponse_Body_Init) SetSignature(v *service.Signature) {
if m != nil {
m.Signature = v
}
}
// SetHeader sets header of the object.
func (m *GetResponse_Body_Init) SetHeader(v *Header) {
if m != nil {
m.Header = v
}
}
// SetInit sets initial part of the object.
func (m *GetResponse_Body) SetInit(v *GetResponse_Body_Init) {
if m != nil {
m.ObjectPart = &GetResponse_Body_Init_{
Init: v,
}
}
}
// SetChunk sets chunk of the object payload bytes.
func (m *GetResponse_Body) SetChunk(v []byte) {
if m != nil {
m.ObjectPart = &GetResponse_Body_Chunk{
Chunk: v,
}
}
}
// SetBody sets body of the response.
func (m *GetResponse) SetBody(v *GetResponse_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the response.
func (m *GetResponse) SetMetaHeader(v *service.ResponseMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the response.
func (m *GetResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetObjectId sets identifier of the object.
func (m *PutRequest_Body_Init) SetObjectId(v *refs.ObjectID) {
if m != nil {
m.ObjectId = v
}
}
// SetSignature sets signature of the object identifier.
func (m *PutRequest_Body_Init) SetSignature(v *service.Signature) {
if m != nil {
m.Signature = v
}
}
// SetHeader sets header of the object.
func (m *PutRequest_Body_Init) SetHeader(v *Header) {
if m != nil {
m.Header = v
}
}
// SetCopiesNumber sets number of the copies to save.
func (m *PutRequest_Body_Init) SetCopiesNumber(v uint32) {
if m != nil {
m.CopiesNumber = v
}
}
// SetInit sets initial part of the object.
func (m *PutRequest_Body) SetInit(v *PutRequest_Body_Init) {
if m != nil {
m.ObjectPart = &PutRequest_Body_Init_{
Init: v,
}
}
}
// SetChunk sets chunk of the object paloyad bytes.
func (m *PutRequest_Body) SetChunk(v []byte) {
if m != nil {
m.ObjectPart = &PutRequest_Body_Chunk{
Chunk: v,
}
}
}
// SetBody sets body of the request.
func (m *PutRequest) SetBody(v *PutRequest_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the request.
func (m *PutRequest) SetMetaHeader(v *service.RequestMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the request.
func (m *PutRequest) SetVerifyHeader(v *service.RequestVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetObjectId sets identifier of the saved object.
func (m *PutResponse_Body) SetObjectId(v *refs.ObjectID) {
if m != nil {
m.ObjectId = v
}
}
// SetBody sets body of the response.
func (m *PutResponse) SetBody(v *PutResponse_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the response.
func (m *PutResponse) SetMetaHeader(v *service.ResponseMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the response.
func (m *PutResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetAddress sets address of the object to delete.
func (m *DeleteRequest_Body) SetAddress(v *refs.Address) {
if m != nil {
m.Address = v
}
}
// SetOwnerId sets identifier of the removing object owner.
func (m *DeleteRequest_Body) SetOwnerId(v *refs.OwnerID) {
if m != nil {
m.OwnerId = v
}
}
// SetBody sets body of the request.
func (m *DeleteRequest) SetBody(v *DeleteRequest_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the request.
func (m *DeleteRequest) SetMetaHeader(v *service.RequestMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the request.
func (m *DeleteRequest) SetVerifyHeader(v *service.RequestVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetBody sets body of the response.
func (m *DeleteResponse) SetBody(v *DeleteResponse_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the response.
func (m *DeleteResponse) SetMetaHeader(v *service.ResponseMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the response.
func (m *DeleteResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetOwnerId sets identifier of the object with the requested header.
func (m *HeadRequest_Body) SetOwnerId(v *refs.Address) {
if m != nil {
m.Address = v
}
}
// SetMainOnly sets flag to return the minimal header subset.
func (m *HeadRequest_Body) SetMainOnly(v bool) {
if m != nil {
m.MainOnly = v
}
}
// SetRaw sets raw flag of the request.
func (m *HeadRequest_Body) SetRaw(v bool) {
if m != nil {
m.Raw = v
}
}
// SetBody sets body of the request.
func (m *HeadRequest) SetBody(v *HeadRequest_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the request.
func (m *HeadRequest) SetMetaHeader(v *service.RequestMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the request.
func (m *HeadRequest) SetVerifyHeader(v *service.RequestVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetVersion sets version of the object format.
func (m *HeadResponse_Body_ShortHeader) SetVersion(v *service.Version) {
if m != nil {
m.Version = v
}
}
// SetCreationEpoch sets creation epoch number of the object.
func (m *HeadResponse_Body_ShortHeader) SetCreationEpoch(v uint64) {
if m != nil {
m.CreationEpoch = v
}
}
// SetOwnerId sets identifier of the object owner.
func (m *HeadResponse_Body_ShortHeader) SetOwnerId(v *refs.OwnerID) {
if m != nil {
m.OwnerId = v
}
}
// SetObjectType sets type of the object.
func (m *HeadResponse_Body_ShortHeader) SetObjectType(v ObjectType) {
if m != nil {
m.ObjectType = v
}
}
// SetPayloadLength sets length of the object payload.
func (m *HeadResponse_Body_ShortHeader) SetPayloadLength(v uint64) {
if m != nil {
m.PayloadLength = v
}
}
// SetHeader sets full header of the object.
func (m *HeadResponse_Body) SetHeader(v *Header) {
if m != nil {
m.Head = &HeadResponse_Body_Header{
Header: v,
}
}
}
// SetShortHeader sets short header of the object.
func (m *HeadResponse_Body) SetShortHeader(v *HeadResponse_Body_ShortHeader) {
if m != nil {
m.Head = &HeadResponse_Body_ShortHeader_{
ShortHeader: v,
}
}
}
// SetBody sets body of the response.
func (m *HeadResponse) SetBody(v *HeadResponse_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the response.
func (m *HeadResponse) SetMetaHeader(v *service.ResponseMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the response.
func (m *HeadResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetMatchType sets match type of the filter.
func (m *SearchRequest_Body_Query_Filter) SetMatchType(v SearchRequest_Body_Query_Filter_MatchType) {
if m != nil {
m.MatchType = v
}
}
// SetName sets name of the filtering header.
func (m *SearchRequest_Body_Query_Filter) SetName(v string) {
if m != nil {
m.Name = v
}
}
// SetValue sets value of the filtering header.
func (m *SearchRequest_Body_Query_Filter) SetValue(v string) {
if m != nil {
m.Value = v
}
}
// SetVersion sets version of the search query.
func (m *SearchRequest_Body_Query) SetVersion(v uint32) {
if m != nil {
m.Version = v
}
}
// SetFilters sets list of the query filters.
func (m *SearchRequest_Body_Query) SetFilters(v []*SearchRequest_Body_Query_Filter) {
if m != nil {
m.Filters = v
}
}
// SetRaw sets raw flag of the request.
func (m *SearchRequest_Body) SetContainerId(v *refs.ContainerID) {
if m != nil {
m.ContainerId = v
}
}
// SetQuery sets search query structure.
func (m *SearchRequest_Body) SetQuery(v *SearchRequest_Body_Query) {
if m != nil {
m.Query = v
}
}
// SetBody sets body of the request.
func (m *SearchRequest) SetBody(v *SearchRequest_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the request.
func (m *SearchRequest) SetMetaHeader(v *service.RequestMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the request.
func (m *SearchRequest) SetVerifyHeader(v *service.RequestVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetIdList sets list of the identifiers of the matched objects.
func (m *SearchResponse_Body) SetIdList(v []*refs.ObjectID) {
if m != nil {
m.IdList = v
}
}
// SetBody sets body of the response.
func (m *SearchResponse) SetBody(v *SearchResponse_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the response.
func (m *SearchResponse) SetMetaHeader(v *service.ResponseMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the response.
func (m *SearchResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetOffset sets offset of the payload range.
func (m *Range) SetOffset(v uint64) {
if m != nil {
m.Offset = v
}
}
// SetLength sets length of the payload range.
func (m *Range) SetLength(v uint64) {
if m != nil {
m.Length = v
}
}
// SetAddress sets address of the object with the request payload range.
func (m *GetRangeRequest_Body) SetAddress(v *refs.Address) {
if m != nil {
m.Address = v
}
}
// SetRange sets range of the object payload.
func (m *GetRangeRequest_Body) SetRange(v *Range) {
if m != nil {
m.Range = v
}
}
// SetBody sets body of the request.
func (m *GetRangeRequest) SetBody(v *GetRangeRequest_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the request.
func (m *GetRangeRequest) SetMetaHeader(v *service.RequestMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the request.
func (m *GetRangeRequest) SetVerifyHeader(v *service.RequestVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetChunk sets chunk of the object payload.
func (m *GetRangeResponse_Body) SetChunk(v []byte) {
if m != nil {
m.Chunk = v
}
}
// SetBody sets body of the response.
func (m *GetRangeResponse) SetBody(v *GetRangeResponse_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the response.
func (m *GetRangeResponse) SetMetaHeader(v *service.ResponseMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the response.
func (m *GetRangeResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetAddress sets address of the object with the request payload range.
func (m *GetRangeHashRequest_Body) SetAddress(v *refs.Address) {
if m != nil {
m.Address = v
}
}
// SetRanges sets list of the ranges of the object payload.
func (m *GetRangeHashRequest_Body) SetRanges(v []*Range) {
if m != nil {
m.Ranges = v
}
}
// SetSalt sets salt for the object payload ranges.
func (m *GetRangeHashRequest_Body) SetSalt(v []byte) {
if m != nil {
m.Salt = v
}
}
// SetBody sets body of the request.
func (m *GetRangeHashRequest) SetBody(v *GetRangeHashRequest_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the request.
func (m *GetRangeHashRequest) SetMetaHeader(v *service.RequestMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the request.
func (m *GetRangeHashRequest) SetVerifyHeader(v *service.RequestVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}

10394
v2/object/service.pb.go Normal file

File diff suppressed because it is too large Load diff

407
v2/object/service.proto Normal file
View file

@ -0,0 +1,407 @@
syntax = "proto3";
package neo.fs.v2.object;
option go_package = "github.com/nspcc-dev/neofs-api-go/v2/object";
option csharp_namespace = "NeoFS.API.Object";
import "v2/object/types.proto";
import "v2/refs/types.proto";
import "v2/service/meta.proto";
import "v2/service/verify.proto";
// Object service provides API for manipulating with the object.
service Service {
// Get the object from container. Response uses gRPC stream. First response
// message carry object of requested address. Chunk messages are parts of
// the object's payload if it is needed. All messages except first carry
// chunks. Requested object can be restored by concatenation of object
// message payload and all chunks keeping receiving order.
rpc Get(GetRequest) returns (stream GetResponse);
// Put the object into container. Request uses gRPC stream. First message
// SHOULD BE type of PutHeader. Container id and Owner id of object SHOULD
// BE set. Session token SHOULD BE obtained before put operation (see
// session package). Chunk messages considered by server as part of object
// payload. All messages except first SHOULD BE chunks. Chunk messages
// SHOULD BE sent in direct order of fragmentation.
rpc Put(stream PutRequest) returns (PutResponse);
// Delete the object from a container
rpc Delete(DeleteRequest) returns (DeleteResponse);
// Head returns the object without data payload. Object in the
// response has system header only. If full headers flag is set, extended
// headers are also present.
rpc Head(HeadRequest) returns (HeadResponse);
// Search objects in container. Version of query language format SHOULD BE
// set to 1. Search query represented in serialized format (see query
// package).
rpc Search(SearchRequest) returns (stream SearchResponse);
// GetRange of data payload. Range is a pair (offset, length).
// Requested range can be restored by concatenation of all chunks
// keeping receiving order.
rpc GetRange(GetRangeRequest) returns (stream GetRangeResponse);
// GetRangeHash returns homomorphic hash of object payload range after XOR
// operation. Ranges are set of pairs (offset, length). Hashes order in
// response corresponds to ranges order in request. Homomorphic hash is
// calculated for XORed data.
rpc GetRangeHash(GetRangeHashRequest) returns (GetRangeHashResponse);
}
message GetRequest {
message Body {
// Address of the requested object.
neo.fs.v2.refs.Address address = 1;
// Carries the raw option flag of the request.
// Raw request is sent to receive only the objects
// that are physically stored on the server.
bool raw = 2;
}
// Body of get object request message.
Body body = 1;
// Carries request meta information. Header data is used only to regulate message
// transport and does not affect request execution.
neo.fs.v2.service.RequestMetaHeader meta_header = 2;
// Carries request verification information. This header is used to authenticate
// the nodes of the message route and check the correctness of transmission.
neo.fs.v2.service.RequestVerificationHeader verify_header = 3;
}
message GetResponse {
message Body {
// Initialization parameters of the object got from NeoFS.
message Init {
// Object ID
neo.fs.v2.refs.ObjectID object_id = 1;
// Object signature
neo.fs.v2.service.Signature signature =2;
// Object header.
Header header = 3;
}
// Carries the single message of the response stream.
oneof object_part {
// Initialization parameters of the object stream.
Init init =1;
// Part of the object payload.
bytes chunk = 2;
}
}
// Body of get object response message.
Body body = 1;
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
neo.fs.v2.service.ResponseMetaHeader meta_header = 2;
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
neo.fs.v2.service.ResponseVerificationHeader verify_header = 3;
}
message PutRequest {
message Body {
// Groups initialization parameters of object placement in NeoFS.
message Init {
// Object ID, where available
neo.fs.v2.refs.ObjectID object_id = 1;
// Object signature, were available
neo.fs.v2.service.Signature signature =2;
// Header of the object to save in the system.
Header header = 3;
// Number of the object copies to store within the RPC call.
// Default zero value is processed according to the
// container placement rules.
uint32 copies_number = 4;
}
// Carries the single part of the query stream.
oneof object_part {
// Carries the initialization parameters of the object stream.
Init init = 1;
// Carries part of the object payload.
bytes chunk = 2;
}
}
// Body of put object request message.
Body body = 1;
// Carries request meta information. Header data is used only to regulate message
// transport and does not affect request execution.
neo.fs.v2.service.RequestMetaHeader meta_header = 2;
// Carries request verification information. This header is used to authenticate
// the nodes of the message route and check the correctness of transmission.
neo.fs.v2.service.RequestVerificationHeader verify_header = 3;
}
message PutResponse {
message Body {
// Carries identifier of the saved object.
// It is used to access an object in the container.
neo.fs.v2.refs.ObjectID object_id = 1;
}
// Body of put object response message.
Body body = 1;
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
neo.fs.v2.service.ResponseMetaHeader meta_header = 2;
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
neo.fs.v2.service.ResponseVerificationHeader verify_header = 3;
}
message DeleteRequest {
message Body {
// Carries the address of the object to be deleted.
neo.fs.v2.refs.Address address = 1;
// Carries identifier the object owner.
neo.fs.v2.refs.OwnerID owner_id = 2;
}
// Body of delete object request message.
Body body = 1;
// Carries request meta information. Header data is used only to regulate message
// transport and does not affect request execution.
neo.fs.v2.service.RequestMetaHeader meta_header = 2;
// Carries request verification information. This header is used to authenticate
// the nodes of the message route and check the correctness of transmission.
neo.fs.v2.service.RequestVerificationHeader verify_header = 3;
}
// DeleteResponse is empty because we cannot guarantee permanent object removal
// in distributed system.
message DeleteResponse {
message Body { }
// Body of delete object response message.
Body body = 1;
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
neo.fs.v2.service.ResponseMetaHeader meta_header = 2;
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
neo.fs.v2.service.ResponseVerificationHeader verify_header = 3;
}
message HeadRequest {
message Body {
// Address of the object with the requested header.
neo.fs.v2.refs.Address address = 1;
// Return only minimal header subset
bool main_only = 2;
// Carries the raw option flag of the request.
// Raw request is sent to receive only the headers of the objects
// that are physically stored on the server.
bool raw = 3;
}
// Body of head object request message.
Body body = 1;
// Carries request meta information. Header data is used only to regulate message
// transport and does not affect request execution.
neo.fs.v2.service.RequestMetaHeader meta_header = 2;
// Carries request verification information. This header is used to authenticate
// the nodes of the message route and check the correctness of transmission.
neo.fs.v2.service.RequestVerificationHeader verify_header = 3;
}
message HeadResponse {
message Body {
message ShortHeader {
// Object format version.
neo.fs.v2.service.Version version = 1;
// Epoch when the object was created
uint64 creation_epoch = 2;
// Object's owner
neo.fs.v2.refs.OwnerID owner_id = 3;
// Type of the object payload content
ObjectType object_type = 4;
// Size of payload in bytes.
// 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown
uint64 payload_length = 5;
}
// Carries the requested object header or it's part
oneof head{
Header header = 1;
ShortHeader short_header = 2;
}
}
// Body of head object response message.
Body body = 1;
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
neo.fs.v2.service.ResponseMetaHeader meta_header = 2;
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
neo.fs.v2.service.ResponseVerificationHeader verify_header = 3;
}
message SearchRequest {
message Body {
// Carries search container identifier.
neo.fs.v2.refs.ContainerID container_id = 1;
message Query {
uint32 version = 1;
message Filter {
enum MatchType {
MATCH_UNKNOWN = 0;
STRING_EQUAL = 1;
}
MatchType match_type = 1;
string name = 2;
string value = 3;
}
repeated Filter filters = 2;
}
Query query = 2;
}
// Body of search object request message.
Body body = 1;
// Carries request meta information. Header data is used only to regulate message
// transport and does not affect request execution.
neo.fs.v2.service.RequestMetaHeader meta_header = 2;
// Carries request verification information. This header is used to authenticate
// the nodes of the message route and check the correctness of transmission.
neo.fs.v2.service.RequestVerificationHeader verify_header = 3;
}
message SearchResponse {
message Body {
// Carries list of object identifiers that match the search query.
repeated neo.fs.v2.refs.ObjectID id_list = 1;
}
// Body of search object response message.
Body body = 1;
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
neo.fs.v2.service.ResponseMetaHeader meta_header = 2;
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
neo.fs.v2.service.ResponseVerificationHeader verify_header = 3;
}
// Range groups the parameters of object payload range.
message Range {
// Carries the offset of the range from the object payload start.
uint64 offset = 1;
// Carries the length of the object payload range.
uint64 length = 2;
}
message GetRangeRequest {
message Body {
// Address carries address of the object that contains the requested payload range.
neo.fs.v2.refs.Address address = 1;
// Range carries the parameters of the requested payload range.
Range range = 2;
}
// Body of get range object request message.
Body body = 1;
// Carries request meta information. Header data is used only to regulate message
// transport and does not affect request execution.
neo.fs.v2.service.RequestMetaHeader meta_header = 2;
// Carries request verification information. This header is used to authenticate
// the nodes of the message route and check the correctness of transmission.
neo.fs.v2.service.RequestVerificationHeader verify_header = 3;
}
message GetRangeResponse {
message Body {
// Carries part of the object payload.
bytes chunk = 1;
}
// Body of get range object response message.
Body body = 1;
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
neo.fs.v2.service.ResponseMetaHeader meta_header = 2;
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
neo.fs.v2.service.ResponseVerificationHeader verify_header = 3;
}
message GetRangeHashRequest {
message Body {
// Carries address of the object that contains the requested payload range.
neo.fs.v2.refs.Address address = 1;
// Carries the list of object payload range to calculate homomorphic hash.
repeated Range ranges = 2;
// Carries binary salt to XOR object payload ranges before hash calculation.
bytes salt = 3;
}
// Body of get range hash object request message.
Body body = 1;
// Carries request meta information. Header data is used only to regulate message
// transport and does not affect request execution.
neo.fs.v2.service.RequestMetaHeader meta_header = 2;
// Carries request verification information. This header is used to authenticate
// the nodes of the message route and check the correctness of transmission.
neo.fs.v2.service.RequestVerificationHeader verify_header = 3;
}
message GetRangeHashResponse {
message Body {
// Carries list of homomorphic hashes in a binary format.
repeated bytes hash_list = 1;
}
// Body of get range hash object response message.
Body body = 1;
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
neo.fs.v2.service.ResponseMetaHeader meta_header = 2;
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
neo.fs.v2.service.ResponseVerificationHeader verify_header = 3;
}

160
v2/object/types.go Normal file
View file

@ -0,0 +1,160 @@
package object
import (
"github.com/nspcc-dev/neofs-api-go/v2/refs"
"github.com/nspcc-dev/neofs-api-go/v2/service"
)
// SetKey sets key to the object attribute.
func (m *Header_Attribute) SetKey(v string) {
if m != nil {
m.Key = v
}
}
// SetValue sets value of the object attribute.
func (m *Header_Attribute) SetValue(v string) {
if m != nil {
m.Value = v
}
}
// SetParent sets identifier of the parent object.
func (m *Header_Split) SetParent(v *refs.ObjectID) {
if m != nil {
m.Parent = v
}
}
// SetPrevious sets identifier of the previous object in split-chain.
func (m *Header_Split) SetPrevious(v *refs.ObjectID) {
if m != nil {
m.Previous = v
}
}
// SetParentSignature sets signature of the parent object header.
func (m *Header_Split) SetParentSignature(v *service.Signature) {
if m != nil {
m.ParentSignature = v
}
}
// SetParentHeader sets parent header structure.
func (m *Header_Split) SetParentHeader(v *Header) {
if m != nil {
m.ParentHeader = v
}
}
// SetChildren sets list of the identifiers of the child objects.
func (m *Header_Split) SetChildren(v []*refs.ObjectID) {
if m != nil {
m.Children = v
}
}
// SetContainerId sets identifier of the container.
func (m *Header) SetContainerId(v *refs.ContainerID) {
if m != nil {
m.ContainerId = v
}
}
// SetOwnerId sets identifier of the object owner.
func (m *Header) SetOwnerId(v *refs.OwnerID) {
if m != nil {
m.OwnerId = v
}
}
// SetCreationEpoch sets creation epoch number.
func (m *Header) SetCreationEpoch(v uint64) {
if m != nil {
m.CreationEpoch = v
}
}
// SetVersion sets version of the object format.
func (m *Header) SetVersion(v *service.Version) {
if m != nil {
m.Version = v
}
}
// SetPayloadLength sets length of the object payload.
func (m *Header) SetPayloadLength(v uint64) {
if m != nil {
m.PayloadLength = v
}
}
// SetPayloadHash sets hash of the object payload.
func (m *Header) SetPayloadHash(v []byte) {
if m != nil {
m.PayloadHash = v
}
}
// SetObjectType sets type of the object.
func (m *Header) SetObjectType(v ObjectType) {
if m != nil {
m.ObjectType = v
}
}
// SetHomomorphicHash sets homomorphic hash of the object payload.
func (m *Header) SetHomomorphicHash(v []byte) {
if m != nil {
m.HomomorphicHash = v
}
}
// SetSessionToken sets session token.
func (m *Header) SetSessionToken(v *service.SessionToken) {
if m != nil {
m.SessionToken = v
}
}
// SetAttributes sets list of the object attributes.
func (m *Header) SetAttributes(v []*Header_Attribute) {
if m != nil {
m.Attributes = v
}
}
// SetSplit sets split header.
func (m *Header) SetSplit(v *Header_Split) {
if m != nil {
m.Split = v
}
}
// SetObjectId sets identifier of the object.
func (m *Object) SetObjectId(v *refs.ObjectID) {
if m != nil {
m.ObjectId = v
}
}
// SetSignature sets signature of the object identifier.
func (m *Object) SetSignature(v *service.Signature) {
if m != nil {
m.Signature = v
}
}
// SetHeader sets header of the object.
func (m *Object) SetHeader(v *Header) {
if m != nil {
m.Header = v
}
}
// SetPayload sets payload bytes of the object.
func (m *Object) SetPayload(v []byte) {
if m != nil {
m.Payload = v
}
}

1987
v2/object/types.pb.go Normal file

File diff suppressed because it is too large Load diff

85
v2/object/types.proto Normal file
View file

@ -0,0 +1,85 @@
syntax = "proto3";
package neo.fs.v2.object;
option go_package = "github.com/nspcc-dev/neofs-api-go/v2/object";
option csharp_namespace = "NeoFS.API.Object";
import "v2/refs/types.proto";
import "v2/service/meta.proto";
import "v2/service/verify.proto";
// Type of the object payload content
enum ObjectType {
// Just a normal object
REGULAR = 0;
// Used internally to identify deleted objects
TOMBSTONE = 1;
// Identifies that the object holds StorageGroup information
STORAGE_GROUP = 2;
}
message Header {
// Object's container
neo.fs.v2.refs.ContainerID container_id = 1;
// Object's owner
neo.fs.v2.refs.OwnerID owner_id = 2;
// Epoch when the object was created
uint64 creation_epoch = 3;
// Object format version.
// Effectively the version of API library used to create particular object
neo.fs.v2.service.Version version = 4;
// Size of payload in bytes.
// 0xFFFFFFFFFFFFFFFF means `payload_length` is unknown
uint64 payload_length = 5;
// Hash of payload bytes
bytes payload_hash = 6;
ObjectType object_type = 7;
// Homomorphic hash of the object payload.
bytes homomorphic_hash = 8;
// Session token, if it was used during Object creation.
// Need it to verify integrity and authenticity out of Request scope.
neo.fs.v2.service.SessionToken session_token = 9;
// Attribute groups the user-defined Key-Value pairs attached to the object
message Attribute {
// string key to the object attribute
string key = 1;
// string value of the object attribute
string value = 2;
}
repeated Attribute attributes = 10;
// Information about spawning the objects through a payload splitting.
message Split {
// Identifier of the origin object.
// Parent and children objects must be within the same container.
// Parent object_id is known only to the minor child.
neo.fs.v2.refs.ObjectID parent = 1;
// Previous carries identifier of the left split neighbor.
neo.fs.v2.refs.ObjectID previous = 2;
// `signature` field of the parent object. Used to reconstruct parent.
neo.fs.v2.service.Signature parent_signature = 3;
// `header` field of the parent object. Used to reconstruct parent.
Header parent_header = 4;
// Children carries list of identifiers of the objects generated by splitting the current.
repeated neo.fs.v2.refs.ObjectID children = 5;
}
// Position of the object in the split hierarchy.
Split split = 11;
}
// Object structure.
message Object {
// Object's unique identifier.
// Object is content-addressed. It means id will change if header or payload
// changes. It's calculated as a hash of header field, which contains hash of
// object's payload
neo.fs.v2.refs.ObjectID object_id = 1;
// Signed object_id
neo.fs.v2.service.Signature signature = 2;
// Object metadata headers
Header header = 3;
// Payload bytes.
bytes payload = 4;
}

49
v2/refs/marshal.go Normal file
View file

@ -0,0 +1,49 @@
package refs
import (
"encoding/binary"
"math/bits"
)
func (m *OwnerID) StableMarshal(buf []byte) ([]byte, error) {
if m == nil {
return []byte{}, nil
}
if buf == nil {
buf = make([]byte, m.StableSize())
}
var (
i, n, offset int
)
// Write key field.
buf[i] = 0x0A // id:0x1 << 3 | wiretype:0x2
offset = binary.PutUvarint(buf[i+1:], uint64(len(m.Value)))
n = copy(buf[i+1+offset:], m.Value)
i += 1 + offset + n
return buf, nil
}
func (m *OwnerID) StableSize() int {
if m == nil {
return 0
}
var (
ln, size int
)
ln = len(m.Value) // size of key field
size += 1 + uvarIntSize(uint64(ln)) + ln // wiretype + size of string + string
return size
}
// uvarIntSize returns length of varint byte sequence for uint64 value 'x'.
func uvarIntSize(x uint64) int {
return (bits.Len64(x|1) + 6) / 7
}

44
v2/refs/marshal_test.go Normal file
View file

@ -0,0 +1,44 @@
package refs
import (
"crypto/rand"
"testing"
"github.com/stretchr/testify/require"
)
func TestOwnerID_StableMarshal(t *testing.T) {
owner := make([]byte, 25)
_, err := rand.Read(owner)
require.NoError(t, err)
expectedOwner := new(OwnerID)
expectedOwner.Value = owner
gotOwner := new(OwnerID)
t.Run("small buffer", func(t *testing.T) {
_, err = expectedOwner.StableMarshal(make([]byte, 1))
require.Error(t, err)
})
t.Run("empty owner", func(t *testing.T) {
data, err := new(OwnerID).StableMarshal(nil)
require.NoError(t, err)
err = gotOwner.Unmarshal(data)
require.NoError(t, err)
require.Len(t, gotOwner.Value, 0)
})
t.Run("non empty owner", func(t *testing.T) {
data, err := expectedOwner.StableMarshal(nil)
require.NoError(t, err)
err = gotOwner.Unmarshal(data)
require.NoError(t, err)
require.Equal(t, expectedOwner, gotOwner)
})
}

36
v2/refs/types.go Normal file
View file

@ -0,0 +1,36 @@
package refs
// SetValue sets container identifier in a binary format.
func (m *ContainerID) SetValue(v []byte) {
if m != nil {
m.Value = v
}
}
// SetValue sets object identifier in a binary format.
func (m *ObjectID) SetValue(v []byte) {
if m != nil {
m.Value = v
}
}
// SetValue sets owner identifier in a binary format.
func (m *OwnerID) SetValue(v []byte) {
if m != nil {
m.Value = v
}
}
// SetContainerId sets container identifier of the address.
func (m *Address) SetContainerId(v *ContainerID) {
if m != nil {
m.ContainerId = v
}
}
// SetObjectId sets object identifier of the address.
func (m *Address) SetObjectId(v *ObjectID) {
if m != nil {
m.ObjectId = v
}
}

970
v2/refs/types.pb.go Normal file
View file

@ -0,0 +1,970 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: v2/refs/types.proto
package refs
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
io "io"
math "math"
math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Address of object (container id + object id)
type Address struct {
// container_id carries container identifier.
ContainerId *ContainerID `protobuf:"bytes,1,opt,name=container_id,json=containerId,proto3" json:"container_id,omitempty"`
// object_id carries object identifier.
ObjectId *ObjectID `protobuf:"bytes,2,opt,name=object_id,json=objectId,proto3" json:"object_id,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Address) Reset() { *m = Address{} }
func (m *Address) String() string { return proto.CompactTextString(m) }
func (*Address) ProtoMessage() {}
func (*Address) Descriptor() ([]byte, []int) {
return fileDescriptor_8ea16029b13f1cfa, []int{0}
}
func (m *Address) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Address) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Address.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *Address) XXX_Merge(src proto.Message) {
xxx_messageInfo_Address.Merge(m, src)
}
func (m *Address) XXX_Size() int {
return m.Size()
}
func (m *Address) XXX_DiscardUnknown() {
xxx_messageInfo_Address.DiscardUnknown(m)
}
var xxx_messageInfo_Address proto.InternalMessageInfo
func (m *Address) GetContainerId() *ContainerID {
if m != nil {
return m.ContainerId
}
return nil
}
func (m *Address) GetObjectId() *ObjectID {
if m != nil {
return m.ObjectId
}
return nil
}
// NeoFS object identifier.
type ObjectID struct {
// value carries the object identifier in a binary format.
Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ObjectID) Reset() { *m = ObjectID{} }
func (m *ObjectID) String() string { return proto.CompactTextString(m) }
func (*ObjectID) ProtoMessage() {}
func (*ObjectID) Descriptor() ([]byte, []int) {
return fileDescriptor_8ea16029b13f1cfa, []int{1}
}
func (m *ObjectID) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *ObjectID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_ObjectID.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *ObjectID) XXX_Merge(src proto.Message) {
xxx_messageInfo_ObjectID.Merge(m, src)
}
func (m *ObjectID) XXX_Size() int {
return m.Size()
}
func (m *ObjectID) XXX_DiscardUnknown() {
xxx_messageInfo_ObjectID.DiscardUnknown(m)
}
var xxx_messageInfo_ObjectID proto.InternalMessageInfo
func (m *ObjectID) GetValue() []byte {
if m != nil {
return m.Value
}
return nil
}
// NeoFS container identifier.
type ContainerID struct {
// value carries the container identifier in a binary format.
Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ContainerID) Reset() { *m = ContainerID{} }
func (m *ContainerID) String() string { return proto.CompactTextString(m) }
func (*ContainerID) ProtoMessage() {}
func (*ContainerID) Descriptor() ([]byte, []int) {
return fileDescriptor_8ea16029b13f1cfa, []int{2}
}
func (m *ContainerID) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *ContainerID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_ContainerID.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *ContainerID) XXX_Merge(src proto.Message) {
xxx_messageInfo_ContainerID.Merge(m, src)
}
func (m *ContainerID) XXX_Size() int {
return m.Size()
}
func (m *ContainerID) XXX_DiscardUnknown() {
xxx_messageInfo_ContainerID.DiscardUnknown(m)
}
var xxx_messageInfo_ContainerID proto.InternalMessageInfo
func (m *ContainerID) GetValue() []byte {
if m != nil {
return m.Value
}
return nil
}
// OwnerID group information about the owner of the NeoFS container.
type OwnerID struct {
// value carries the identifier of the container owner in a binary format.
Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *OwnerID) Reset() { *m = OwnerID{} }
func (m *OwnerID) String() string { return proto.CompactTextString(m) }
func (*OwnerID) ProtoMessage() {}
func (*OwnerID) Descriptor() ([]byte, []int) {
return fileDescriptor_8ea16029b13f1cfa, []int{3}
}
func (m *OwnerID) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *OwnerID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_OwnerID.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *OwnerID) XXX_Merge(src proto.Message) {
xxx_messageInfo_OwnerID.Merge(m, src)
}
func (m *OwnerID) XXX_Size() int {
return m.Size()
}
func (m *OwnerID) XXX_DiscardUnknown() {
xxx_messageInfo_OwnerID.DiscardUnknown(m)
}
var xxx_messageInfo_OwnerID proto.InternalMessageInfo
func (m *OwnerID) GetValue() []byte {
if m != nil {
return m.Value
}
return nil
}
func init() {
proto.RegisterType((*Address)(nil), "neo.fs.v2.refs.Address")
proto.RegisterType((*ObjectID)(nil), "neo.fs.v2.refs.ObjectID")
proto.RegisterType((*ContainerID)(nil), "neo.fs.v2.refs.ContainerID")
proto.RegisterType((*OwnerID)(nil), "neo.fs.v2.refs.OwnerID")
}
func init() { proto.RegisterFile("v2/refs/types.proto", fileDescriptor_8ea16029b13f1cfa) }
var fileDescriptor_8ea16029b13f1cfa = []byte{
// 256 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2e, 0x33, 0xd2, 0x2f,
0x4a, 0x4d, 0x2b, 0xd6, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17,
0xe2, 0xcb, 0x4b, 0xcd, 0xd7, 0x4b, 0x2b, 0xd6, 0x2b, 0x33, 0xd2, 0x03, 0xc9, 0x29, 0x35, 0x30,
0x72, 0xb1, 0x3b, 0xa6, 0xa4, 0x14, 0xa5, 0x16, 0x17, 0x0b, 0xd9, 0x71, 0xf1, 0x24, 0xe7, 0xe7,
0x95, 0x24, 0x66, 0xe6, 0xa5, 0x16, 0xc5, 0x67, 0xa6, 0x48, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x1b,
0x49, 0xeb, 0xa1, 0x6a, 0xd1, 0x73, 0x86, 0xa9, 0xf1, 0x74, 0x09, 0xe2, 0x86, 0x6b, 0xf0, 0x4c,
0x11, 0x32, 0xe5, 0xe2, 0xcc, 0x4f, 0xca, 0x4a, 0x4d, 0x2e, 0x01, 0x69, 0x66, 0x02, 0x6b, 0x96,
0x40, 0xd7, 0xec, 0x0f, 0x56, 0xe0, 0xe9, 0x12, 0xc4, 0x01, 0x51, 0xea, 0x99, 0xa2, 0xa4, 0xc0,
0xc5, 0x01, 0x13, 0x15, 0x12, 0xe1, 0x62, 0x2d, 0x4b, 0xcc, 0x29, 0x4d, 0x05, 0xdb, 0xcd, 0x13,
0x04, 0xe1, 0x28, 0x29, 0x73, 0x71, 0x23, 0x59, 0x8a, 0x43, 0x91, 0x3c, 0x17, 0xbb, 0x7f, 0x39,
0x1e, 0x05, 0x4e, 0x3e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c,
0xe3, 0x8c, 0xc7, 0x72, 0x0c, 0x51, 0x9a, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9,
0xb9, 0xfa, 0x79, 0xc5, 0x05, 0xc9, 0xc9, 0xba, 0x29, 0xa9, 0x65, 0xfa, 0x79, 0xa9, 0xf9, 0x69,
0xc5, 0xba, 0x89, 0x05, 0x99, 0xba, 0xe9, 0xf9, 0xfa, 0xd0, 0x30, 0x5c, 0xc5, 0xc4, 0xe7, 0x97,
0x9a, 0xef, 0x16, 0xac, 0xe7, 0x18, 0xe0, 0xa9, 0x17, 0x94, 0x9a, 0x56, 0x9c, 0xc4, 0x06, 0x0e,
0x4f, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x4f, 0x72, 0xf0, 0x66, 0x01, 0x00, 0x00,
}
func (m *Address) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Address) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Address) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if m.ObjectId != nil {
{
size, err := m.ObjectId.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTypes(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
if m.ContainerId != nil {
{
size, err := m.ContainerId.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTypes(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *ObjectID) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *ObjectID) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ObjectID) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if len(m.Value) > 0 {
i -= len(m.Value)
copy(dAtA[i:], m.Value)
i = encodeVarintTypes(dAtA, i, uint64(len(m.Value)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *ContainerID) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *ContainerID) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ContainerID) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if len(m.Value) > 0 {
i -= len(m.Value)
copy(dAtA[i:], m.Value)
i = encodeVarintTypes(dAtA, i, uint64(len(m.Value)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func (m *OwnerID) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *OwnerID) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *OwnerID) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if len(m.Value) > 0 {
i -= len(m.Value)
copy(dAtA[i:], m.Value)
i = encodeVarintTypes(dAtA, i, uint64(len(m.Value)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintTypes(dAtA []byte, offset int, v uint64) int {
offset -= sovTypes(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *Address) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.ContainerId != nil {
l = m.ContainerId.Size()
n += 1 + l + sovTypes(uint64(l))
}
if m.ObjectId != nil {
l = m.ObjectId.Size()
n += 1 + l + sovTypes(uint64(l))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func (m *ObjectID) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Value)
if l > 0 {
n += 1 + l + sovTypes(uint64(l))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func (m *ContainerID) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Value)
if l > 0 {
n += 1 + l + sovTypes(uint64(l))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func (m *OwnerID) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Value)
if l > 0 {
n += 1 + l + sovTypes(uint64(l))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func sovTypes(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozTypes(x uint64) (n int) {
return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *Address) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Address: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Address: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ContainerId", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTypes
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTypes
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.ContainerId == nil {
m.ContainerId = &ContainerID{}
}
if err := m.ContainerId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ObjectId", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTypes
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTypes
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.ObjectId == nil {
m.ObjectId = &ObjectID{}
}
if err := m.ObjectId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTypes(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTypes
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthTypes
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *ObjectID) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: ObjectID: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: ObjectID: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthTypes
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthTypes
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...)
if m.Value == nil {
m.Value = []byte{}
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTypes(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTypes
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthTypes
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *ContainerID) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: ContainerID: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: ContainerID: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthTypes
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthTypes
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...)
if m.Value == nil {
m.Value = []byte{}
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTypes(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTypes
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthTypes
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *OwnerID) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: OwnerID: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: OwnerID: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthTypes
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthTypes
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...)
if m.Value == nil {
m.Value = []byte{}
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTypes(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTypes
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthTypes
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipTypes(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTypes
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTypes
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTypes
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthTypes
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupTypes
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthTypes
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group")
)

32
v2/refs/types.proto Normal file
View file

@ -0,0 +1,32 @@
syntax = "proto3";
package neo.fs.v2.refs;
option go_package = "github.com/nspcc-dev/neofs-api-go/v2/refs";
option csharp_namespace = "NeoFS.API.Refs";
// Address of object (container id + object id)
message Address {
// container_id carries container identifier.
ContainerID container_id = 1;
// object_id carries object identifier.
ObjectID object_id = 2;
}
// NeoFS object identifier.
message ObjectID {
// value carries the object identifier in a binary format.
bytes value = 1;
}
// NeoFS container identifier.
message ContainerID {
// value carries the container identifier in a binary format.
bytes value = 1;
}
// OwnerID group information about the owner of the NeoFS container.
message OwnerID {
// value carries the identifier of the container owner in a binary format.
bytes value = 1;
}

232
v2/service/meta.go Normal file
View file

@ -0,0 +1,232 @@
package service
import (
"github.com/nspcc-dev/neofs-api-go/v2/acl"
"github.com/nspcc-dev/neofs-api-go/v2/refs"
)
// SetKey sets key to the X-Header.
func (m *XHeader) SetKey(v string) {
if m != nil {
m.Key = v
}
}
// SetValue sets value of the X-Header.
func (m *XHeader) SetValue(v string) {
if m != nil {
m.Value = v
}
}
// SetMajor sets major version number.
func (m *Version) SetMajor(v uint32) {
if m != nil {
m.Major = v
}
}
// SetMinor sets minor version number.
func (m *Version) SetMinor(v uint32) {
if m != nil {
m.Minor = v
}
}
// SetExp sets epoch number of the token expiration.
func (m *TokenLifetime) SetExp(v uint64) {
if m != nil {
m.Exp = v
}
}
// SetNbf sets starting epoch number of the token.
func (m *TokenLifetime) SetNbf(v uint64) {
if m != nil {
m.Nbf = v
}
}
// SetIat sets the number of the epoch in which the token was issued.
func (m *TokenLifetime) SetIat(v uint64) {
if m != nil {
m.Iat = v
}
}
// SetId sets identifier of the session token.
func (m *SessionToken_Body) SetId(v []byte) {
if m != nil {
m.Id = v
}
}
// SetOwnerId sets identifier of the session token owner.
func (m *SessionToken_Body) SetOwnerId(v *refs.OwnerID) {
if m != nil {
m.OwnerId = v
}
}
// SetVerb sets verb of the session token.
func (m *SessionToken_Body) SetVerb(v SessionToken_Body_Verb) {
if m != nil {
m.Verb = v
}
}
// SetLifetime sets lifetime of the session token.
func (m *SessionToken_Body) SetLifetime(v *TokenLifetime) {
if m != nil {
m.Lifetime = v
}
}
// SetSessionKey sets public session key in a binary format.
func (m *SessionToken_Body) SetSessionKey(v []byte) {
if m != nil {
m.SessionKey = v
}
}
// SetObjectAddressContext sets object context of the session token.
func (m *SessionToken_Body) SetObjectAddressContext(v *refs.Address) {
if m != nil {
m.Context = &SessionToken_Body_ObjectAddress{
ObjectAddress: v,
}
}
}
// SetBody sets session token body.
func (m *SessionToken) SetBody(v *SessionToken_Body) {
if m != nil {
m.Token = v
}
}
// SetSignature sets session token signature.
func (m *SessionToken) SetSignature(v *Signature) {
if m != nil {
m.Signature = v
}
}
// SetEaclTable sets eACL table of the bearer token.
func (m *BearerToken_Body) SetEaclTable(v *acl.EACLTable) {
if m != nil {
m.EaclTable = v
}
}
// SetOwnerId sets identifier of the bearer token owner.
func (m *BearerToken_Body) SetOwnerId(v *refs.OwnerID) {
if m != nil {
m.OwnerId = v
}
}
// SetLifetime sets lifetime of the bearer token.
func (m *BearerToken_Body) SetLifetime(v *TokenLifetime) {
if m != nil {
m.Lifetime = v
}
}
// SetBody sets bearer token body.
func (m *BearerToken) SetBody(v *BearerToken_Body) {
if m != nil {
m.Token = v
}
}
// SetSignature sets bearer token signature.
func (m *BearerToken) SetSignature(v *Signature) {
if m != nil {
m.Signature = v
}
}
// SetVersion sets client protocol version.
func (m *RequestMetaHeader) SetVersion(v *Version) {
if m != nil {
m.Version = v
}
}
// SetEpoch sets client local epoch.
func (m *RequestMetaHeader) SetEpoch(v uint64) {
if m != nil {
m.Epoch = v
}
}
// SetTtl sets request TTL.
func (m *RequestMetaHeader) SetTtl(v uint32) {
if m != nil {
m.Ttl = v
}
}
// SetXHeaders sets request X-Headers.
func (m *RequestMetaHeader) SetXHeaders(v []*XHeader) {
if m != nil {
m.XHeaders = v
}
}
// SetSessionToken sets session token of the request.
func (m *RequestMetaHeader) SetSessionToken(v *SessionToken) {
if m != nil {
m.Token = v
}
}
// SetBearerToken sets bearer token of the request.
func (m *RequestMetaHeader) SetBearerToken(v *BearerToken) {
if m != nil {
m.Bearer = v
}
}
// SetOrigin sets origin request meta header.
func (m *RequestMetaHeader) SetOrigin(v *RequestMetaHeader) {
if m != nil {
m.Origin = v
}
}
// SetVersion sets server protocol version.
func (m *ResponseMetaHeader) SetVersion(v *Version) {
if m != nil {
m.Version = v
}
}
// SetEpoch sets server local epoch.
func (m *ResponseMetaHeader) SetEpoch(v uint64) {
if m != nil {
m.Epoch = v
}
}
// SetTtl sets response TTL.
func (m *ResponseMetaHeader) SetTtl(v uint32) {
if m != nil {
m.Ttl = v
}
}
// SetXHeaders sets response X-Headers.
func (m *ResponseMetaHeader) SetXHeaders(v []*XHeader) {
if m != nil {
m.XHeaders = v
}
}
// SetOrigin sets origin response meta header.
func (m *ResponseMetaHeader) SetOrigin(v *ResponseMetaHeader) {
if m != nil {
m.Origin = v
}
}

3170
v2/service/meta.pb.go Normal file

File diff suppressed because it is too large Load diff

129
v2/service/meta.proto Normal file
View file

@ -0,0 +1,129 @@
syntax = "proto3";
package neo.fs.v2.service;
option go_package = "github.com/nspcc-dev/neofs-api-go/v2/service";
option csharp_namespace = "NeoFS.API.Service";
import "v2/acl/types.proto";
import "v2/refs/types.proto";
import "v2/service/verify.proto";
message XHeader {
// Key of the X-Header.
string key = 1;
// Value of the X-Header.
string value = 2;
}
// Represents API version used by node.
message Version {
// Major API version.
uint32 major = 1;
// Minor API version.
uint32 minor = 2;
}
// Lifetime parameters of the token. Filed names taken from rfc7519.
message TokenLifetime {
// Expiration Epoch
uint64 exp = 1;
// Not valid before Epoch
uint64 nbf = 2;
// Issued at Epoch
uint64 iat = 3;
}
// NeoFS session token.
message SessionToken {
message Body {
// ID is a token identifier. valid UUIDv4 represented in bytes
bytes id = 1;
// OwnerID carries identifier of the session initiator.
neo.fs.v2.refs.OwnerID owner_id = 2;
// Verb is an enumeration of session request types
enum Verb {
// Refers to object.Put RPC call
OBJECT_PUT = 0;
// Refers to object.Get RPC call
OBJECT_GET = 1;
// Refers to object.Head RPC call
OBJECT_HEAD = 2;
// Refers to object.Search RPC call
OBJECT_SEARCH = 3;
// Refers to object.Delete RPC call
OBJECT_DELETE = 4;
// Refers to object.GetRange RPC call
OBJECT_RANGE = 5;
// Refers to object.GetRangeHash RPC call
OBJECT_RANGEHASH = 6;
}
// Verb is a type of request for which the token is issued
Verb verb = 3;
// Lifetime is a lifetime of the session
TokenLifetime lifetime = 4;
// SessionKey is a public key of session key
bytes session_key = 5;
// Carries context of the session.
oneof context {
// object_address represents the object session context.
neo.fs.v2.refs.Address object_address = 6;
}
}
// Session Token body
Body token = 1;
// Signature is a signature of session token information
Signature signature = 2;
}
// BearerToken has information about request ACL rules with limited lifetime
message BearerToken {
message Body {
// EACLTable carries table of extended ACL rules
neo.fs.v2.acl.EACLTable eacl_table = 1;
// OwnerID carries identifier of the token owner
neo.fs.v2.refs.OwnerID owner_id = 2;
// Token expiration and valid time period parameters
TokenLifetime lifetime = 3;
}
// Bearer Token body
Body token = 1;
// Signature of BearerToken body
Signature signature = 2;
}
// Information about the request
message RequestMetaHeader {
// Client API version.
Version version = 1;
// Client local epoch number. Set to 0 if unknown.
uint64 epoch = 2;
// Maximum number of nodes in the request route.
uint32 ttl = 3;
// Request X-Headers.
repeated XHeader x_headers = 4;
// Token is a token of the session within which the request is sent
SessionToken token = 5;
// Bearer is a Bearer token of the request
BearerToken bearer = 6;
// RequestMetaHeader of the origin request.
RequestMetaHeader origin = 7;
}
// Information about the response
message ResponseMetaHeader {
// Server API version.
Version version = 1;
// Server local epoch number.
uint64 epoch = 2;
// Maximum number of nodes in the response route.
uint32 ttl = 3;
// Response X-Headers.
repeated XHeader x_headers = 4;
// Carries response meta header of the origin response.
ResponseMetaHeader origin = 5;
}

71
v2/service/verify.go Normal file
View file

@ -0,0 +1,71 @@
package service
// SetKey sets public key in a binary format.
func (m *Signature) SetKey(v []byte) {
if m != nil {
m.Key = v
}
}
// SetSign sets signature.
func (m *Signature) SetSign(v []byte) {
if m != nil {
m.Sign = v
}
}
// SetBodySignature sets signature of the request body.
func (m *RequestVerificationHeader) SetBodySignature(v *Signature) {
if m != nil {
m.BodySignature = v
}
}
// SetMetaSignature sets signature of the request meta.
func (m *RequestVerificationHeader) SetMetaSignature(v *Signature) {
if m != nil {
m.MetaSignature = v
}
}
// SetOriginSignature sets signature of the origin verification header of the request.
func (m *RequestVerificationHeader) SetOriginSignature(v *Signature) {
if m != nil {
m.OriginSignature = v
}
}
// SetOrigin sets origin verification header of the request.
func (m *RequestVerificationHeader) SetOrigin(v *RequestVerificationHeader) {
if m != nil {
m.Origin = v
}
}
// SetBodySignature sets signature of the response body.
func (m *ResponseVerificationHeader) SetBodySignature(v *Signature) {
if m != nil {
m.BodySignature = v
}
}
// SetMetaSignature sets signature of the response meta.
func (m *ResponseVerificationHeader) SetMetaSignature(v *Signature) {
if m != nil {
m.MetaSignature = v
}
}
// SetOriginSignature sets signature of the origin verification header of the response.
func (m *ResponseVerificationHeader) SetOriginSignature(v *Signature) {
if m != nil {
m.OriginSignature = v
}
}
// SetOrigin sets origin verification header of the response.
func (m *ResponseVerificationHeader) SetOrigin(v *ResponseVerificationHeader) {
if m != nil {
m.Origin = v
}
}

1153
v2/service/verify.pb.go Normal file

File diff suppressed because it is too large Load diff

40
v2/service/verify.proto Normal file
View file

@ -0,0 +1,40 @@
syntax = "proto3";
package neo.fs.v2.service;
option go_package = "github.com/nspcc-dev/neofs-api-go/v2/service";
option csharp_namespace = "NeoFS.API.Service";
// Signature of something in NeoFS
message Signature {
// Public key used for signing.
bytes key = 1;
// Signature
bytes sign = 2;
}
// Verification info for request signed by all intermediate nodes
message RequestVerificationHeader {
// Request Body signature. Should be generated once by request initiator.
Signature body_signature = 1;
// Request Meta signature is added and signed by any intermediate node
Signature meta_signature = 2;
// Sign previous hops
Signature origin_signature = 3;
// Chain of previous hops signatures
RequestVerificationHeader origin = 4;
}
// Verification info for response signed by all intermediate nodes
message ResponseVerificationHeader {
// Response Body signature. Should be generated once by answering node.
Signature body_signature = 1;
// Response Meta signature is added and signed by any intermediate node
Signature meta_signature = 2;
// Sign previous hops
Signature origin_signature = 3;
// Chain of previous hops signatures
ResponseVerificationHeader origin = 4;
}

76
v2/session/service.go Normal file
View file

@ -0,0 +1,76 @@
package session
import (
"github.com/nspcc-dev/neofs-api-go/v2/refs"
"github.com/nspcc-dev/neofs-api-go/v2/service"
)
// SetOwnerId sets identifier of the session initiator.
func (m *CreateRequest_Body) SetOwnerId(v *refs.OwnerID) {
if m != nil {
m.OwnerId = v
}
}
// SetLifetime sets lifetime of the session.
func (m *CreateRequest_Body) SetLifetime(v *service.TokenLifetime) {
if m != nil {
m.Lifetime = v
}
}
// SetBody sets body of the request.
func (m *CreateRequest) SetBody(v *CreateRequest_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the request.
func (m *CreateRequest) SetMetaHeader(v *service.RequestMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the request.
func (m *CreateRequest) SetVerifyHeader(v *service.RequestVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}
// SetId sets identifier of the session token.
func (m *CreateResponse_Body) SetId(v []byte) {
if m != nil {
m.Id = v
}
}
// SetSessionKey sets session public key in a binary format.
func (m *CreateResponse_Body) SetSessionKey(v []byte) {
if m != nil {
m.SessionKey = v
}
}
// SetBody sets body of the response.
func (m *CreateResponse) SetBody(v *CreateResponse_Body) {
if m != nil {
m.Body = v
}
}
// SetMetaHeader sets meta header of the response.
func (m *CreateResponse) SetMetaHeader(v *service.ResponseMetaHeader) {
if m != nil {
m.MetaHeader = v
}
}
// SetVerifyHeader sets verification header of the response.
func (m *CreateResponse) SetVerifyHeader(v *service.ResponseVerificationHeader) {
if m != nil {
m.VerifyHeader = v
}
}

1386
v2/session/service.pb.go Normal file

File diff suppressed because it is too large Load diff

59
v2/session/service.proto Normal file
View file

@ -0,0 +1,59 @@
syntax = "proto3";
package neo.fs.v2.session;
option go_package = "github.com/nspcc-dev/neofs-api-go/v2/session";
option csharp_namespace = "NeoFS.API.Session";
import "v2/refs/types.proto";
import "v2/service/meta.proto";
import "v2/service/verify.proto";
service Session {
// Create opens new session between the client and the server.
rpc Create (CreateRequest) returns (CreateResponse);
}
// CreateRequest carries an information necessary for opening a session.
message CreateRequest {
message Body {
// Carries an identifier of a session initiator.
neo.fs.v2.refs.OwnerID owner_id = 1;
// Carries a lifetime of the session.
neo.fs.v2.service.TokenLifetime lifetime = 2;
}
// Body of create session token request message.
Body body = 1;
// Carries request meta information. Header data is used only to regulate message
// transport and does not affect request execution.
neo.fs.v2.service.RequestMetaHeader meta_header = 2;
// Carries request verification information. This header is used to authenticate
// the nodes of the message route and check the correctness of transmission.
neo.fs.v2.service.RequestVerificationHeader verify_header = 3;
}
// CreateResponse carries an information about the opened session.
message CreateResponse {
message Body {
// id carries an identifier of session token.
bytes id = 1;
// session_key carries a session public key.
bytes session_key = 2;
}
// Body of create session token response message.
Body body = 1;
// Carries response meta information. Header data is used only to regulate
// message transport and does not affect request execution.
neo.fs.v2.service.ResponseMetaHeader meta_header = 2;
// Carries response verification information. This header is used to
// authenticate the nodes of the message route and check the correctness
// of transmission.
neo.fs.v2.service.ResponseVerificationHeader verify_header = 3;
}

33
v2/storagegroup/types.go Normal file
View file

@ -0,0 +1,33 @@
package storagegroup
import (
"github.com/nspcc-dev/neofs-api-go/v2/refs"
)
// SetValidationDataSize sets the total size of the payloads of the storage group.
func (m *StorageGroup) SetValidationDataSize(v uint64) {
if m != nil {
m.ValidationDataSize = v
}
}
// SetValidationHash sets total homomorphic hash of the storage group payloads.
func (m *StorageGroup) SetValidationHash(v []byte) {
if m != nil {
m.ValidationHash = v
}
}
// SetExpirationEpoch sets number of the last epoch of the storage group lifetime.
func (m *StorageGroup) SetExpirationEpoch(v uint64) {
if m != nil {
m.ExpirationEpoch = v
}
}
// SetMembers sets list of the identifiers of the storage group members.
func (m *StorageGroup) SetMembers(v []*refs.ObjectID) {
if m != nil {
m.Members = v
}
}

484
v2/storagegroup/types.pb.go Normal file
View file

@ -0,0 +1,484 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: v2/storagegroup/types.proto
package storagegroup
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
refs "github.com/nspcc-dev/neofs-api-go/v2/refs"
io "io"
math "math"
math_bits "math/bits"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// StorageGroup groups the information about the NeoFS storage group.
// The storage group consists of objects from single container.
type StorageGroup struct {
// validation_data_size carries the total size of the payloads of the storage
// group members.
ValidationDataSize uint64 `protobuf:"varint,1,opt,name=validation_data_size,json=validationDataSize,proto3" json:"validation_data_size,omitempty"`
// validation_hash carries homomorphic hash from the concatenation of the
// payloads of the storage group members
// The order of concatenation is the same as the order of the members in the
// Members field.
ValidationHash []byte `protobuf:"bytes,2,opt,name=validation_hash,json=validationHash,proto3" json:"validation_hash,omitempty"`
// expiration_epoch carries last NeoFS epoch number of the storage group
// lifetime.
ExpirationEpoch uint64 `protobuf:"varint,3,opt,name=expiration_epoch,json=expirationEpoch,proto3" json:"expiration_epoch,omitempty"`
// Members carries the list of identifiers of the object storage group members.
// The list is strictly ordered.
Members []*refs.ObjectID `protobuf:"bytes,4,rep,name=members,proto3" json:"members,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *StorageGroup) Reset() { *m = StorageGroup{} }
func (m *StorageGroup) String() string { return proto.CompactTextString(m) }
func (*StorageGroup) ProtoMessage() {}
func (*StorageGroup) Descriptor() ([]byte, []int) {
return fileDescriptor_593772eae6c18cdf, []int{0}
}
func (m *StorageGroup) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *StorageGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_StorageGroup.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *StorageGroup) XXX_Merge(src proto.Message) {
xxx_messageInfo_StorageGroup.Merge(m, src)
}
func (m *StorageGroup) XXX_Size() int {
return m.Size()
}
func (m *StorageGroup) XXX_DiscardUnknown() {
xxx_messageInfo_StorageGroup.DiscardUnknown(m)
}
var xxx_messageInfo_StorageGroup proto.InternalMessageInfo
func (m *StorageGroup) GetValidationDataSize() uint64 {
if m != nil {
return m.ValidationDataSize
}
return 0
}
func (m *StorageGroup) GetValidationHash() []byte {
if m != nil {
return m.ValidationHash
}
return nil
}
func (m *StorageGroup) GetExpirationEpoch() uint64 {
if m != nil {
return m.ExpirationEpoch
}
return 0
}
func (m *StorageGroup) GetMembers() []*refs.ObjectID {
if m != nil {
return m.Members
}
return nil
}
func init() {
proto.RegisterType((*StorageGroup)(nil), "neo.fs.v2.storagegroup.StorageGroup")
}
func init() { proto.RegisterFile("v2/storagegroup/types.proto", fileDescriptor_593772eae6c18cdf) }
var fileDescriptor_593772eae6c18cdf = []byte{
// 293 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0xd0, 0xdf, 0x4a, 0xf3, 0x30,
0x18, 0x06, 0xf0, 0x2f, 0xdb, 0xf8, 0x84, 0x38, 0x9c, 0x44, 0x19, 0x45, 0xa1, 0x0c, 0x4f, 0x9c,
0x07, 0x4b, 0xb4, 0x5e, 0x81, 0x32, 0xff, 0xec, 0x44, 0xa5, 0x3d, 0x13, 0x61, 0xa4, 0xed, 0xdb,
0x36, 0x62, 0x9b, 0x90, 0x64, 0x45, 0x77, 0x25, 0x5e, 0x83, 0x57, 0xb2, 0x43, 0x2f, 0x41, 0xea,
0x8d, 0x48, 0x37, 0xa4, 0xc5, 0xd3, 0x27, 0xbf, 0xbc, 0xf0, 0x3c, 0xf8, 0xb0, 0xf4, 0x98, 0xb1,
0x52, 0xf3, 0x14, 0x52, 0x2d, 0x17, 0x8a, 0xd9, 0x37, 0x05, 0x86, 0x2a, 0x2d, 0xad, 0x24, 0xc3,
0x02, 0x24, 0x4d, 0x0c, 0x2d, 0x3d, 0xda, 0x36, 0x07, 0x7b, 0xa5, 0xc7, 0x34, 0x24, 0xa6, 0x8d,
0x8f, 0x56, 0x08, 0xf7, 0x83, 0x8d, 0xba, 0xa9, 0x15, 0x39, 0xc5, 0xfb, 0x25, 0x7f, 0x11, 0x31,
0xb7, 0x42, 0x16, 0xf3, 0x98, 0x5b, 0x3e, 0x37, 0x62, 0x09, 0x0e, 0x1a, 0xa1, 0x71, 0xcf, 0x27,
0xcd, 0xdb, 0x94, 0x5b, 0x1e, 0x88, 0x25, 0x90, 0x63, 0x3c, 0x68, 0xfd, 0xc8, 0xb8, 0xc9, 0x9c,
0xce, 0x08, 0x8d, 0xfb, 0xfe, 0x4e, 0x13, 0xdf, 0x72, 0x93, 0x91, 0x13, 0xbc, 0x0b, 0xaf, 0x4a,
0xe8, 0x0d, 0x04, 0x25, 0xa3, 0xcc, 0xe9, 0xae, 0xcf, 0x0e, 0x9a, 0xfc, 0xaa, 0x8e, 0x89, 0x87,
0xb7, 0x72, 0xc8, 0x43, 0xd0, 0xc6, 0xe9, 0x8d, 0xba, 0xe3, 0x6d, 0xcf, 0xa1, 0x4d, 0xab, 0xba,
0x04, 0xbd, 0x0f, 0x9f, 0x21, 0xb2, 0xb3, 0xa9, 0xff, 0x0b, 0x2f, 0x9f, 0x56, 0x95, 0x8b, 0x3e,
0x2b, 0x17, 0x7d, 0x55, 0x2e, 0x7a, 0xff, 0x76, 0xff, 0x3d, 0x9e, 0xa5, 0xc2, 0x66, 0x8b, 0x90,
0x46, 0x32, 0x67, 0x85, 0x51, 0x51, 0x34, 0x89, 0xa1, 0x64, 0x05, 0xc8, 0xc4, 0x4c, 0xb8, 0x12,
0x93, 0x54, 0xb2, 0x3f, 0x43, 0x7e, 0x74, 0x86, 0x77, 0x20, 0xaf, 0x03, 0x7a, 0xf1, 0x30, 0xa3,
0xed, 0x5d, 0xc2, 0xff, 0xeb, 0xbd, 0xce, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xe7, 0x71, 0xf1,
0x6b, 0x7b, 0x01, 0x00, 0x00,
}
func (m *StorageGroup) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *StorageGroup) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *StorageGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.XXX_unrecognized != nil {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if len(m.Members) > 0 {
for iNdEx := len(m.Members) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Members[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTypes(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x22
}
}
if m.ExpirationEpoch != 0 {
i = encodeVarintTypes(dAtA, i, uint64(m.ExpirationEpoch))
i--
dAtA[i] = 0x18
}
if len(m.ValidationHash) > 0 {
i -= len(m.ValidationHash)
copy(dAtA[i:], m.ValidationHash)
i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidationHash)))
i--
dAtA[i] = 0x12
}
if m.ValidationDataSize != 0 {
i = encodeVarintTypes(dAtA, i, uint64(m.ValidationDataSize))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func encodeVarintTypes(dAtA []byte, offset int, v uint64) int {
offset -= sovTypes(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *StorageGroup) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.ValidationDataSize != 0 {
n += 1 + sovTypes(uint64(m.ValidationDataSize))
}
l = len(m.ValidationHash)
if l > 0 {
n += 1 + l + sovTypes(uint64(l))
}
if m.ExpirationEpoch != 0 {
n += 1 + sovTypes(uint64(m.ExpirationEpoch))
}
if len(m.Members) > 0 {
for _, e := range m.Members {
l = e.Size()
n += 1 + l + sovTypes(uint64(l))
}
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func sovTypes(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozTypes(x uint64) (n int) {
return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *StorageGroup) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: StorageGroup: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: StorageGroup: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ValidationDataSize", wireType)
}
m.ValidationDataSize = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ValidationDataSize |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ValidationHash", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthTypes
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthTypes
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ValidationHash = append(m.ValidationHash[:0], dAtA[iNdEx:postIndex]...)
if m.ValidationHash == nil {
m.ValidationHash = []byte{}
}
iNdEx = postIndex
case 3:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ExpirationEpoch", wireType)
}
m.ExpirationEpoch = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.ExpirationEpoch |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Members", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTypes
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTypes
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Members = append(m.Members, &refs.ObjectID{})
if err := m.Members[len(m.Members)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTypes(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthTypes
}
if (iNdEx + skippy) < 0 {
return ErrInvalidLengthTypes
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipTypes(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTypes
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTypes
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTypes
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthTypes
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupTypes
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthTypes
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group")
)

View file

@ -0,0 +1,30 @@
syntax = "proto3";
package neo.fs.v2.storagegroup;
option go_package = "github.com/nspcc-dev/neofs-api-go/v2/storagegroup";
option csharp_namespace = "NeoFS.API.StorageGroup";
import "v2/refs/types.proto";
// StorageGroup groups the information about the NeoFS storage group.
// The storage group consists of objects from single container.
message StorageGroup {
// validation_data_size carries the total size of the payloads of the storage
// group members.
uint64 validation_data_size = 1;
// validation_hash carries homomorphic hash from the concatenation of the
// payloads of the storage group members
// The order of concatenation is the same as the order of the members in the
// Members field.
bytes validation_hash = 2;
// expiration_epoch carries last NeoFS epoch number of the storage group
// lifetime.
uint64 expiration_epoch = 3;
// Members carries the list of identifiers of the object storage group members.
// The list is strictly ordered.
repeated neo.fs.v2.refs.ObjectID members = 4;
}