diff --git a/accounting/grpc/service_frostfs.pb.go b/accounting/grpc/service_frostfs.pb.go index 9c8c946..4f11303 100644 Binary files a/accounting/grpc/service_frostfs.pb.go and b/accounting/grpc/service_frostfs.pb.go differ diff --git a/accounting/grpc/types_frostfs.pb.go b/accounting/grpc/types_frostfs.pb.go index b7e6b40..8585583 100644 Binary files a/accounting/grpc/types_frostfs.pb.go and b/accounting/grpc/types_frostfs.pb.go differ diff --git a/acl/grpc/types_frostfs.pb.go b/acl/grpc/types_frostfs.pb.go index bc90cb7..1ba6c53 100644 Binary files a/acl/grpc/types_frostfs.pb.go and b/acl/grpc/types_frostfs.pb.go differ diff --git a/ape/grpc/types_frostfs.pb.go b/ape/grpc/types_frostfs.pb.go index 1f2a1a5..7967e13 100644 Binary files a/ape/grpc/types_frostfs.pb.go and b/ape/grpc/types_frostfs.pb.go differ diff --git a/apemanager/grpc/service_frostfs.pb.go b/apemanager/grpc/service_frostfs.pb.go index b2633e1..2a30850 100644 Binary files a/apemanager/grpc/service_frostfs.pb.go and b/apemanager/grpc/service_frostfs.pb.go differ diff --git a/container/convert.go b/container/convert.go index ebd4bcc..9937c7f 100644 --- a/container/convert.go +++ b/container/convert.go @@ -762,3 +762,138 @@ func (r *ListResponse) FromGRPCMessage(m grpc.Message) error { return r.ResponseHeaders.FromMessage(v) } + +func (r *ListStreamRequestBody) ToGRPCMessage() grpc.Message { + var m *container.ListStreamRequest_Body + + if r != nil { + m = new(container.ListStreamRequest_Body) + + m.SetOwnerId(r.ownerID.ToGRPCMessage().(*refsGRPC.OwnerID)) + } + + return m +} + +func (r *ListStreamRequestBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.ListStreamRequest_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + ownerID := v.GetOwnerId() + if ownerID == nil { + r.ownerID = nil + } else { + if r.ownerID == nil { + r.ownerID = new(refs.OwnerID) + } + + err = r.ownerID.FromGRPCMessage(ownerID) + } + + return err +} + +func (r *ListStreamRequest) ToGRPCMessage() grpc.Message { + var m *container.ListStreamRequest + + if r != nil { + m = new(container.ListStreamRequest) + + m.SetBody(r.body.ToGRPCMessage().(*container.ListStreamRequest_Body)) + r.RequestHeaders.ToMessage(m) + } + + return m +} + +func (r *ListStreamRequest) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.ListStreamRequest) + 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(ListStreamRequestBody) + } + + err = r.body.FromGRPCMessage(body) + if err != nil { + return err + } + } + + return r.RequestHeaders.FromMessage(v) +} + +func (r *ListStreamResponseBody) ToGRPCMessage() grpc.Message { + var m *container.ListStreamResponse_Body + + if r != nil { + m = new(container.ListStreamResponse_Body) + + m.SetContainerIds(refs.ContainerIDsToGRPCMessage(r.cidList)) + } + + return m +} + +func (r *ListStreamResponseBody) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.ListStreamResponse_Body) + if !ok { + return message.NewUnexpectedMessageType(m, v) + } + + var err error + + r.cidList, err = refs.ContainerIDsFromGRPCMessage(v.GetContainerIds()) + + return err +} + +func (r *ListStreamResponse) ToGRPCMessage() grpc.Message { + var m *container.ListStreamResponse + + if r != nil { + m = new(container.ListStreamResponse) + + m.SetBody(r.body.ToGRPCMessage().(*container.ListStreamResponse_Body)) + r.ResponseHeaders.ToMessage(m) + } + + return m +} + +func (r *ListStreamResponse) FromGRPCMessage(m grpc.Message) error { + v, ok := m.(*container.ListStreamResponse) + 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(ListStreamResponseBody) + } + + 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 cc05dde..bc78225 100644 Binary files a/container/grpc/service_frostfs.pb.go and b/container/grpc/service_frostfs.pb.go differ diff --git a/container/grpc/service_frostfs_fuzz.go b/container/grpc/service_frostfs_fuzz.go index 7e6d6e6..024b237 100644 --- a/container/grpc/service_frostfs_fuzz.go +++ b/container/grpc/service_frostfs_fuzz.go @@ -157,3 +157,41 @@ func DoFuzzJSONListResponse(data []byte) int { } return 1 } +func DoFuzzProtoListStreamRequest(data []byte) int { + msg := new(ListStreamRequest) + if err := msg.UnmarshalProtobuf(data); err != nil { + return 0 + } + _ = msg.MarshalProtobuf(nil) + return 1 +} +func DoFuzzJSONListStreamRequest(data []byte) int { + msg := new(ListStreamRequest) + if err := msg.UnmarshalJSON(data); err != nil { + return 0 + } + _, err := msg.MarshalJSON() + if err != nil { + panic(err) + } + return 1 +} +func DoFuzzProtoListStreamResponse(data []byte) int { + msg := new(ListStreamResponse) + if err := msg.UnmarshalProtobuf(data); err != nil { + return 0 + } + _ = msg.MarshalProtobuf(nil) + return 1 +} +func DoFuzzJSONListStreamResponse(data []byte) int { + msg := new(ListStreamResponse) + if err := msg.UnmarshalJSON(data); err != nil { + return 0 + } + _, err := msg.MarshalJSON() + if err != nil { + panic(err) + } + return 1 +} diff --git a/container/grpc/service_frostfs_test.go b/container/grpc/service_frostfs_test.go index 804b89c..2844996 100644 --- a/container/grpc/service_frostfs_test.go +++ b/container/grpc/service_frostfs_test.go @@ -89,3 +89,23 @@ func FuzzJSONListResponse(f *testing.F) { DoFuzzJSONListResponse(data) }) } +func FuzzProtoListStreamRequest(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzProtoListStreamRequest(data) + }) +} +func FuzzJSONListStreamRequest(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzJSONListStreamRequest(data) + }) +} +func FuzzProtoListStreamResponse(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzProtoListStreamResponse(data) + }) +} +func FuzzJSONListStreamResponse(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte) { + DoFuzzJSONListStreamResponse(data) + }) +} diff --git a/container/grpc/service_grpc.pb.go b/container/grpc/service_grpc.pb.go index abb0fef..a23bbbe 100644 Binary files a/container/grpc/service_grpc.pb.go and b/container/grpc/service_grpc.pb.go differ diff --git a/container/grpc/types_frostfs.pb.go b/container/grpc/types_frostfs.pb.go index a4f0882..e5da35f 100644 Binary files a/container/grpc/types_frostfs.pb.go and b/container/grpc/types_frostfs.pb.go differ diff --git a/container/marshal.go b/container/marshal.go index 7c9b8ef..0b90afe 100644 --- a/container/marshal.go +++ b/container/marshal.go @@ -343,3 +343,65 @@ func (r *ListResponseBody) StableSize() (size int) { func (r *ListResponseBody) Unmarshal(data []byte) error { return message.Unmarshal(r, data, new(container.ListResponse_Body)) } + +func (r *ListStreamRequestBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + protoutil.NestedStructureMarshal(listReqBodyOwnerField, buf, r.ownerID) + + return buf +} + +func (r *ListStreamRequestBody) StableSize() (size int) { + if r == nil { + return 0 + } + + size += protoutil.NestedStructureSize(listReqBodyOwnerField, r.ownerID) + + return size +} + +func (r *ListStreamRequestBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(container.ListStreamRequest_Body)) +} + +func (r *ListStreamResponseBody) StableMarshal(buf []byte) []byte { + if r == nil { + return []byte{} + } + + if buf == nil { + buf = make([]byte, r.StableSize()) + } + + var offset int + + for i := range r.cidList { + offset += protoutil.NestedStructureMarshal(listRespBodyIDsField, buf[offset:], &r.cidList[i]) + } + + return buf +} + +func (r *ListStreamResponseBody) StableSize() (size int) { + if r == nil { + return 0 + } + + for i := range r.cidList { + size += protoutil.NestedStructureSize(listRespBodyIDsField, &r.cidList[i]) + } + + return size +} + +func (r *ListStreamResponseBody) Unmarshal(data []byte) error { + return message.Unmarshal(r, data, new(container.ListStreamResponse_Body)) +} diff --git a/container/types.go b/container/types.go index 6adc57b..673c7e9 100644 --- a/container/types.go +++ b/container/types.go @@ -109,6 +109,26 @@ type ListResponse struct { session.ResponseHeaders } +type ListStreamRequestBody struct { + ownerID *refs.OwnerID +} + +type ListStreamRequest struct { + body *ListStreamRequestBody + + session.RequestHeaders +} + +type ListStreamResponseBody struct { + cidList []refs.ContainerID +} + +type ListStreamResponse struct { + body *ListStreamResponseBody + + session.ResponseHeaders +} + func (a *Attribute) GetKey() string { if a != nil { return a.key @@ -444,3 +464,51 @@ func (r *ListResponse) GetBody() *ListResponseBody { func (r *ListResponse) SetBody(v *ListResponseBody) { r.body = v } + +func (r *ListStreamRequestBody) GetOwnerID() *refs.OwnerID { + if r != nil { + return r.ownerID + } + + return nil +} + +func (r *ListStreamRequestBody) SetOwnerID(v *refs.OwnerID) { + r.ownerID = v +} + +func (r *ListStreamRequest) GetBody() *ListStreamRequestBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *ListStreamRequest) SetBody(v *ListStreamRequestBody) { + r.body = v +} + +func (r *ListStreamResponseBody) GetContainerIDs() []refs.ContainerID { + if r != nil { + return r.cidList + } + + return nil +} + +func (r *ListStreamResponseBody) SetContainerIDs(v []refs.ContainerID) { + r.cidList = v +} + +func (r *ListStreamResponse) GetBody() *ListStreamResponseBody { + if r != nil { + return r.body + } + + return nil +} + +func (r *ListStreamResponse) SetBody(v *ListStreamResponseBody) { + r.body = v +} diff --git a/lock/grpc/types_frostfs.pb.go b/lock/grpc/types_frostfs.pb.go index 004a01f..33f22c5 100644 Binary files a/lock/grpc/types_frostfs.pb.go and b/lock/grpc/types_frostfs.pb.go differ diff --git a/netmap/grpc/service_frostfs.pb.go b/netmap/grpc/service_frostfs.pb.go index 9ebbf98..4d53031 100644 Binary files a/netmap/grpc/service_frostfs.pb.go and b/netmap/grpc/service_frostfs.pb.go differ diff --git a/netmap/grpc/types_frostfs.pb.go b/netmap/grpc/types_frostfs.pb.go index 24003c6..a4b10f9 100644 Binary files a/netmap/grpc/types_frostfs.pb.go and b/netmap/grpc/types_frostfs.pb.go differ diff --git a/object/grpc/service_frostfs.pb.go b/object/grpc/service_frostfs.pb.go index a55a41b..f934f3b 100644 Binary files a/object/grpc/service_frostfs.pb.go and b/object/grpc/service_frostfs.pb.go differ diff --git a/object/grpc/types_frostfs.pb.go b/object/grpc/types_frostfs.pb.go index a6d4f01..0ee939a 100644 Binary files a/object/grpc/types_frostfs.pb.go and b/object/grpc/types_frostfs.pb.go differ diff --git a/refs/grpc/types_frostfs.pb.go b/refs/grpc/types_frostfs.pb.go index f2a2663..3ed647c 100644 Binary files a/refs/grpc/types_frostfs.pb.go and b/refs/grpc/types_frostfs.pb.go differ diff --git a/rpc/container.go b/rpc/container.go index b1d4a68..5eec1eb 100644 --- a/rpc/container.go +++ b/rpc/container.go @@ -13,6 +13,7 @@ const ( rpcContainerGet = "Get" rpcContainerDel = "Delete" rpcContainerList = "List" + rpcContainerStream = "ListStream" rpcContainerGetEACL = "GetExtendedACL" rpcContainerUsedSpace = "AnnounceUsedSpace" ) @@ -80,3 +81,27 @@ func ListContainers( return resp, nil } + +type ListStreamResponseReader struct { + r client.MessageReader +} + +func (r *ListStreamResponseReader) Read(resp *container.ListStreamResponse) error { + return r.r.ReadMessage(resp) +} + +// ListContainersStream executes ContainerService.ListStream RPC. +func ListContainersStream( + cli *client.Client, + req *container.ListStreamRequest, + opts ...client.CallOption, +) (*ListStreamResponseReader, error) { + wc, err := client.OpenServerStream(cli, common.CallMethodInfoServerStream(serviceContainer, rpcContainerList), req, opts...) + if err != nil { + return nil, err + } + + return &ListStreamResponseReader{ + r: wc, + }, nil +} diff --git a/session/grpc/service_frostfs.pb.go b/session/grpc/service_frostfs.pb.go index 26213b9..c71325a 100644 Binary files a/session/grpc/service_frostfs.pb.go and b/session/grpc/service_frostfs.pb.go differ diff --git a/session/grpc/types_frostfs.pb.go b/session/grpc/types_frostfs.pb.go index 542a02b..e18c1ab 100644 Binary files a/session/grpc/types_frostfs.pb.go and b/session/grpc/types_frostfs.pb.go differ diff --git a/signature/body.go b/signature/body.go index b1a5904..92a73ce 100644 --- a/signature/body.go +++ b/signature/body.go @@ -46,6 +46,10 @@ func serviceMessageBody(req any) stableMarshaler { return v.GetBody() case *container.ListResponse: return v.GetBody() + case *container.ListStreamRequest: + return v.GetBody() + case *container.ListStreamResponse: + return v.GetBody() /* Object */ case *object.PutRequest: diff --git a/status/grpc/types_frostfs.pb.go b/status/grpc/types_frostfs.pb.go index 6c62a0f..609fc03 100644 Binary files a/status/grpc/types_frostfs.pb.go and b/status/grpc/types_frostfs.pb.go differ diff --git a/tombstone/grpc/types_frostfs.pb.go b/tombstone/grpc/types_frostfs.pb.go index e56832a..e5b67d5 100644 Binary files a/tombstone/grpc/types_frostfs.pb.go and b/tombstone/grpc/types_frostfs.pb.go differ