[#112] container: Remove GetExtendedACL

Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
This commit is contained in:
Aleksey Savchuk 2024-09-02 13:39:07 +03:00
parent 9c5e32a183
commit c11f50efec
No known key found for this signature in database
11 changed files with 0 additions and 477 deletions

View file

@ -1,8 +1,6 @@
package container
import (
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl"
aclGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc"
container "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container/grpc"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap"
netmapGRPC "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/grpc"
@ -764,175 +762,3 @@ func (r *ListResponse) FromGRPCMessage(m grpc.Message) error {
return r.ResponseHeaders.FromMessage(v)
}
func (r *GetExtendedACLRequestBody) ToGRPCMessage() grpc.Message {
var m *container.GetExtendedACLRequest_Body
if r != nil {
m = new(container.GetExtendedACLRequest_Body)
m.SetContainerId(r.cid.ToGRPCMessage().(*refsGRPC.ContainerID))
}
return m
}
func (r *GetExtendedACLRequestBody) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.GetExtendedACLRequest_Body)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
cid := v.GetContainerId()
if cid == nil {
r.cid = nil
} else {
if r.cid == nil {
r.cid = new(refs.ContainerID)
}
err = r.cid.FromGRPCMessage(cid)
}
return err
}
func (r *GetExtendedACLRequest) ToGRPCMessage() grpc.Message {
var m *container.GetExtendedACLRequest
if r != nil {
m = new(container.GetExtendedACLRequest)
m.SetBody(r.body.ToGRPCMessage().(*container.GetExtendedACLRequest_Body))
r.RequestHeaders.ToMessage(m)
}
return m
}
func (r *GetExtendedACLRequest) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.GetExtendedACLRequest)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
body := v.GetBody()
if body == nil {
r.body = nil
} else {
if r.body == nil {
r.body = new(GetExtendedACLRequestBody)
}
err = r.body.FromGRPCMessage(body)
if err != nil {
return err
}
}
return r.RequestHeaders.FromMessage(v)
}
func (r *GetExtendedACLResponseBody) ToGRPCMessage() grpc.Message {
var m *container.GetExtendedACLResponse_Body
if r != nil {
m = new(container.GetExtendedACLResponse_Body)
m.SetEacl(r.eacl.ToGRPCMessage().(*aclGRPC.EACLTable))
m.SetSignature(toSignatureRFC6979(r.sig))
m.SetSessionToken(r.token.ToGRPCMessage().(*sessionGRPC.SessionToken))
}
return m
}
func (r *GetExtendedACLResponseBody) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.GetExtendedACLResponse_Body)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
eacl := v.GetEacl()
if eacl == nil {
r.eacl = nil
} else {
if r.eacl == nil {
r.eacl = new(acl.Table)
}
err = r.eacl.FromGRPCMessage(eacl)
if err != nil {
return err
}
}
sig := v.GetSignature()
if sig == nil {
r.sig = nil
} else {
if r.sig == nil {
r.sig = new(refs.Signature)
}
r.sig.SetKey(sig.GetKey())
r.sig.SetSign(sig.GetSign())
}
token := v.GetSessionToken()
if token == nil {
r.token = nil
} else {
if r.token == nil {
r.token = new(session.Token)
}
err = r.token.FromGRPCMessage(token)
}
return err
}
func (r *GetExtendedACLResponse) ToGRPCMessage() grpc.Message {
var m *container.GetExtendedACLResponse
if r != nil {
m = new(container.GetExtendedACLResponse)
m.SetBody(r.body.ToGRPCMessage().(*container.GetExtendedACLResponse_Body))
r.ResponseHeaders.ToMessage(m)
}
return m
}
func (r *GetExtendedACLResponse) FromGRPCMessage(m grpc.Message) error {
v, ok := m.(*container.GetExtendedACLResponse)
if !ok {
return message.NewUnexpectedMessageType(m, v)
}
var err error
body := v.GetBody()
if body == nil {
r.body = nil
} else {
if r.body == nil {
r.body = new(GetExtendedACLResponseBody)
}
err = r.body.FromGRPCMessage(body)
if err != nil {
return err
}
}
return r.ResponseHeaders.FromMessage(v)
}

Binary file not shown.

View file

@ -157,41 +157,3 @@ func DoFuzzJSONListResponse(data []byte) int {
}
return 1
}
func DoFuzzProtoGetExtendedACLRequest(data []byte) int {
msg := new(GetExtendedACLRequest)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONGetExtendedACLRequest(data []byte) int {
msg := new(GetExtendedACLRequest)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}
func DoFuzzProtoGetExtendedACLResponse(data []byte) int {
msg := new(GetExtendedACLResponse)
if err := msg.UnmarshalProtobuf(data); err != nil {
return 0
}
_ = msg.MarshalProtobuf(nil)
return 1
}
func DoFuzzJSONGetExtendedACLResponse(data []byte) int {
msg := new(GetExtendedACLResponse)
if err := msg.UnmarshalJSON(data); err != nil {
return 0
}
_, err := msg.MarshalJSON()
if err != nil {
panic(err)
}
return 1
}

View file

@ -89,23 +89,3 @@ func FuzzJSONListResponse(f *testing.F) {
DoFuzzJSONListResponse(data)
})
}
func FuzzProtoGetExtendedACLRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoGetExtendedACLRequest(data)
})
}
func FuzzJSONGetExtendedACLRequest(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONGetExtendedACLRequest(data)
})
}
func FuzzProtoGetExtendedACLResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzProtoGetExtendedACLResponse(data)
})
}
func FuzzJSONGetExtendedACLResponse(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
DoFuzzJSONGetExtendedACLResponse(data)
})
}

Binary file not shown.

View file

@ -34,12 +34,6 @@ const (
listReqBodyOwnerField = 1
listRespBodyIDsField = 1
getEACLReqBodyIDField = 1
getEACLRespBodyTableField = 1
getEACLRespBodySignatureField = 2
getEACLRespBodyTokenField = 3
)
func (a *Attribute) StableMarshal(buf []byte) []byte {
@ -349,65 +343,3 @@ func (r *ListResponseBody) StableSize() (size int) {
func (r *ListResponseBody) Unmarshal(data []byte) error {
return message.Unmarshal(r, data, new(container.ListResponse_Body))
}
func (r *GetExtendedACLRequestBody) StableMarshal(buf []byte) []byte {
if r == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, r.StableSize())
}
protoutil.NestedStructureMarshal(getEACLReqBodyIDField, buf, r.cid)
return buf
}
func (r *GetExtendedACLRequestBody) StableSize() (size int) {
if r == nil {
return 0
}
size += protoutil.NestedStructureSize(getEACLReqBodyIDField, r.cid)
return size
}
func (r *GetExtendedACLRequestBody) Unmarshal(data []byte) error {
return message.Unmarshal(r, data, new(container.GetExtendedACLRequest_Body))
}
func (r *GetExtendedACLResponseBody) StableMarshal(buf []byte) []byte {
if r == nil {
return []byte{}
}
if buf == nil {
buf = make([]byte, r.StableSize())
}
var offset int
offset += protoutil.NestedStructureMarshal(getEACLRespBodyTableField, buf[offset:], r.eacl)
offset += protoutil.NestedStructureMarshal(getEACLRespBodySignatureField, buf[offset:], r.sig)
protoutil.NestedStructureMarshal(getEACLRespBodyTokenField, buf[offset:], r.token)
return buf
}
func (r *GetExtendedACLResponseBody) StableSize() (size int) {
if r == nil {
return 0
}
size += protoutil.NestedStructureSize(getEACLRespBodyTableField, r.eacl)
size += protoutil.NestedStructureSize(getEACLRespBodySignatureField, r.sig)
size += protoutil.NestedStructureSize(getEACLRespBodyTokenField, r.token)
return size
}
func (r *GetExtendedACLResponseBody) Unmarshal(data []byte) error {
return message.Unmarshal(r, data, new(container.GetExtendedACLResponse_Body))
}

View file

@ -32,9 +32,5 @@ func TestMessageConvert(t *testing.T) {
func(empty bool) message.Message { return containertest.GenerateGetRequest(empty) },
func(empty bool) message.Message { return containertest.GenerateGetResponseBody(empty) },
func(empty bool) message.Message { return containertest.GenerateGetResponse(empty) },
func(empty bool) message.Message { return containertest.GenerateGetExtendedACLRequestBody(empty) },
func(empty bool) message.Message { return containertest.GenerateGetExtendedACLRequest(empty) },
func(empty bool) message.Message { return containertest.GenerateGetExtendedACLResponseBody(empty) },
func(empty bool) message.Message { return containertest.GenerateGetExtendedACLResponse(empty) },
)
}

View file

@ -3,7 +3,6 @@ package containertest
import (
"crypto/rand"
acltest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/test"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/container"
netmaptest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/test"
refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test"
@ -239,52 +238,3 @@ func GenerateListResponse(empty bool) *container.ListResponse {
return m
}
func GenerateGetExtendedACLRequestBody(empty bool) *container.GetExtendedACLRequestBody {
m := new(container.GetExtendedACLRequestBody)
if !empty {
m.SetContainerID(refstest.GenerateContainerID(false))
}
return m
}
func GenerateGetExtendedACLRequest(empty bool) *container.GetExtendedACLRequest {
m := new(container.GetExtendedACLRequest)
if !empty {
m.SetBody(GenerateGetExtendedACLRequestBody(false))
}
m.SetMetaHeader(sessiontest.GenerateRequestMetaHeader(empty))
m.SetVerificationHeader(sessiontest.GenerateRequestVerificationHeader(empty))
return m
}
func GenerateGetExtendedACLResponseBody(empty bool) *container.GetExtendedACLResponseBody {
m := new(container.GetExtendedACLResponseBody)
if !empty {
m.SetEACL(acltest.GenerateTable(false))
}
m.SetSignature(refstest.GenerateSignature(empty))
m.SetSessionToken(sessiontest.GenerateSessionToken(empty))
return m
}
func GenerateGetExtendedACLResponse(empty bool) *container.GetExtendedACLResponse {
m := new(container.GetExtendedACLResponse)
if !empty {
m.SetBody(GenerateGetExtendedACLResponseBody(false))
}
m.SetMetaHeader(sessiontest.GenerateResponseMetaHeader(empty))
m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty))
return m
}

View file

@ -1,7 +1,6 @@
package container
import (
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session"
@ -110,30 +109,6 @@ type ListResponse struct {
session.ResponseHeaders
}
type GetExtendedACLRequestBody struct {
cid *refs.ContainerID
}
type GetExtendedACLRequest struct {
body *GetExtendedACLRequestBody
session.RequestHeaders
}
type GetExtendedACLResponseBody struct {
eacl *acl.Table
sig *refs.Signature
token *session.Token
}
type GetExtendedACLResponse struct {
body *GetExtendedACLResponseBody
session.ResponseHeaders
}
func (a *Attribute) GetKey() string {
if a != nil {
return a.key
@ -469,81 +444,3 @@ func (r *ListResponse) GetBody() *ListResponseBody {
func (r *ListResponse) SetBody(v *ListResponseBody) {
r.body = v
}
func (r *GetExtendedACLRequestBody) GetContainerID() *refs.ContainerID {
if r != nil {
return r.cid
}
return nil
}
func (r *GetExtendedACLRequestBody) SetContainerID(v *refs.ContainerID) {
r.cid = v
}
func (r *GetExtendedACLRequest) GetBody() *GetExtendedACLRequestBody {
if r != nil {
return r.body
}
return nil
}
func (r *GetExtendedACLRequest) SetBody(v *GetExtendedACLRequestBody) {
r.body = v
}
func (r *GetExtendedACLResponseBody) GetEACL() *acl.Table {
if r != nil {
return r.eacl
}
return nil
}
func (r *GetExtendedACLResponseBody) SetEACL(v *acl.Table) {
r.eacl = v
}
func (r *GetExtendedACLResponseBody) GetSignature() *refs.Signature {
if r != nil {
return r.sig
}
return nil
}
func (r *GetExtendedACLResponseBody) SetSignature(v *refs.Signature) {
// TODO: (neofs-api-go#381) avoid this hack (e.g. create refs.SignatureRFC6979 type)
v.SetScheme(0)
r.sig = v
}
// GetSessionToken returns token of the session within which requested
// eACL table was set.
func (r *GetExtendedACLResponseBody) GetSessionToken() *session.Token {
if r != nil {
return r.token
}
return nil
}
// SetSessionToken sets token of the session within which requested
// eACL table was set.
func (r *GetExtendedACLResponseBody) SetSessionToken(v *session.Token) {
r.token = v
}
func (r *GetExtendedACLResponse) GetBody() *GetExtendedACLResponseBody {
if r != nil {
return r.body
}
return nil
}
func (r *GetExtendedACLResponse) SetBody(v *GetExtendedACLResponseBody) {
r.body = v
}

View file

@ -80,19 +80,3 @@ func ListContainers(
return resp, nil
}
// GetEACL executes ContainerService.GetExtendedACL RPC.
func GetEACL(
cli *client.Client,
req *container.GetExtendedACLRequest,
opts ...client.CallOption,
) (*container.GetExtendedACLResponse, error) {
resp := new(container.GetExtendedACLResponse)
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceContainer, rpcContainerGetEACL), req, resp, opts...)
if err != nil {
return nil, err
}
return resp, nil
}

View file

@ -46,10 +46,6 @@ func serviceMessageBody(req any) stableMarshaler {
return v.GetBody()
case *container.ListResponse:
return v.GetBody()
case *container.GetExtendedACLRequest:
return v.GetBody()
case *container.GetExtendedACLResponse:
return v.GetBody()
/* Object */
case *object.PutRequest: