From c11f50efeccbc68d9c12e9688e739a4f3bc4f301 Mon Sep 17 00:00:00 2001 From: Aleksey Savchuk Date: Mon, 2 Sep 2024 13:39:07 +0300 Subject: [PATCH] [#112] container: Remove GetExtendedACL Signed-off-by: Aleksey Savchuk --- container/convert.go | 174 ------------------------- container/grpc/service_frostfs.pb.go | Bin 94795 -> 74347 bytes container/grpc/service_frostfs_fuzz.go | 38 ------ container/grpc/service_frostfs_test.go | 20 --- container/grpc/service_grpc.pb.go | Bin 14584 -> 11817 bytes container/marshal.go | 68 ---------- container/message_test.go | 4 - container/test/generate.go | 50 ------- container/types.go | 103 --------------- rpc/container.go | 16 --- signature/body.go | 4 - 11 files changed, 477 deletions(-) diff --git a/container/convert.go b/container/convert.go index b487f40..ebd4bcc 100644 --- a/container/convert.go +++ b/container/convert.go @@ -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) -} diff --git a/container/grpc/service_frostfs.pb.go b/container/grpc/service_frostfs.pb.go index f38b0de6a11c780aedeabc4327988c6aee70625e..ffdc7306be79f92497825a162f736fcb1bab4698 100644 GIT binary patch delta 19 bcmX^8g!T0imI*bJ85xZlKWzQLxK|MXVFw8? delta 2254 zcmaKsdq`7p6vz3Q3R|Y7`AVBtiE^uS+6;+atL&wTX%g9EyXm!;&E=*kHRpOk7S%f7 zsMM?==z*3uvw~c$!k|AgGYDU&hLJ>8~EUL z(2<=a-RVvbV~fjDH&mF5lavbaM?j9&j#hFr5n5}4Ll<$@tZFM~D&b1>^K-ztGy}}P z!l5X6s_d_qI*c6IGDP}i$dMfZIsFH4@+aquk9c62y1jvjD6x2=-1SPk>aOKPA+HyP^Qoj`Vw@IDozkE>LeYgBV% zxMZ9|g}|$3`Ih_d2&MhrGDyW!j2*b5^YlHbgl}W(3D(%hJ;Z2v9FGvM`tl<{JM0wH zjDW>SB&!(>t$@07+0y#p_&OFDL*B+o7}+*jFj6u37&*V$Fniz{^hM$i~A^pJloW)#jvT(l5U@X>(%3>?CL#fCTt}pZVqY*D~ zdP{M^ErqQ;lhc zvG?9eZC%A3+|Q&c;E z(QNxwgj~jOawlr|Z2*06KHqjmN56;%XZ9cu(Cof~PDiY1j;!}P6`YQQ@WzvJLXUn3w;(&pUmQt%>pd1I5&3+1h8(_6W8Y4 Yd_t*-d9$|qa_-HIrbn12udoOJ0FxCNF8}}l delta 825 zcmZ1(^P_M>C=-hU5KInaih?n8CtqPQKyY-Kb>SRlpUmRP4NRhZ?x`iN6(y;8DXA%r z&OVc8Gg%6v3Mp}EPTnshx_LhHCCrY-N70QwdGSQ!F%H%gvT$8_ZiHf-b1>*huL*m{1L;YN|v=lUq4a|)v*GVdH zfz(1wo4ipnQy$FCELKQK&C5(p(c|Job=2fUPAPP!9~4mMhPe%B*yaS@MApd-0xHOY zMChA5mrowu=>2>q=t7Qyv6Dr$g(oK{vu(a5Bs7SEMo&&m1t}bYQVUB{i%T>WG_=sd zFo9QO^Ly!f=1FpTC}Bjj0e57)(Sv1yoap8}`Q_Y`w<(LG%lWI#Lb0bnr4C(5ol-oy v&;z9o4OE9~B$rg^C={g@>S1`PO4(+!sP+-2$+o&;D0VH>RY5oSq;3KL2k#Ex diff --git a/container/marshal.go b/container/marshal.go index ff17150..7c9b8ef 100644 --- a/container/marshal.go +++ b/container/marshal.go @@ -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)) -} diff --git a/container/message_test.go b/container/message_test.go index 6558e25..da99331 100644 --- a/container/message_test.go +++ b/container/message_test.go @@ -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) }, ) } diff --git a/container/test/generate.go b/container/test/generate.go index 23ad3a1..fb5c9e6 100644 --- a/container/test/generate.go +++ b/container/test/generate.go @@ -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 -} diff --git a/container/types.go b/container/types.go index 3a9e915..6adc57b 100644 --- a/container/types.go +++ b/container/types.go @@ -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 -} diff --git a/rpc/container.go b/rpc/container.go index 39213f6..b1d4a68 100644 --- a/rpc/container.go +++ b/rpc/container.go @@ -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 -} diff --git a/signature/body.go b/signature/body.go index 4b43b84..b1a5904 100644 --- a/signature/body.go +++ b/signature/body.go @@ -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: