Merge pull request #60 from nspcc-dev/bump/api-v-0-6-0

Update neo-api library to v0.6.0
This commit is contained in:
Evgeniy Kulikov 2020-04-02 18:38:43 +03:00 committed by GitHub
commit 08fe4f8383
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 287 additions and 628 deletions

View file

@ -1,4 +1,4 @@
PROTO_VERSION=v0.5.0
PROTO_VERSION=v0.6.0
PROTO_URL=https://github.com/nspcc-dev/neofs-api/archive/$(PROTO_VERSION).tar.gz
B=\033[0;1m

88
acl/types.pb.go Normal file
View file

@ -0,0 +1,88 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: acl/types.proto
package acl
import (
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/golang/protobuf/proto"
math "math"
)
// 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
// Target of the access control rule in access control list.
type Target int32
const (
// Unknown target, default value.
Target_Unknown Target = 0
// User target rule is applied if sender is the owner of the container.
Target_User Target = 1
// System target rule is applied if sender is the storage node within the
// container or inner ring node.
Target_System Target = 2
// Others target rule is applied if sender is not user or system target.
Target_Others Target = 3
// PubKey target rule is applied if sender has public key provided in
// extended ACL.
Target_PubKey Target = 4
)
var Target_name = map[int32]string{
0: "Unknown",
1: "User",
2: "System",
3: "Others",
4: "PubKey",
}
var Target_value = map[string]int32{
"Unknown": 0,
"User": 1,
"System": 2,
"Others": 3,
"PubKey": 4,
}
func (x Target) String() string {
return proto.EnumName(Target_name, int32(x))
}
func (Target) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_9b63aff5f3a35e32, []int{0}
}
func init() {
proto.RegisterEnum("acl.Target", Target_name, Target_value)
}
func init() { proto.RegisterFile("acl/types.proto", fileDescriptor_9b63aff5f3a35e32) }
var fileDescriptor_9b63aff5f3a35e32 = []byte{
// 216 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4f, 0x4c, 0xce, 0xd1,
0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x4e, 0x4c, 0xce,
0x91, 0xd2, 0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, 0x4f,
0xcf, 0xd7, 0x07, 0xcb, 0x25, 0x95, 0xa6, 0x81, 0x79, 0x60, 0x0e, 0x98, 0x05, 0xd1, 0xa3, 0xe5,
0xcc, 0xc5, 0x16, 0x92, 0x58, 0x94, 0x9e, 0x5a, 0x22, 0xc4, 0xcd, 0xc5, 0x1e, 0x9a, 0x97, 0x9d,
0x97, 0x5f, 0x9e, 0x27, 0xc0, 0x20, 0xc4, 0xc1, 0xc5, 0x12, 0x5a, 0x9c, 0x5a, 0x24, 0xc0, 0x28,
0xc4, 0xc5, 0xc5, 0x16, 0x5c, 0x59, 0x5c, 0x92, 0x9a, 0x2b, 0xc0, 0x04, 0x62, 0xfb, 0x97, 0x64,
0xa4, 0x16, 0x15, 0x0b, 0x30, 0x83, 0xd8, 0x01, 0xa5, 0x49, 0xde, 0xa9, 0x95, 0x02, 0x2c, 0x4e,
0xde, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0x78, 0xe3, 0x91, 0x1c, 0xe3, 0x83, 0x47,
0x72, 0x8c, 0x33, 0x1e, 0xcb, 0x31, 0x44, 0xa9, 0x22, 0xb9, 0x24, 0xaf, 0xb8, 0x20, 0x39, 0x59,
0x37, 0x25, 0xb5, 0x4c, 0x3f, 0x2f, 0x35, 0x3f, 0xad, 0x58, 0x37, 0xb1, 0x20, 0x53, 0x37, 0x3d,
0x5f, 0x3f, 0x31, 0x39, 0x67, 0x15, 0x13, 0xaf, 0x5f, 0x6a, 0xbe, 0x5b, 0xb0, 0x9e, 0x63, 0x80,
0xa7, 0x9e, 0x63, 0x72, 0x4e, 0x12, 0x1b, 0xd8, 0x61, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff,
0xb3, 0xda, 0x09, 0x81, 0xdf, 0x00, 0x00, 0x00,
}

27
acl/types.proto Normal file
View file

@ -0,0 +1,27 @@
syntax = "proto3";
package acl;
option go_package = "github.com/nspcc-dev/neofs-api-go/acl";
option csharp_namespace = "NeoFS.API.Acl";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
option (gogoproto.stable_marshaler_all) = true;
// 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;
// PubKey target rule is applied if sender has public key provided in
// extended ACL.
PubKey = 4;
}

View file

@ -31,9 +31,11 @@ func (m *PutRequest) PrepareData() ([]byte, error) {
err error
buf = new(bytes.Buffer)
capBytes = make([]byte, 8)
aclBytes = make([]byte, 4)
)
binary.BigEndian.PutUint64(capBytes, m.Capacity)
binary.BigEndian.PutUint32(capBytes, m.BasicACL)
if _, err = buf.Write(m.MessageID.Bytes()); err != nil {
return nil, errors.Wrap(err, "could not write message id")
@ -45,6 +47,8 @@ func (m *PutRequest) PrepareData() ([]byte, error) {
return nil, errors.Wrap(err, "could not marshal placement")
} else if _, err = buf.Write(data); err != nil {
return nil, errors.Wrap(err, "could not write placement")
} else if _, err = buf.Write(aclBytes); err != nil {
return nil, errors.Wrap(err, "could not write basic acl")
}
return buf.Bytes(), nil

View file

@ -38,8 +38,8 @@ type PutRequest struct {
OwnerID OwnerID `protobuf:"bytes,3,opt,name=OwnerID,proto3,customtype=OwnerID" json:"OwnerID"`
// Rules define storage policy for the object inside the container.
Rules netmap.PlacementRule `protobuf:"bytes,4,opt,name=rules,proto3" json:"rules"`
// Container ACL.
Group AccessGroup `protobuf:"bytes,5,opt,name=Group,proto3" json:"Group"`
// BasicACL of the container.
BasicACL uint32 `protobuf:"varint,5,opt,name=BasicACL,proto3" json:"BasicACL,omitempty"`
// RequestMetaHeader contains information about request meta headers (should be embedded into message)
service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"`
// RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)
@ -92,11 +92,11 @@ func (m *PutRequest) GetRules() netmap.PlacementRule {
return netmap.PlacementRule{}
}
func (m *PutRequest) GetGroup() AccessGroup {
func (m *PutRequest) GetBasicACL() uint32 {
if m != nil {
return m.Group
return m.BasicACL
}
return AccessGroup{}
return 0
}
type PutResponse struct {
@ -391,45 +391,45 @@ func init() {
func init() { proto.RegisterFile("container/service.proto", fileDescriptor_e1fa9d7ab2e7ae06) }
var fileDescriptor_e1fa9d7ab2e7ae06 = []byte{
// 599 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xcb, 0x6e, 0xd3, 0x40,
0x14, 0xed, 0x34, 0xe9, 0xeb, 0xba, 0xbc, 0x86, 0x3e, 0x8c, 0x25, 0xd2, 0xca, 0xab, 0xf2, 0x88,
0x2d, 0x42, 0x25, 0xd8, 0xb0, 0x68, 0x1a, 0x51, 0x2a, 0x51, 0x88, 0x5c, 0x09, 0x24, 0x76, 0xce,
0xf4, 0x26, 0x58, 0x4a, 0x3c, 0xc6, 0x33, 0x0e, 0xca, 0x9f, 0xf0, 0x0d, 0x20, 0xb1, 0xe6, 0x13,
0xba, 0xec, 0x12, 0xb1, 0x88, 0x50, 0x58, 0x22, 0xfe, 0x01, 0x79, 0xfc, 0x4c, 0x5a, 0x60, 0x59,
0xb1, 0xb1, 0x66, 0xce,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x5e, 0xdc, 0x87, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x5b, 0x68, 0x23, 0x86,
0x33, 0x06, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -682,16 +682,11 @@ func (m *PutRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
dAtA[i] = 0x6
i--
dAtA[i] = 0x92
{
size, err := m.Group.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintService(dAtA, i, uint64(size))
if m.BasicACL != 0 {
i = encodeVarintService(dAtA, i, uint64(m.BasicACL))
i--
dAtA[i] = 0x28
}
i--
dAtA[i] = 0x2a
{
size, err := m.Rules.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
@ -1083,8 +1078,9 @@ func (m *PutRequest) Size() (n int) {
n += 1 + l + sovService(uint64(l))
l = m.Rules.Size()
n += 1 + l + sovService(uint64(l))
l = m.Group.Size()
n += 1 + l + sovService(uint64(l))
if m.BasicACL != 0 {
n += 1 + sovService(uint64(m.BasicACL))
}
l = m.RequestMetaHeader.Size()
n += 2 + l + sovService(uint64(l))
l = m.RequestVerificationHeader.Size()
@ -1363,10 +1359,10 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error {
}
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Group", wireType)
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field BasicACL", wireType)
}
var msglen int
m.BasicACL = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowService
@ -1376,25 +1372,11 @@ func (m *PutRequest) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
m.BasicACL |= uint32(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthService
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthService
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.Group.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 98:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RequestMetaHeader", wireType)

View file

@ -42,8 +42,8 @@ message PutRequest {
// Rules define storage policy for the object inside the container.
netmap.PlacementRule rules = 4 [(gogoproto.nullable) = false];
// Container ACL.
AccessGroup Group = 5 [(gogoproto.nullable) = false];
// BasicACL of the container.
uint32 BasicACL = 5;
// RequestMetaHeader contains information about request meta headers (should be embedded into message)
service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false];

View file

@ -11,19 +11,6 @@ import (
"github.com/pkg/errors"
)
// AccessMode is a container access mode type.
type AccessMode uint32
const (
// AccessModeRead is a read access mode.
AccessModeRead AccessMode = 1 << iota
// AccessModeWrite is a write access mode.
AccessModeWrite
)
// AccessModeReadWrite is a read/write container access mode.
const AccessModeReadWrite = AccessModeRead | AccessModeWrite
var (
_ internal.Custom = (*Container)(nil)
@ -31,8 +18,8 @@ var (
emptyOwner = (OwnerID{}).Bytes()
)
// New creates new user container based on capacity, OwnerID and PlacementRules.
func New(cap uint64, owner OwnerID, rules netmap.PlacementRule) (*Container, error) {
// New creates new user container based on capacity, OwnerID, ACL and PlacementRules.
func New(cap uint64, owner OwnerID, acl uint32, rules netmap.PlacementRule) (*Container, error) {
if bytes.Equal(owner[:], emptyOwner) {
return nil, refs.ErrEmptyOwner
} else if cap == 0 {
@ -49,6 +36,7 @@ func New(cap uint64, owner OwnerID, rules netmap.PlacementRule) (*Container, err
Salt: UUID(salt),
Capacity: cap,
Rules: rules,
BasicACL: acl,
}, nil
}
@ -90,7 +78,7 @@ func NewTestContainer() (*Container, error) {
if err != nil {
return nil, err
}
return New(100, owner, netmap.PlacementRule{
return New(100, owner, 0xFFFFFFFF, netmap.PlacementRule{
ReplFactor: 2,
SFGroups: []netmap.SFGroup{
{

View file

@ -34,11 +34,12 @@ type Container struct {
Capacity uint64 `protobuf:"varint,3,opt,name=Capacity,proto3" json:"Capacity,omitempty"`
// Rules define storage policy for the object inside the container.
Rules netmap.PlacementRule `protobuf:"bytes,4,opt,name=Rules,proto3" json:"Rules"`
// Container ACL.
List AccessControlList `protobuf:"bytes,5,opt,name=List,proto3" json:"List"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
// BasicACL with access control rules for owner, system, others and
// permission bits for bearer token and extended ACL.
BasicACL uint32 `protobuf:"varint,5,opt,name=BasicACL,proto3" json:"BasicACL,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Container) Reset() { *m = Container{} }
@ -84,138 +85,41 @@ func (m *Container) GetRules() netmap.PlacementRule {
return netmap.PlacementRule{}
}
func (m *Container) GetList() AccessControlList {
func (m *Container) GetBasicACL() uint32 {
if m != nil {
return m.List
}
return AccessControlList{}
}
type AccessGroup struct {
// Group access mode.
AccessMode uint32 `protobuf:"varint,1,opt,name=AccessMode,proto3" json:"AccessMode,omitempty"`
// Group members.
UserGroup []OwnerID `protobuf:"bytes,2,rep,name=UserGroup,proto3,customtype=OwnerID" json:"UserGroup"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *AccessGroup) Reset() { *m = AccessGroup{} }
func (m *AccessGroup) String() string { return proto.CompactTextString(m) }
func (*AccessGroup) ProtoMessage() {}
func (*AccessGroup) Descriptor() ([]byte, []int) {
return fileDescriptor_1432e52ab0b53e3e, []int{1}
}
func (m *AccessGroup) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *AccessGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
func (m *AccessGroup) XXX_Merge(src proto.Message) {
xxx_messageInfo_AccessGroup.Merge(m, src)
}
func (m *AccessGroup) XXX_Size() int {
return m.Size()
}
func (m *AccessGroup) XXX_DiscardUnknown() {
xxx_messageInfo_AccessGroup.DiscardUnknown(m)
}
var xxx_messageInfo_AccessGroup proto.InternalMessageInfo
func (m *AccessGroup) GetAccessMode() uint32 {
if m != nil {
return m.AccessMode
return m.BasicACL
}
return 0
}
type AccessControlList struct {
// List of access groups.
List []AccessGroup `protobuf:"bytes,1,rep,name=List,proto3" json:"List"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *AccessControlList) Reset() { *m = AccessControlList{} }
func (m *AccessControlList) String() string { return proto.CompactTextString(m) }
func (*AccessControlList) ProtoMessage() {}
func (*AccessControlList) Descriptor() ([]byte, []int) {
return fileDescriptor_1432e52ab0b53e3e, []int{2}
}
func (m *AccessControlList) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *AccessControlList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
func (m *AccessControlList) XXX_Merge(src proto.Message) {
xxx_messageInfo_AccessControlList.Merge(m, src)
}
func (m *AccessControlList) XXX_Size() int {
return m.Size()
}
func (m *AccessControlList) XXX_DiscardUnknown() {
xxx_messageInfo_AccessControlList.DiscardUnknown(m)
}
var xxx_messageInfo_AccessControlList proto.InternalMessageInfo
func (m *AccessControlList) GetList() []AccessGroup {
if m != nil {
return m.List
}
return nil
}
func init() {
proto.RegisterType((*Container)(nil), "container.Container")
proto.RegisterType((*AccessGroup)(nil), "container.AccessGroup")
proto.RegisterType((*AccessControlList)(nil), "container.AccessControlList")
}
func init() { proto.RegisterFile("container/types.proto", fileDescriptor_1432e52ab0b53e3e) }
var fileDescriptor_1432e52ab0b53e3e = []byte{
// 393 bytes of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xa5, 0xec, 0x70,
0x84, 0x3b, 0xc3, 0x01, 0xce, 0x37, 0x3a, 0xf9, 0x24, 0xd7, 0xbc, 0xf7, 0x1a, 0x00, 0x00, 0xff,
0xff, 0xd2, 0x94, 0x7a, 0x2b, 0x65, 0x02, 0x00, 0x00,
// 315 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4d, 0xce, 0xcf, 0x2b,
0x49, 0xcc, 0xcc, 0x4b, 0x2d, 0xd2, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f,
0xc9, 0x17, 0xe2, 0x84, 0x0b, 0x4b, 0x69, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7,
0xe7, 0xea, 0xe7, 0x15, 0x17, 0x24, 0x27, 0xeb, 0xa6, 0xa4, 0x96, 0xe9, 0xe7, 0xa5, 0x96, 0xe4,
0x26, 0x16, 0xe8, 0x17, 0xa7, 0xe6, 0xa4, 0x26, 0x97, 0xe4, 0x17, 0x41, 0xb4, 0x49, 0xe9, 0x22,
0xa9, 0x4d, 0xcf, 0x4f, 0xcf, 0xd7, 0x07, 0x0b, 0x27, 0x95, 0xa6, 0x81, 0x79, 0x60, 0x0e, 0x98,
0x05, 0x51, 0xae, 0x74, 0x98, 0x91, 0x8b, 0xd3, 0x19, 0x66, 0x91, 0x90, 0x26, 0x17, 0xbb, 0x7f,
0x79, 0x5e, 0x6a, 0x91, 0xa7, 0x8b, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x8f, 0x13, 0xff, 0x89, 0x7b,
0xf2, 0x0c, 0xb7, 0xee, 0xc9, 0xc3, 0x84, 0x83, 0x60, 0x0c, 0x21, 0x05, 0x2e, 0x96, 0xe0, 0xc4,
0x9c, 0x12, 0x09, 0x26, 0xb0, 0x3a, 0x1e, 0xa8, 0x3a, 0x96, 0xd0, 0x50, 0x4f, 0x97, 0x20, 0xb0,
0x8c, 0x90, 0x14, 0x17, 0x87, 0x73, 0x62, 0x41, 0x62, 0x72, 0x66, 0x49, 0xa5, 0x04, 0xb3, 0x02,
0xa3, 0x06, 0x4b, 0x10, 0x9c, 0x2f, 0x64, 0xc8, 0xc5, 0x1a, 0x54, 0x9a, 0x93, 0x5a, 0x2c, 0xc1,
0xa2, 0xc0, 0xa8, 0xc1, 0x6d, 0x24, 0xaa, 0x07, 0xf1, 0x8c, 0x5e, 0x40, 0x4e, 0x62, 0x72, 0x6a,
0x6e, 0x6a, 0x5e, 0x09, 0x48, 0xd6, 0x89, 0x05, 0x64, 0x6a, 0x10, 0x44, 0x25, 0xc8, 0x38, 0xa7,
0xc4, 0xe2, 0xcc, 0x64, 0x47, 0x67, 0x1f, 0x09, 0x56, 0x05, 0x46, 0x0d, 0xde, 0x20, 0x38, 0xdf,
0x29, 0xfc, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x6f, 0x3c, 0x92, 0x63, 0x7c, 0xf0,
0x48, 0x8e, 0x71, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x6d, 0x1c, 0xc1, 0x96, 0x9f, 0x56, 0xac, 0x9b,
0x58, 0x90, 0xa9, 0x9b, 0x9e, 0xaf, 0x0f, 0x0f, 0xe3, 0x55, 0x4c, 0xc2, 0x7e, 0xa9, 0xf9, 0x6e,
0xc1, 0x7a, 0x8e, 0x01, 0x9e, 0x7a, 0xf0, 0x00, 0x49, 0x62, 0x03, 0x87, 0x92, 0x31, 0x20, 0x00,
0x00, 0xff, 0xff, 0xfc, 0x81, 0x55, 0xd6, 0xa4, 0x01, 0x00, 0x00,
}
func (m *Container) Marshal() (dAtA []byte, err error) {
@ -242,16 +146,11 @@ func (m *Container) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
{
size, err := m.List.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTypes(dAtA, i, uint64(size))
if m.BasicACL != 0 {
i = encodeVarintTypes(dAtA, i, uint64(m.BasicACL))
i--
dAtA[i] = 0x28
}
i--
dAtA[i] = 0x2a
{
size, err := m.Rules.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
@ -290,93 +189,6 @@ func (m *Container) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
func (m *AccessGroup) 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 *AccessGroup) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *AccessGroup) 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.UserGroup) > 0 {
for iNdEx := len(m.UserGroup) - 1; iNdEx >= 0; iNdEx-- {
{
size := m.UserGroup[iNdEx].Size()
i -= size
if _, err := m.UserGroup[iNdEx].MarshalTo(dAtA[i:]); err != nil {
return 0, err
}
i = encodeVarintTypes(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
}
if m.AccessMode != 0 {
i = encodeVarintTypes(dAtA, i, uint64(m.AccessMode))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
func (m *AccessControlList) 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 *AccessControlList) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *AccessControlList) 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.List) > 0 {
for iNdEx := len(m.List) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.List[iNdEx].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 encodeVarintTypes(dAtA []byte, offset int, v uint64) int {
offset -= sovTypes(v)
base := offset
@ -403,46 +215,8 @@ func (m *Container) Size() (n int) {
}
l = m.Rules.Size()
n += 1 + l + sovTypes(uint64(l))
l = m.List.Size()
n += 1 + l + sovTypes(uint64(l))
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func (m *AccessGroup) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.AccessMode != 0 {
n += 1 + sovTypes(uint64(m.AccessMode))
}
if len(m.UserGroup) > 0 {
for _, e := range m.UserGroup {
l = e.Size()
n += 1 + l + sovTypes(uint64(l))
}
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
}
return n
}
func (m *AccessControlList) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.List) > 0 {
for _, e := range m.List {
l = e.Size()
n += 1 + l + sovTypes(uint64(l))
}
if m.BasicACL != 0 {
n += 1 + sovTypes(uint64(m.BasicACL))
}
if m.XXX_unrecognized != nil {
n += len(m.XXX_unrecognized)
@ -604,97 +378,10 @@ func (m *Container) Unmarshal(dAtA []byte) error {
}
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field List", 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 err := m.List.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 *AccessGroup) 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: AccessGroup: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: AccessGroup: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field AccessMode", wireType)
return fmt.Errorf("proto: wrong wireType = %d for field BasicACL", wireType)
}
m.AccessMode = 0
m.BasicACL = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
@ -704,134 +391,11 @@ func (m *AccessGroup) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.AccessMode |= uint32(b&0x7F) << shift
m.BasicACL |= uint32(b&0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field UserGroup", 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
}
var v OwnerID
m.UserGroup = append(m.UserGroup, v)
if err := m.UserGroup[len(m.UserGroup)-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 (m *AccessControlList) 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: AccessControlList: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: AccessControlList: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field List", 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.List = append(m.List, AccessGroup{})
if err := m.List[len(m.List)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTypes(dAtA[iNdEx:])

View file

@ -18,18 +18,7 @@ message Container {
uint64 Capacity = 3;
// Rules define storage policy for the object inside the container.
netmap.PlacementRule Rules = 4 [(gogoproto.nullable) = false];
// Container ACL.
AccessControlList List = 5 [(gogoproto.nullable) = false];
}
message AccessGroup {
// Group access mode.
uint32 AccessMode = 1;
// Group members.
repeated bytes UserGroup = 2 [(gogoproto.customtype) = "OwnerID", (gogoproto.nullable) = false];
}
message AccessControlList {
// List of access groups.
repeated AccessGroup List = 1 [(gogoproto.nullable) = false];
// BasicACL with access control rules for owner, system, others and
// permission bits for bearer token and extended ACL.
uint32 BasicACL = 5;
}

View file

@ -36,7 +36,7 @@ func TestCID(t *testing.T) {
owner, err := refs.NewOwnerID(&key.PublicKey)
require.NoError(t, err)
c1, err := New(10, owner, rules)
c1, err := New(10, owner, 0xDEADBEEF, rules)
require.NoError(t, err)
data, err := proto.Marshal(c1)
@ -55,23 +55,3 @@ func TestCID(t *testing.T) {
require.Equal(t, cid1, cid2)
})
}
func TestAccessMode(t *testing.T) {
t.Run("read access to read/write mode", func(t *testing.T) {
require.Equal(t, AccessModeRead, AccessModeReadWrite&AccessModeRead)
})
t.Run("write access to read/write mode", func(t *testing.T) {
require.Equal(t, AccessModeWrite, AccessModeReadWrite&AccessModeWrite)
})
t.Run("read(write) access to write(read) mode", func(t *testing.T) {
require.Zero(t, AccessModeRead&AccessModeWrite)
})
t.Run("access to same mode", func(t *testing.T) {
require.Equal(t, AccessModeWrite, AccessModeWrite&AccessModeWrite)
require.Equal(t, AccessModeRead, AccessModeRead&AccessModeRead)
require.Equal(t, AccessModeReadWrite, AccessModeReadWrite&AccessModeReadWrite)
})
}

62
docs/acl.md Normal file
View file

@ -0,0 +1,62 @@
# Protocol Documentation
<a name="top"></a>
## Table of Contents
- [acl/types.proto](#acl/types.proto)
- [Scalar Value Types](#scalar-value-types)
<a name="acl/types.proto"></a>
<p align="right"><a href="#top">Top</a></p>
## acl/types.proto
<!-- end services -->
<!-- end messages -->
<a name="acl.Target"></a>
### Target
Target of the access control rule in access control list.
| Name | Number | Description |
| ---- | ------ | ----------- |
| Unknown | 0 | Unknown target, default value. |
| User | 1 | User target rule is applied if sender is the owner of the container. |
| System | 2 | System target rule is applied if sender is the storage node within the container or inner ring node. |
| Others | 3 | Others target rule is applied if sender is not user or system target. |
| PubKey | 4 | PubKey target rule is applied if sender has public key provided in extended ACL. |
<!-- end enums -->
## Scalar Value Types
| .proto Type | Notes | C++ Type | Java Type | Python Type |
| ----------- | ----- | -------- | --------- | ----------- |
| <a name="double" /> double | | double | double | float |
| <a name="float" /> float | | float | float | float |
| <a name="int32" /> int32 | Uses variable-length encoding. Inefficient for encoding negative numbers if your field is likely to have negative values, use sint32 instead. | int32 | int | int |
| <a name="int64" /> int64 | Uses variable-length encoding. Inefficient for encoding negative numbers if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long |
| <a name="uint32" /> uint32 | Uses variable-length encoding. | uint32 | int | int/long |
| <a name="uint64" /> uint64 | Uses variable-length encoding. | uint64 | long | int/long |
| <a name="sint32" /> sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int |
| <a name="sint64" /> sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long |
| <a name="fixed32" /> fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int |
| <a name="fixed64" /> fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long |
| <a name="sfixed32" /> sfixed32 | Always four bytes. | int32 | int | int |
| <a name="sfixed64" /> sfixed64 | Always eight bytes. | int64 | long | int/long |
| <a name="bool" /> bool | | bool | boolean | boolean |
| <a name="string" /> string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode |
| <a name="bytes" /> bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str |

View file

@ -21,8 +21,6 @@
- [container/types.proto](#container/types.proto)
- Messages
- [AccessControlList](#container.AccessControlList)
- [AccessGroup](#container.AccessGroup)
- [Container](#container.Container)
@ -166,7 +164,7 @@ via consensus in inner ring nodes
| Capacity | [uint64](#uint64) | | Capacity defines amount of data that can be stored in the container (doesn't used for now). |
| OwnerID | [bytes](#bytes) | | OwnerID is a wallet address |
| rules | [netmap.PlacementRule](#netmap.PlacementRule) | | Rules define storage policy for the object inside the container. |
| Group | [AccessGroup](#container.AccessGroup) | | Container ACL. |
| BasicACL | [uint32](#uint32) | | BasicACL of the container. |
| Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) |
| Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) |
@ -196,29 +194,6 @@ via consensus in inner ring nodes
<!-- end services -->
<a name="container.AccessControlList"></a>
### Message AccessControlList
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| List | [AccessGroup](#container.AccessGroup) | repeated | List of access groups. |
<a name="container.AccessGroup"></a>
### Message AccessGroup
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| AccessMode | [uint32](#uint32) | | Group access mode. |
| UserGroup | [bytes](#bytes) | repeated | Group members. |
<a name="container.Container"></a>
### Message Container
@ -231,7 +206,7 @@ The Container service definition.
| Salt | [bytes](#bytes) | | Salt is a nonce for unique container id calculation. |
| Capacity | [uint64](#uint64) | | Capacity defines amount of data that can be stored in the container (doesn't used for now). |
| Rules | [netmap.PlacementRule](#netmap.PlacementRule) | | Rules define storage policy for the object inside the container. |
| List | [AccessControlList](#container.AccessControlList) | | Container ACL. |
| BasicACL | [uint32](#uint32) | | BasicACL with access control rules for owner, system, others and permission bits for bearer token and extended ACL. |
<!-- end messages -->