container: Add ListStream method #291
|
@ -762,3 +762,138 @@ func (r *ListResponse) FromGRPCMessage(m grpc.Message) error {
|
||||||
|
|
||||||
return r.ResponseHeaders.FromMessage(v)
|
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)
|
||||||
|
}
|
||||||
|
|
769
api/container/grpc/service_frostfs.pb.go
generated
|
@ -3155,3 +3155,772 @@ func (x *ListResponse) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||||
in.Consumed()
|
in.Consumed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ListStreamRequest_Body struct {
|
||||||
|
OwnerId *grpc.OwnerID `json:"ownerId"`
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ encoding.ProtoMarshaler = (*ListStreamRequest_Body)(nil)
|
||||||
|
_ encoding.ProtoUnmarshaler = (*ListStreamRequest_Body)(nil)
|
||||||
|
_ json.Marshaler = (*ListStreamRequest_Body)(nil)
|
||||||
|
_ json.Unmarshaler = (*ListStreamRequest_Body)(nil)
|
||||||
|
)
|
||||||
|
|
||||||
|
// StableSize returns the size of x in protobuf format.
|
||||||
|
//
|
||||||
|
// Structures with the same field values have the same binary size.
|
||||||
|
func (x *ListStreamRequest_Body) StableSize() (size int) {
|
||||||
|
if x == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
size += proto.NestedStructureSize(1, x.OwnerId)
|
||||||
|
return size
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
||||||
|
func (x *ListStreamRequest_Body) MarshalProtobuf(dst []byte) []byte {
|
||||||
|
m := pool.MarshalerPool.Get()
|
||||||
|
defer pool.MarshalerPool.Put(m)
|
||||||
|
x.EmitProtobuf(m.MessageMarshaler())
|
||||||
|
dst = m.Marshal(dst)
|
||||||
|
return dst
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ListStreamRequest_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
||||||
|
if x == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if x.OwnerId != nil {
|
||||||
|
x.OwnerId.EmitProtobuf(mm.AppendMessage(1))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
||||||
|
func (x *ListStreamRequest_Body) UnmarshalProtobuf(src []byte) (err error) {
|
||||||
|
var fc easyproto.FieldContext
|
||||||
|
for len(src) > 0 {
|
||||||
|
src, err = fc.NextField(src)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("cannot read next field in %s", "ListStreamRequest_Body")
|
||||||
|
}
|
||||||
|
switch fc.FieldNum {
|
||||||
|
case 1: // OwnerId
|
||||||
|
data, ok := fc.MessageData()
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("cannot unmarshal field %s", "OwnerId")
|
||||||
|
}
|
||||||
|
x.OwnerId = new(grpc.OwnerID)
|
||||||
|
if err := x.OwnerId.UnmarshalProtobuf(data); err != nil {
|
||||||
|
return fmt.Errorf("unmarshal: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (x *ListStreamRequest_Body) GetOwnerId() *grpc.OwnerID {
|
||||||
|
if x != nil {
|
||||||
|
return x.OwnerId
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (x *ListStreamRequest_Body) SetOwnerId(v *grpc.OwnerID) {
|
||||||
|
x.OwnerId = v
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON implements the json.Marshaler interface.
|
||||||
|
func (x *ListStreamRequest_Body) MarshalJSON() ([]byte, error) {
|
||||||
|
w := jwriter.Writer{}
|
||||||
|
x.MarshalEasyJSON(&w)
|
||||||
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
|
}
|
||||||
|
func (x *ListStreamRequest_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
||||||
|
if x == nil {
|
||||||
|
out.RawString("null")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
first := true
|
||||||
|
out.RawByte('{')
|
||||||
|
{
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
} else {
|
||||||
|
first = false
|
||||||
|
}
|
||||||
|
const prefix string = "\"ownerId\":"
|
||||||
|
out.RawString(prefix)
|
||||||
|
x.OwnerId.MarshalEasyJSON(out)
|
||||||
|
}
|
||||||
|
out.RawByte('}')
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
||||||
|
func (x *ListStreamRequest_Body) UnmarshalJSON(data []byte) error {
|
||||||
|
r := jlexer.Lexer{Data: data}
|
||||||
|
x.UnmarshalEasyJSON(&r)
|
||||||
|
return r.Error()
|
||||||
|
}
|
||||||
|
func (x *ListStreamRequest_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||||
|
isTopLevel := in.IsStart()
|
||||||
|
if in.IsNull() {
|
||||||
|
if isTopLevel {
|
||||||
|
in.Consumed()
|
||||||
|
}
|
||||||
|
in.Skip()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
in.Delim('{')
|
||||||
|
for !in.IsDelim('}') {
|
||||||
|
key := in.UnsafeFieldName(false)
|
||||||
|
in.WantColon()
|
||||||
|
if in.IsNull() {
|
||||||
|
in.Skip()
|
||||||
|
in.WantComma()
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
switch key {
|
||||||
|
case "ownerId":
|
||||||
|
{
|
||||||
|
var f *grpc.OwnerID
|
||||||
|
f = new(grpc.OwnerID)
|
||||||
|
f.UnmarshalEasyJSON(in)
|
||||||
|
x.OwnerId = f
|
||||||
|
}
|
||||||
|
}
|
||||||
|
in.WantComma()
|
||||||
|
}
|
||||||
|
in.Delim('}')
|
||||||
|
if isTopLevel {
|
||||||
|
in.Consumed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type ListStreamRequest struct {
|
||||||
|
Body *ListStreamRequest_Body `json:"body"`
|
||||||
|
MetaHeader *grpc1.RequestMetaHeader `json:"metaHeader"`
|
||||||
|
VerifyHeader *grpc1.RequestVerificationHeader `json:"verifyHeader"`
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ encoding.ProtoMarshaler = (*ListStreamRequest)(nil)
|
||||||
|
_ encoding.ProtoUnmarshaler = (*ListStreamRequest)(nil)
|
||||||
|
_ json.Marshaler = (*ListStreamRequest)(nil)
|
||||||
|
_ json.Unmarshaler = (*ListStreamRequest)(nil)
|
||||||
|
)
|
||||||
|
|
||||||
|
// StableSize returns the size of x in protobuf format.
|
||||||
|
//
|
||||||
|
// Structures with the same field values have the same binary size.
|
||||||
|
func (x *ListStreamRequest) StableSize() (size int) {
|
||||||
|
if x == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
size += proto.NestedStructureSize(1, x.Body)
|
||||||
|
size += proto.NestedStructureSize(2, x.MetaHeader)
|
||||||
|
size += proto.NestedStructureSize(3, x.VerifyHeader)
|
||||||
|
return size
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadSignedData fills buf with signed data of x.
|
||||||
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
||||||
|
//
|
||||||
|
// Returns any error encountered which did not allow writing the data completely.
|
||||||
|
// Otherwise, returns the buffer in which the data is written.
|
||||||
|
//
|
||||||
|
// Structures with the same field values have the same signed data.
|
||||||
|
func (x *ListStreamRequest) SignedDataSize() int {
|
||||||
|
return x.GetBody().StableSize()
|
||||||
|
}
|
||||||
|
|
||||||
|
// SignedDataSize returns size of the request signed data in bytes.
|
||||||
|
//
|
||||||
|
// Structures with the same field values have the same signed data size.
|
||||||
|
func (x *ListStreamRequest) ReadSignedData(buf []byte) ([]byte, error) {
|
||||||
|
return x.GetBody().MarshalProtobuf(buf), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
||||||
|
func (x *ListStreamRequest) MarshalProtobuf(dst []byte) []byte {
|
||||||
|
m := pool.MarshalerPool.Get()
|
||||||
|
defer pool.MarshalerPool.Put(m)
|
||||||
|
x.EmitProtobuf(m.MessageMarshaler())
|
||||||
|
dst = m.Marshal(dst)
|
||||||
|
return dst
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ListStreamRequest) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
||||||
|
if x == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if x.Body != nil {
|
||||||
|
x.Body.EmitProtobuf(mm.AppendMessage(1))
|
||||||
|
}
|
||||||
|
if x.MetaHeader != nil {
|
||||||
|
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
|
||||||
|
}
|
||||||
|
if x.VerifyHeader != nil {
|
||||||
|
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
||||||
|
func (x *ListStreamRequest) UnmarshalProtobuf(src []byte) (err error) {
|
||||||
|
var fc easyproto.FieldContext
|
||||||
|
for len(src) > 0 {
|
||||||
|
src, err = fc.NextField(src)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("cannot read next field in %s", "ListStreamRequest")
|
||||||
|
}
|
||||||
|
switch fc.FieldNum {
|
||||||
|
case 1: // Body
|
||||||
|
data, ok := fc.MessageData()
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("cannot unmarshal field %s", "Body")
|
||||||
|
}
|
||||||
|
x.Body = new(ListStreamRequest_Body)
|
||||||
|
if err := x.Body.UnmarshalProtobuf(data); err != nil {
|
||||||
|
return fmt.Errorf("unmarshal: %w", err)
|
||||||
|
}
|
||||||
|
case 2: // MetaHeader
|
||||||
|
data, ok := fc.MessageData()
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
|
||||||
|
}
|
||||||
|
x.MetaHeader = new(grpc1.RequestMetaHeader)
|
||||||
|
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
|
||||||
|
return fmt.Errorf("unmarshal: %w", err)
|
||||||
|
}
|
||||||
|
case 3: // VerifyHeader
|
||||||
|
data, ok := fc.MessageData()
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
|
||||||
|
}
|
||||||
|
x.VerifyHeader = new(grpc1.RequestVerificationHeader)
|
||||||
|
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
|
||||||
|
return fmt.Errorf("unmarshal: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (x *ListStreamRequest) GetBody() *ListStreamRequest_Body {
|
||||||
|
if x != nil {
|
||||||
|
return x.Body
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (x *ListStreamRequest) SetBody(v *ListStreamRequest_Body) {
|
||||||
|
x.Body = v
|
||||||
|
}
|
||||||
|
func (x *ListStreamRequest) GetMetaHeader() *grpc1.RequestMetaHeader {
|
||||||
|
if x != nil {
|
||||||
|
return x.MetaHeader
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (x *ListStreamRequest) SetMetaHeader(v *grpc1.RequestMetaHeader) {
|
||||||
|
x.MetaHeader = v
|
||||||
|
}
|
||||||
|
func (x *ListStreamRequest) GetVerifyHeader() *grpc1.RequestVerificationHeader {
|
||||||
|
if x != nil {
|
||||||
|
return x.VerifyHeader
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (x *ListStreamRequest) SetVerifyHeader(v *grpc1.RequestVerificationHeader) {
|
||||||
|
x.VerifyHeader = v
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON implements the json.Marshaler interface.
|
||||||
|
func (x *ListStreamRequest) MarshalJSON() ([]byte, error) {
|
||||||
|
w := jwriter.Writer{}
|
||||||
|
x.MarshalEasyJSON(&w)
|
||||||
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
|
}
|
||||||
|
func (x *ListStreamRequest) MarshalEasyJSON(out *jwriter.Writer) {
|
||||||
|
if x == nil {
|
||||||
|
out.RawString("null")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
first := true
|
||||||
|
out.RawByte('{')
|
||||||
|
{
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
} else {
|
||||||
|
first = false
|
||||||
|
}
|
||||||
|
const prefix string = "\"body\":"
|
||||||
|
out.RawString(prefix)
|
||||||
|
x.Body.MarshalEasyJSON(out)
|
||||||
|
}
|
||||||
|
{
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
} else {
|
||||||
|
first = false
|
||||||
|
}
|
||||||
|
const prefix string = "\"metaHeader\":"
|
||||||
|
out.RawString(prefix)
|
||||||
|
x.MetaHeader.MarshalEasyJSON(out)
|
||||||
|
}
|
||||||
|
{
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
} else {
|
||||||
|
first = false
|
||||||
|
}
|
||||||
|
const prefix string = "\"verifyHeader\":"
|
||||||
|
out.RawString(prefix)
|
||||||
|
x.VerifyHeader.MarshalEasyJSON(out)
|
||||||
|
}
|
||||||
|
out.RawByte('}')
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
||||||
|
func (x *ListStreamRequest) UnmarshalJSON(data []byte) error {
|
||||||
|
r := jlexer.Lexer{Data: data}
|
||||||
|
x.UnmarshalEasyJSON(&r)
|
||||||
|
return r.Error()
|
||||||
|
}
|
||||||
|
func (x *ListStreamRequest) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||||
|
isTopLevel := in.IsStart()
|
||||||
|
if in.IsNull() {
|
||||||
|
if isTopLevel {
|
||||||
|
in.Consumed()
|
||||||
|
}
|
||||||
|
in.Skip()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
in.Delim('{')
|
||||||
|
for !in.IsDelim('}') {
|
||||||
|
key := in.UnsafeFieldName(false)
|
||||||
|
in.WantColon()
|
||||||
|
if in.IsNull() {
|
||||||
|
in.Skip()
|
||||||
|
in.WantComma()
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
switch key {
|
||||||
|
case "body":
|
||||||
|
{
|
||||||
|
var f *ListStreamRequest_Body
|
||||||
|
f = new(ListStreamRequest_Body)
|
||||||
|
f.UnmarshalEasyJSON(in)
|
||||||
|
x.Body = f
|
||||||
|
}
|
||||||
|
case "metaHeader":
|
||||||
|
{
|
||||||
|
var f *grpc1.RequestMetaHeader
|
||||||
|
f = new(grpc1.RequestMetaHeader)
|
||||||
|
f.UnmarshalEasyJSON(in)
|
||||||
|
x.MetaHeader = f
|
||||||
|
}
|
||||||
|
case "verifyHeader":
|
||||||
|
{
|
||||||
|
var f *grpc1.RequestVerificationHeader
|
||||||
|
f = new(grpc1.RequestVerificationHeader)
|
||||||
|
f.UnmarshalEasyJSON(in)
|
||||||
|
x.VerifyHeader = f
|
||||||
|
}
|
||||||
|
}
|
||||||
|
in.WantComma()
|
||||||
|
}
|
||||||
|
in.Delim('}')
|
||||||
|
if isTopLevel {
|
||||||
|
in.Consumed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type ListStreamResponse_Body struct {
|
||||||
|
ContainerIds []grpc.ContainerID `json:"containerIds"`
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ encoding.ProtoMarshaler = (*ListStreamResponse_Body)(nil)
|
||||||
|
_ encoding.ProtoUnmarshaler = (*ListStreamResponse_Body)(nil)
|
||||||
|
_ json.Marshaler = (*ListStreamResponse_Body)(nil)
|
||||||
|
_ json.Unmarshaler = (*ListStreamResponse_Body)(nil)
|
||||||
|
)
|
||||||
|
|
||||||
|
// StableSize returns the size of x in protobuf format.
|
||||||
|
//
|
||||||
|
// Structures with the same field values have the same binary size.
|
||||||
|
func (x *ListStreamResponse_Body) StableSize() (size int) {
|
||||||
|
if x == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
for i := range x.ContainerIds {
|
||||||
|
size += proto.NestedStructureSizeUnchecked(1, &x.ContainerIds[i])
|
||||||
|
}
|
||||||
|
return size
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
||||||
|
func (x *ListStreamResponse_Body) MarshalProtobuf(dst []byte) []byte {
|
||||||
|
m := pool.MarshalerPool.Get()
|
||||||
|
defer pool.MarshalerPool.Put(m)
|
||||||
|
x.EmitProtobuf(m.MessageMarshaler())
|
||||||
|
dst = m.Marshal(dst)
|
||||||
|
return dst
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ListStreamResponse_Body) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
||||||
|
if x == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for i := range x.ContainerIds {
|
||||||
|
x.ContainerIds[i].EmitProtobuf(mm.AppendMessage(1))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
||||||
|
func (x *ListStreamResponse_Body) UnmarshalProtobuf(src []byte) (err error) {
|
||||||
|
var fc easyproto.FieldContext
|
||||||
|
for len(src) > 0 {
|
||||||
|
src, err = fc.NextField(src)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("cannot read next field in %s", "ListStreamResponse_Body")
|
||||||
|
}
|
||||||
|
switch fc.FieldNum {
|
||||||
|
case 1: // ContainerIds
|
||||||
|
data, ok := fc.MessageData()
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("cannot unmarshal field %s", "ContainerIds")
|
||||||
|
}
|
||||||
|
x.ContainerIds = append(x.ContainerIds, grpc.ContainerID{})
|
||||||
|
ff := &x.ContainerIds[len(x.ContainerIds)-1]
|
||||||
|
if err := ff.UnmarshalProtobuf(data); err != nil {
|
||||||
|
return fmt.Errorf("unmarshal: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (x *ListStreamResponse_Body) GetContainerIds() []grpc.ContainerID {
|
||||||
|
if x != nil {
|
||||||
|
return x.ContainerIds
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (x *ListStreamResponse_Body) SetContainerIds(v []grpc.ContainerID) {
|
||||||
|
x.ContainerIds = v
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON implements the json.Marshaler interface.
|
||||||
|
func (x *ListStreamResponse_Body) MarshalJSON() ([]byte, error) {
|
||||||
|
w := jwriter.Writer{}
|
||||||
|
x.MarshalEasyJSON(&w)
|
||||||
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
|
}
|
||||||
|
func (x *ListStreamResponse_Body) MarshalEasyJSON(out *jwriter.Writer) {
|
||||||
|
if x == nil {
|
||||||
|
out.RawString("null")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
first := true
|
||||||
|
out.RawByte('{')
|
||||||
|
{
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
} else {
|
||||||
|
first = false
|
||||||
|
}
|
||||||
|
const prefix string = "\"containerIds\":"
|
||||||
|
out.RawString(prefix)
|
||||||
|
out.RawByte('[')
|
||||||
|
for i := range x.ContainerIds {
|
||||||
|
if i != 0 {
|
||||||
|
out.RawByte(',')
|
||||||
|
}
|
||||||
|
x.ContainerIds[i].MarshalEasyJSON(out)
|
||||||
|
}
|
||||||
|
out.RawByte(']')
|
||||||
|
}
|
||||||
|
out.RawByte('}')
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
||||||
|
func (x *ListStreamResponse_Body) UnmarshalJSON(data []byte) error {
|
||||||
|
r := jlexer.Lexer{Data: data}
|
||||||
|
x.UnmarshalEasyJSON(&r)
|
||||||
|
return r.Error()
|
||||||
|
}
|
||||||
|
func (x *ListStreamResponse_Body) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||||
|
isTopLevel := in.IsStart()
|
||||||
|
if in.IsNull() {
|
||||||
|
if isTopLevel {
|
||||||
|
in.Consumed()
|
||||||
|
}
|
||||||
|
in.Skip()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
in.Delim('{')
|
||||||
|
for !in.IsDelim('}') {
|
||||||
|
key := in.UnsafeFieldName(false)
|
||||||
|
in.WantColon()
|
||||||
|
if in.IsNull() {
|
||||||
|
in.Skip()
|
||||||
|
in.WantComma()
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
switch key {
|
||||||
|
case "containerIds":
|
||||||
|
{
|
||||||
|
var f grpc.ContainerID
|
||||||
|
var list []grpc.ContainerID
|
||||||
|
in.Delim('[')
|
||||||
|
for !in.IsDelim(']') {
|
||||||
|
f = grpc.ContainerID{}
|
||||||
|
f.UnmarshalEasyJSON(in)
|
||||||
|
list = append(list, f)
|
||||||
|
in.WantComma()
|
||||||
|
}
|
||||||
|
x.ContainerIds = list
|
||||||
|
in.Delim(']')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
in.WantComma()
|
||||||
|
}
|
||||||
|
in.Delim('}')
|
||||||
|
if isTopLevel {
|
||||||
|
in.Consumed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type ListStreamResponse struct {
|
||||||
|
Body *ListStreamResponse_Body `json:"body"`
|
||||||
|
MetaHeader *grpc1.ResponseMetaHeader `json:"metaHeader"`
|
||||||
|
VerifyHeader *grpc1.ResponseVerificationHeader `json:"verifyHeader"`
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ encoding.ProtoMarshaler = (*ListStreamResponse)(nil)
|
||||||
|
_ encoding.ProtoUnmarshaler = (*ListStreamResponse)(nil)
|
||||||
|
_ json.Marshaler = (*ListStreamResponse)(nil)
|
||||||
|
_ json.Unmarshaler = (*ListStreamResponse)(nil)
|
||||||
|
)
|
||||||
|
|
||||||
|
// StableSize returns the size of x in protobuf format.
|
||||||
|
//
|
||||||
|
// Structures with the same field values have the same binary size.
|
||||||
|
func (x *ListStreamResponse) StableSize() (size int) {
|
||||||
|
if x == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
size += proto.NestedStructureSize(1, x.Body)
|
||||||
|
size += proto.NestedStructureSize(2, x.MetaHeader)
|
||||||
|
size += proto.NestedStructureSize(3, x.VerifyHeader)
|
||||||
|
return size
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadSignedData fills buf with signed data of x.
|
||||||
|
// If buffer length is less than x.SignedDataSize(), new buffer is allocated.
|
||||||
|
//
|
||||||
|
// Returns any error encountered which did not allow writing the data completely.
|
||||||
|
// Otherwise, returns the buffer in which the data is written.
|
||||||
|
//
|
||||||
|
// Structures with the same field values have the same signed data.
|
||||||
|
func (x *ListStreamResponse) SignedDataSize() int {
|
||||||
|
return x.GetBody().StableSize()
|
||||||
|
}
|
||||||
|
|
||||||
|
// SignedDataSize returns size of the request signed data in bytes.
|
||||||
|
//
|
||||||
|
// Structures with the same field values have the same signed data size.
|
||||||
|
func (x *ListStreamResponse) ReadSignedData(buf []byte) ([]byte, error) {
|
||||||
|
return x.GetBody().MarshalProtobuf(buf), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalProtobuf implements the encoding.ProtoMarshaler interface.
|
||||||
|
func (x *ListStreamResponse) MarshalProtobuf(dst []byte) []byte {
|
||||||
|
m := pool.MarshalerPool.Get()
|
||||||
|
defer pool.MarshalerPool.Put(m)
|
||||||
|
x.EmitProtobuf(m.MessageMarshaler())
|
||||||
|
dst = m.Marshal(dst)
|
||||||
|
return dst
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ListStreamResponse) EmitProtobuf(mm *easyproto.MessageMarshaler) {
|
||||||
|
if x == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if x.Body != nil {
|
||||||
|
x.Body.EmitProtobuf(mm.AppendMessage(1))
|
||||||
|
}
|
||||||
|
if x.MetaHeader != nil {
|
||||||
|
x.MetaHeader.EmitProtobuf(mm.AppendMessage(2))
|
||||||
|
}
|
||||||
|
if x.VerifyHeader != nil {
|
||||||
|
x.VerifyHeader.EmitProtobuf(mm.AppendMessage(3))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalProtobuf implements the encoding.ProtoUnmarshaler interface.
|
||||||
|
func (x *ListStreamResponse) UnmarshalProtobuf(src []byte) (err error) {
|
||||||
|
var fc easyproto.FieldContext
|
||||||
|
for len(src) > 0 {
|
||||||
|
src, err = fc.NextField(src)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("cannot read next field in %s", "ListStreamResponse")
|
||||||
|
}
|
||||||
|
switch fc.FieldNum {
|
||||||
|
case 1: // Body
|
||||||
|
data, ok := fc.MessageData()
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("cannot unmarshal field %s", "Body")
|
||||||
|
}
|
||||||
|
x.Body = new(ListStreamResponse_Body)
|
||||||
|
if err := x.Body.UnmarshalProtobuf(data); err != nil {
|
||||||
|
return fmt.Errorf("unmarshal: %w", err)
|
||||||
|
}
|
||||||
|
case 2: // MetaHeader
|
||||||
|
data, ok := fc.MessageData()
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("cannot unmarshal field %s", "MetaHeader")
|
||||||
|
}
|
||||||
|
x.MetaHeader = new(grpc1.ResponseMetaHeader)
|
||||||
|
if err := x.MetaHeader.UnmarshalProtobuf(data); err != nil {
|
||||||
|
return fmt.Errorf("unmarshal: %w", err)
|
||||||
|
}
|
||||||
|
case 3: // VerifyHeader
|
||||||
|
data, ok := fc.MessageData()
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("cannot unmarshal field %s", "VerifyHeader")
|
||||||
|
}
|
||||||
|
x.VerifyHeader = new(grpc1.ResponseVerificationHeader)
|
||||||
|
if err := x.VerifyHeader.UnmarshalProtobuf(data); err != nil {
|
||||||
|
return fmt.Errorf("unmarshal: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (x *ListStreamResponse) GetBody() *ListStreamResponse_Body {
|
||||||
|
if x != nil {
|
||||||
|
return x.Body
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (x *ListStreamResponse) SetBody(v *ListStreamResponse_Body) {
|
||||||
|
x.Body = v
|
||||||
|
}
|
||||||
|
func (x *ListStreamResponse) GetMetaHeader() *grpc1.ResponseMetaHeader {
|
||||||
|
if x != nil {
|
||||||
|
return x.MetaHeader
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (x *ListStreamResponse) SetMetaHeader(v *grpc1.ResponseMetaHeader) {
|
||||||
|
x.MetaHeader = v
|
||||||
|
}
|
||||||
|
func (x *ListStreamResponse) GetVerifyHeader() *grpc1.ResponseVerificationHeader {
|
||||||
|
if x != nil {
|
||||||
|
return x.VerifyHeader
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (x *ListStreamResponse) SetVerifyHeader(v *grpc1.ResponseVerificationHeader) {
|
||||||
|
x.VerifyHeader = v
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarshalJSON implements the json.Marshaler interface.
|
||||||
|
func (x *ListStreamResponse) MarshalJSON() ([]byte, error) {
|
||||||
|
w := jwriter.Writer{}
|
||||||
|
x.MarshalEasyJSON(&w)
|
||||||
|
return w.Buffer.BuildBytes(), w.Error
|
||||||
|
}
|
||||||
|
func (x *ListStreamResponse) MarshalEasyJSON(out *jwriter.Writer) {
|
||||||
|
if x == nil {
|
||||||
|
out.RawString("null")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
first := true
|
||||||
|
out.RawByte('{')
|
||||||
|
{
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
} else {
|
||||||
|
first = false
|
||||||
|
}
|
||||||
|
const prefix string = "\"body\":"
|
||||||
|
out.RawString(prefix)
|
||||||
|
x.Body.MarshalEasyJSON(out)
|
||||||
|
}
|
||||||
|
{
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
} else {
|
||||||
|
first = false
|
||||||
|
}
|
||||||
|
const prefix string = "\"metaHeader\":"
|
||||||
|
out.RawString(prefix)
|
||||||
|
x.MetaHeader.MarshalEasyJSON(out)
|
||||||
|
}
|
||||||
|
{
|
||||||
|
if !first {
|
||||||
|
out.RawByte(',')
|
||||||
|
} else {
|
||||||
|
first = false
|
||||||
|
}
|
||||||
|
const prefix string = "\"verifyHeader\":"
|
||||||
|
out.RawString(prefix)
|
||||||
|
x.VerifyHeader.MarshalEasyJSON(out)
|
||||||
|
}
|
||||||
|
out.RawByte('}')
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON implements the json.Unmarshaler interface.
|
||||||
|
func (x *ListStreamResponse) UnmarshalJSON(data []byte) error {
|
||||||
|
r := jlexer.Lexer{Data: data}
|
||||||
|
x.UnmarshalEasyJSON(&r)
|
||||||
|
return r.Error()
|
||||||
|
}
|
||||||
|
func (x *ListStreamResponse) UnmarshalEasyJSON(in *jlexer.Lexer) {
|
||||||
|
isTopLevel := in.IsStart()
|
||||||
|
if in.IsNull() {
|
||||||
|
if isTopLevel {
|
||||||
|
in.Consumed()
|
||||||
|
}
|
||||||
|
in.Skip()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
in.Delim('{')
|
||||||
|
for !in.IsDelim('}') {
|
||||||
|
key := in.UnsafeFieldName(false)
|
||||||
|
in.WantColon()
|
||||||
|
if in.IsNull() {
|
||||||
|
in.Skip()
|
||||||
|
in.WantComma()
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
switch key {
|
||||||
|
case "body":
|
||||||
|
{
|
||||||
|
var f *ListStreamResponse_Body
|
||||||
|
f = new(ListStreamResponse_Body)
|
||||||
|
f.UnmarshalEasyJSON(in)
|
||||||
|
x.Body = f
|
||||||
|
}
|
||||||
|
case "metaHeader":
|
||||||
|
{
|
||||||
|
var f *grpc1.ResponseMetaHeader
|
||||||
|
f = new(grpc1.ResponseMetaHeader)
|
||||||
|
f.UnmarshalEasyJSON(in)
|
||||||
|
x.MetaHeader = f
|
||||||
|
}
|
||||||
|
case "verifyHeader":
|
||||||
|
{
|
||||||
|
var f *grpc1.ResponseVerificationHeader
|
||||||
|
f = new(grpc1.ResponseVerificationHeader)
|
||||||
|
f.UnmarshalEasyJSON(in)
|
||||||
|
x.VerifyHeader = f
|
||||||
|
}
|
||||||
|
}
|
||||||
|
in.WantComma()
|
||||||
|
}
|
||||||
|
in.Delim('}')
|
||||||
|
if isTopLevel {
|
||||||
|
in.Consumed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -157,3 +157,41 @@ func DoFuzzJSONListResponse(data []byte) int {
|
||||||
}
|
}
|
||||||
return 1
|
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
|
||||||
|
}
|
||||||
|
|
|
@ -89,3 +89,23 @@ func FuzzJSONListResponse(f *testing.F) {
|
||||||
DoFuzzJSONListResponse(data)
|
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)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
89
api/container/grpc/service_grpc.pb.go
generated
|
@ -23,6 +23,7 @@ const (
|
||||||
ContainerService_Delete_FullMethodName = "/neo.fs.v2.container.ContainerService/Delete"
|
ContainerService_Delete_FullMethodName = "/neo.fs.v2.container.ContainerService/Delete"
|
||||||
ContainerService_Get_FullMethodName = "/neo.fs.v2.container.ContainerService/Get"
|
ContainerService_Get_FullMethodName = "/neo.fs.v2.container.ContainerService/Get"
|
||||||
ContainerService_List_FullMethodName = "/neo.fs.v2.container.ContainerService/List"
|
ContainerService_List_FullMethodName = "/neo.fs.v2.container.ContainerService/List"
|
||||||
|
ContainerService_ListStream_FullMethodName = "/neo.fs.v2.container.ContainerService/ListStream"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerServiceClient is the client API for ContainerService service.
|
// ContainerServiceClient is the client API for ContainerService service.
|
||||||
|
@ -64,7 +65,7 @@ type ContainerServiceClient interface {
|
||||||
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
|
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
|
||||||
// access to container is denied.
|
// access to container is denied.
|
||||||
Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error)
|
Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error)
|
||||||
// Returns all owner's containers from 'Container` smart contract' storage.
|
// Returns all owner's containers from `Container` smart contract storage.
|
||||||
//
|
//
|
||||||
// Statuses:
|
// Statuses:
|
||||||
// - **OK** (0, SECTION_SUCCESS): \
|
// - **OK** (0, SECTION_SUCCESS): \
|
||||||
|
@ -73,6 +74,16 @@ type ContainerServiceClient interface {
|
||||||
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
|
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
|
||||||
// container list access denied.
|
// container list access denied.
|
||||||
List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error)
|
List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error)
|
||||||
|
// Returns all owner's containers from `Container` smart contract storage
|
||||||
|
// via stream.
|
||||||
|
//
|
||||||
|
// Statuses:
|
||||||
|
// - **OK** (0, SECTION_SUCCESS): \
|
||||||
|
// container list has been successfully read;
|
||||||
|
// - Common failures (SECTION_FAILURE_COMMON);
|
||||||
|
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
|
||||||
|
// container list access denied.
|
||||||
|
ListStream(ctx context.Context, in *ListStreamRequest, opts ...grpc.CallOption) (ContainerService_ListStreamClient, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type containerServiceClient struct {
|
type containerServiceClient struct {
|
||||||
|
@ -119,6 +130,38 @@ func (c *containerServiceClient) List(ctx context.Context, in *ListRequest, opts
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *containerServiceClient) ListStream(ctx context.Context, in *ListStreamRequest, opts ...grpc.CallOption) (ContainerService_ListStreamClient, error) {
|
||||||
|
stream, err := c.cc.NewStream(ctx, &ContainerService_ServiceDesc.Streams[0], ContainerService_ListStream_FullMethodName, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
x := &containerServiceListStreamClient{stream}
|
||||||
|
if err := x.ClientStream.SendMsg(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if err := x.ClientStream.CloseSend(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return x, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type ContainerService_ListStreamClient interface {
|
||||||
|
Recv() (*ListStreamResponse, error)
|
||||||
|
grpc.ClientStream
|
||||||
|
}
|
||||||
|
|
||||||
|
type containerServiceListStreamClient struct {
|
||||||
|
grpc.ClientStream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *containerServiceListStreamClient) Recv() (*ListStreamResponse, error) {
|
||||||
|
m := new(ListStreamResponse)
|
||||||
|
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
// ContainerServiceServer is the server API for ContainerService service.
|
// ContainerServiceServer is the server API for ContainerService service.
|
||||||
// All implementations should embed UnimplementedContainerServiceServer
|
// All implementations should embed UnimplementedContainerServiceServer
|
||||||
// for forward compatibility
|
// for forward compatibility
|
||||||
|
@ -158,7 +201,7 @@ type ContainerServiceServer interface {
|
||||||
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
|
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
|
||||||
// access to container is denied.
|
// access to container is denied.
|
||||||
Get(context.Context, *GetRequest) (*GetResponse, error)
|
Get(context.Context, *GetRequest) (*GetResponse, error)
|
||||||
// Returns all owner's containers from 'Container` smart contract' storage.
|
// Returns all owner's containers from `Container` smart contract storage.
|
||||||
//
|
//
|
||||||
// Statuses:
|
// Statuses:
|
||||||
// - **OK** (0, SECTION_SUCCESS): \
|
// - **OK** (0, SECTION_SUCCESS): \
|
||||||
|
@ -167,6 +210,16 @@ type ContainerServiceServer interface {
|
||||||
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
|
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
|
||||||
// container list access denied.
|
// container list access denied.
|
||||||
List(context.Context, *ListRequest) (*ListResponse, error)
|
List(context.Context, *ListRequest) (*ListResponse, error)
|
||||||
|
// Returns all owner's containers from `Container` smart contract storage
|
||||||
|
// via stream.
|
||||||
|
//
|
||||||
|
// Statuses:
|
||||||
|
// - **OK** (0, SECTION_SUCCESS): \
|
||||||
|
// container list has been successfully read;
|
||||||
|
// - Common failures (SECTION_FAILURE_COMMON);
|
||||||
|
// - **CONTAINER_ACCESS_DENIED** (3074, SECTION_CONTAINER): \
|
||||||
|
// container list access denied.
|
||||||
|
ListStream(*ListStreamRequest, ContainerService_ListStreamServer) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnimplementedContainerServiceServer should be embedded to have forward compatible implementations.
|
// UnimplementedContainerServiceServer should be embedded to have forward compatible implementations.
|
||||||
|
@ -185,6 +238,9 @@ func (UnimplementedContainerServiceServer) Get(context.Context, *GetRequest) (*G
|
||||||
func (UnimplementedContainerServiceServer) List(context.Context, *ListRequest) (*ListResponse, error) {
|
func (UnimplementedContainerServiceServer) List(context.Context, *ListRequest) (*ListResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method List not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method List not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedContainerServiceServer) ListStream(*ListStreamRequest, ContainerService_ListStreamServer) error {
|
||||||
|
return status.Errorf(codes.Unimplemented, "method ListStream not implemented")
|
||||||
|
}
|
||||||
|
|
||||||
// UnsafeContainerServiceServer may be embedded to opt out of forward compatibility for this service.
|
// UnsafeContainerServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||||
// Use of this interface is not recommended, as added methods to ContainerServiceServer will
|
// Use of this interface is not recommended, as added methods to ContainerServiceServer will
|
||||||
|
@ -269,6 +325,27 @@ func _ContainerService_List_Handler(srv interface{}, ctx context.Context, dec fu
|
||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _ContainerService_ListStream_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||||
|
m := new(ListStreamRequest)
|
||||||
|
if err := stream.RecvMsg(m); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return srv.(ContainerServiceServer).ListStream(m, &containerServiceListStreamServer{stream})
|
||||||
|
}
|
||||||
|
|
||||||
|
type ContainerService_ListStreamServer interface {
|
||||||
|
Send(*ListStreamResponse) error
|
||||||
|
grpc.ServerStream
|
||||||
|
}
|
||||||
|
|
||||||
|
type containerServiceListStreamServer struct {
|
||||||
|
grpc.ServerStream
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *containerServiceListStreamServer) Send(m *ListStreamResponse) error {
|
||||||
|
return x.ServerStream.SendMsg(m)
|
||||||
|
}
|
||||||
|
|
||||||
// ContainerService_ServiceDesc is the grpc.ServiceDesc for ContainerService service.
|
// ContainerService_ServiceDesc is the grpc.ServiceDesc for ContainerService service.
|
||||||
// It's only intended for direct use with grpc.RegisterService,
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
// and not to be introspected or modified (even as a copy)
|
// and not to be introspected or modified (even as a copy)
|
||||||
|
@ -293,6 +370,12 @@ var ContainerService_ServiceDesc = grpc.ServiceDesc{
|
||||||
Handler: _ContainerService_List_Handler,
|
Handler: _ContainerService_List_Handler,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{
|
||||||
|
{
|
||||||
|
StreamName: "ListStream",
|
||||||
|
Handler: _ContainerService_ListStream_Handler,
|
||||||
|
ServerStreams: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
Metadata: "api/container/grpc/service.proto",
|
Metadata: "api/container/grpc/service.proto",
|
||||||
}
|
}
|
||||||
|
|
|
@ -343,3 +343,65 @@ func (r *ListResponseBody) StableSize() (size int) {
|
||||||
func (r *ListResponseBody) Unmarshal(data []byte) error {
|
func (r *ListResponseBody) Unmarshal(data []byte) error {
|
||||||
return message.Unmarshal(r, data, new(container.ListResponse_Body))
|
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))
|
||||||
|
}
|
||||||
|
|
|
@ -109,6 +109,26 @@ type ListResponse struct {
|
||||||
session.ResponseHeaders
|
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 {
|
func (a *Attribute) GetKey() string {
|
||||||
if a != nil {
|
if a != nil {
|
||||||
return a.key
|
return a.key
|
||||||
|
@ -444,3 +464,51 @@ func (r *ListResponse) GetBody() *ListResponseBody {
|
||||||
func (r *ListResponse) SetBody(v *ListResponseBody) {
|
func (r *ListResponse) SetBody(v *ListResponseBody) {
|
||||||
r.body = v
|
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
|
||||||
|
}
|
||||||
|
|
52
api/object/grpc/service_grpc.pb.go
generated
|
@ -42,11 +42,11 @@ type ObjectServiceClient interface {
|
||||||
// chunks keeping the receiving order.
|
// chunks keeping the receiving order.
|
||||||
//
|
//
|
||||||
// Extended headers can change `Get` behaviour:
|
// Extended headers can change `Get` behaviour:
|
||||||
// * [ __SYSTEM__NETMAP_EPOCH ] \
|
// - [ __SYSTEM__NETMAP_EPOCH ] \
|
||||||
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
||||||
// Will use the requsted version of Network Map for object placement
|
// Will use the requsted version of Network Map for object placement
|
||||||
// calculation.
|
// calculation.
|
||||||
// * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \
|
// - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \
|
||||||
// (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \
|
// (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \
|
||||||
// Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH`
|
// Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH`
|
||||||
// (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or the latest one
|
// (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or the latest one
|
||||||
|
@ -80,7 +80,7 @@ type ObjectServiceClient interface {
|
||||||
// Chunk messages SHOULD be sent in the direct order of fragmentation.
|
// Chunk messages SHOULD be sent in the direct order of fragmentation.
|
||||||
//
|
//
|
||||||
// Extended headers can change `Put` behaviour:
|
// Extended headers can change `Put` behaviour:
|
||||||
// * [ __SYSTEM__NETMAP_EPOCH \
|
// - [ __SYSTEM__NETMAP_EPOCH \
|
||||||
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
||||||
// Will use the requsted version of Network Map for object placement
|
// Will use the requsted version of Network Map for object placement
|
||||||
// calculation.
|
// calculation.
|
||||||
|
@ -106,6 +106,7 @@ type ObjectServiceClient interface {
|
||||||
// - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \
|
// - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \
|
||||||
// (for trusted object preparation) session private key does not exist or
|
// (for trusted object preparation) session private key does not exist or
|
||||||
// has
|
// has
|
||||||
|
//
|
||||||
// been deleted;
|
// been deleted;
|
||||||
// - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \
|
// - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \
|
||||||
// provided session token has expired.
|
// provided session token has expired.
|
||||||
|
@ -114,7 +115,7 @@ type ObjectServiceClient interface {
|
||||||
// guarantee. Object will be marked for removal and deleted eventually.
|
// guarantee. Object will be marked for removal and deleted eventually.
|
||||||
//
|
//
|
||||||
// Extended headers can change `Delete` behaviour:
|
// Extended headers can change `Delete` behaviour:
|
||||||
// * [ __SYSTEM__NETMAP_EPOCH ] \
|
// - [ __SYSTEM__NETMAP_EPOCH ] \
|
||||||
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
||||||
// Will use the requested version of Network Map for object placement
|
// Will use the requested version of Network Map for object placement
|
||||||
// calculation.
|
// calculation.
|
||||||
|
@ -144,7 +145,7 @@ type ObjectServiceClient interface {
|
||||||
// the very minimal information will be returned instead.
|
// the very minimal information will be returned instead.
|
||||||
//
|
//
|
||||||
// Extended headers can change `Head` behaviour:
|
// Extended headers can change `Head` behaviour:
|
||||||
// * [ __SYSTEM__NETMAP_EPOCH ] \
|
// - [ __SYSTEM__NETMAP_EPOCH ] \
|
||||||
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
||||||
// Will use the requested version of Network Map for object placement
|
// Will use the requested version of Network Map for object placement
|
||||||
// calculation.
|
// calculation.
|
||||||
|
@ -173,7 +174,7 @@ type ObjectServiceClient interface {
|
||||||
// Specification section for more details.
|
// Specification section for more details.
|
||||||
//
|
//
|
||||||
// Extended headers can change `Search` behaviour:
|
// Extended headers can change `Search` behaviour:
|
||||||
// * [ __SYSTEM__NETMAP_EPOCH ] \
|
// - [ __SYSTEM__NETMAP_EPOCH ] \
|
||||||
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
||||||
// Will use the requested version of Network Map for object placement
|
// Will use the requested version of Network Map for object placement
|
||||||
// calculation.
|
// calculation.
|
||||||
|
@ -199,11 +200,11 @@ type ObjectServiceClient interface {
|
||||||
// receiving order.
|
// receiving order.
|
||||||
//
|
//
|
||||||
// Extended headers can change `GetRange` behaviour:
|
// Extended headers can change `GetRange` behaviour:
|
||||||
// * [ __SYSTEM__NETMAP_EPOCH ] \
|
// - [ __SYSTEM__NETMAP_EPOCH ] \
|
||||||
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
||||||
// Will use the requested version of Network Map for object placement
|
// Will use the requested version of Network Map for object placement
|
||||||
// calculation.
|
// calculation.
|
||||||
// * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \
|
// - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \
|
||||||
// (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \
|
// (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \
|
||||||
// Will try older versions of Network Map to find an object until the depth
|
// Will try older versions of Network Map to find an object until the depth
|
||||||
// limit is reached.
|
// limit is reached.
|
||||||
|
@ -235,11 +236,11 @@ type ObjectServiceClient interface {
|
||||||
// the request. Note that hash is calculated for XORed data.
|
// the request. Note that hash is calculated for XORed data.
|
||||||
//
|
//
|
||||||
// Extended headers can change `GetRangeHash` behaviour:
|
// Extended headers can change `GetRangeHash` behaviour:
|
||||||
// * [ __SYSTEM__NETMAP_EPOCH ] \
|
// - [ __SYSTEM__NETMAP_EPOCH ] \
|
||||||
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
||||||
// Will use the requested version of Network Map for object placement
|
// Will use the requested version of Network Map for object placement
|
||||||
// calculation.
|
// calculation.
|
||||||
// * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \
|
// - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \
|
||||||
// (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \
|
// (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \
|
||||||
// Will try older versions of Network Map to find an object until the depth
|
// Will try older versions of Network Map to find an object until the depth
|
||||||
// limit is reached.
|
// limit is reached.
|
||||||
|
@ -268,7 +269,7 @@ type ObjectServiceClient interface {
|
||||||
// an object MUST be set.
|
// an object MUST be set.
|
||||||
//
|
//
|
||||||
// Extended headers can change `Put` behaviour:
|
// Extended headers can change `Put` behaviour:
|
||||||
// * [ __SYSTEM__NETMAP_EPOCH \
|
// - [ __SYSTEM__NETMAP_EPOCH \
|
||||||
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
||||||
// Will use the requested version of Network Map for object placement
|
// Will use the requested version of Network Map for object placement
|
||||||
// calculation.
|
// calculation.
|
||||||
|
@ -294,6 +295,7 @@ type ObjectServiceClient interface {
|
||||||
// - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \
|
// - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \
|
||||||
// (for trusted object preparation) session private key does not exist or
|
// (for trusted object preparation) session private key does not exist or
|
||||||
// has
|
// has
|
||||||
|
//
|
||||||
// been deleted;
|
// been deleted;
|
||||||
// - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \
|
// - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \
|
||||||
// provided session token has expired.
|
// provided session token has expired.
|
||||||
|
@ -317,7 +319,7 @@ type ObjectServiceClient interface {
|
||||||
// 3. The application of the same patches for the object a few times.
|
// 3. The application of the same patches for the object a few times.
|
||||||
//
|
//
|
||||||
// Extended headers can change `Patch` behaviour:
|
// Extended headers can change `Patch` behaviour:
|
||||||
// * [ __SYSTEM__NETMAP_EPOCH \
|
// - [ __SYSTEM__NETMAP_EPOCH \
|
||||||
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
||||||
// Will use the requsted version of Network Map for object placement
|
// Will use the requsted version of Network Map for object placement
|
||||||
// calculation.
|
// calculation.
|
||||||
|
@ -568,11 +570,11 @@ type ObjectServiceServer interface {
|
||||||
// chunks keeping the receiving order.
|
// chunks keeping the receiving order.
|
||||||
//
|
//
|
||||||
// Extended headers can change `Get` behaviour:
|
// Extended headers can change `Get` behaviour:
|
||||||
// * [ __SYSTEM__NETMAP_EPOCH ] \
|
// - [ __SYSTEM__NETMAP_EPOCH ] \
|
||||||
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
||||||
// Will use the requsted version of Network Map for object placement
|
// Will use the requsted version of Network Map for object placement
|
||||||
// calculation.
|
// calculation.
|
||||||
// * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \
|
// - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \
|
||||||
// (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \
|
// (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \
|
||||||
// Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH`
|
// Will try older versions (starting from `__SYSTEM__NETMAP_EPOCH`
|
||||||
// (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or the latest one
|
// (`__NEOFS__NETMAP_EPOCH` is deprecated) if specified or the latest one
|
||||||
|
@ -606,7 +608,7 @@ type ObjectServiceServer interface {
|
||||||
// Chunk messages SHOULD be sent in the direct order of fragmentation.
|
// Chunk messages SHOULD be sent in the direct order of fragmentation.
|
||||||
//
|
//
|
||||||
// Extended headers can change `Put` behaviour:
|
// Extended headers can change `Put` behaviour:
|
||||||
// * [ __SYSTEM__NETMAP_EPOCH \
|
// - [ __SYSTEM__NETMAP_EPOCH \
|
||||||
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
||||||
// Will use the requsted version of Network Map for object placement
|
// Will use the requsted version of Network Map for object placement
|
||||||
// calculation.
|
// calculation.
|
||||||
|
@ -632,6 +634,7 @@ type ObjectServiceServer interface {
|
||||||
// - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \
|
// - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \
|
||||||
// (for trusted object preparation) session private key does not exist or
|
// (for trusted object preparation) session private key does not exist or
|
||||||
// has
|
// has
|
||||||
|
//
|
||||||
// been deleted;
|
// been deleted;
|
||||||
// - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \
|
// - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \
|
||||||
// provided session token has expired.
|
// provided session token has expired.
|
||||||
|
@ -640,7 +643,7 @@ type ObjectServiceServer interface {
|
||||||
// guarantee. Object will be marked for removal and deleted eventually.
|
// guarantee. Object will be marked for removal and deleted eventually.
|
||||||
//
|
//
|
||||||
// Extended headers can change `Delete` behaviour:
|
// Extended headers can change `Delete` behaviour:
|
||||||
// * [ __SYSTEM__NETMAP_EPOCH ] \
|
// - [ __SYSTEM__NETMAP_EPOCH ] \
|
||||||
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
||||||
// Will use the requested version of Network Map for object placement
|
// Will use the requested version of Network Map for object placement
|
||||||
// calculation.
|
// calculation.
|
||||||
|
@ -670,7 +673,7 @@ type ObjectServiceServer interface {
|
||||||
// the very minimal information will be returned instead.
|
// the very minimal information will be returned instead.
|
||||||
//
|
//
|
||||||
// Extended headers can change `Head` behaviour:
|
// Extended headers can change `Head` behaviour:
|
||||||
// * [ __SYSTEM__NETMAP_EPOCH ] \
|
// - [ __SYSTEM__NETMAP_EPOCH ] \
|
||||||
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
||||||
// Will use the requested version of Network Map for object placement
|
// Will use the requested version of Network Map for object placement
|
||||||
// calculation.
|
// calculation.
|
||||||
|
@ -699,7 +702,7 @@ type ObjectServiceServer interface {
|
||||||
// Specification section for more details.
|
// Specification section for more details.
|
||||||
//
|
//
|
||||||
// Extended headers can change `Search` behaviour:
|
// Extended headers can change `Search` behaviour:
|
||||||
// * [ __SYSTEM__NETMAP_EPOCH ] \
|
// - [ __SYSTEM__NETMAP_EPOCH ] \
|
||||||
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
||||||
// Will use the requested version of Network Map for object placement
|
// Will use the requested version of Network Map for object placement
|
||||||
// calculation.
|
// calculation.
|
||||||
|
@ -725,11 +728,11 @@ type ObjectServiceServer interface {
|
||||||
// receiving order.
|
// receiving order.
|
||||||
//
|
//
|
||||||
// Extended headers can change `GetRange` behaviour:
|
// Extended headers can change `GetRange` behaviour:
|
||||||
// * [ __SYSTEM__NETMAP_EPOCH ] \
|
// - [ __SYSTEM__NETMAP_EPOCH ] \
|
||||||
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
||||||
// Will use the requested version of Network Map for object placement
|
// Will use the requested version of Network Map for object placement
|
||||||
// calculation.
|
// calculation.
|
||||||
// * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \
|
// - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \
|
||||||
// (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \
|
// (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \
|
||||||
// Will try older versions of Network Map to find an object until the depth
|
// Will try older versions of Network Map to find an object until the depth
|
||||||
// limit is reached.
|
// limit is reached.
|
||||||
|
@ -761,11 +764,11 @@ type ObjectServiceServer interface {
|
||||||
// the request. Note that hash is calculated for XORed data.
|
// the request. Note that hash is calculated for XORed data.
|
||||||
//
|
//
|
||||||
// Extended headers can change `GetRangeHash` behaviour:
|
// Extended headers can change `GetRangeHash` behaviour:
|
||||||
// * [ __SYSTEM__NETMAP_EPOCH ] \
|
// - [ __SYSTEM__NETMAP_EPOCH ] \
|
||||||
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
||||||
// Will use the requested version of Network Map for object placement
|
// Will use the requested version of Network Map for object placement
|
||||||
// calculation.
|
// calculation.
|
||||||
// * [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \
|
// - [ __SYSTEM__NETMAP_LOOKUP_DEPTH ] \
|
||||||
// (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \
|
// (`__NEOFS__NETMAP_LOOKUP_DEPTH` is deprecated) \
|
||||||
// Will try older versions of Network Map to find an object until the depth
|
// Will try older versions of Network Map to find an object until the depth
|
||||||
// limit is reached.
|
// limit is reached.
|
||||||
|
@ -794,7 +797,7 @@ type ObjectServiceServer interface {
|
||||||
// an object MUST be set.
|
// an object MUST be set.
|
||||||
//
|
//
|
||||||
// Extended headers can change `Put` behaviour:
|
// Extended headers can change `Put` behaviour:
|
||||||
// * [ __SYSTEM__NETMAP_EPOCH \
|
// - [ __SYSTEM__NETMAP_EPOCH \
|
||||||
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
||||||
// Will use the requested version of Network Map for object placement
|
// Will use the requested version of Network Map for object placement
|
||||||
// calculation.
|
// calculation.
|
||||||
|
@ -820,6 +823,7 @@ type ObjectServiceServer interface {
|
||||||
// - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \
|
// - **TOKEN_NOT_FOUND** (4096, SECTION_SESSION): \
|
||||||
// (for trusted object preparation) session private key does not exist or
|
// (for trusted object preparation) session private key does not exist or
|
||||||
// has
|
// has
|
||||||
|
//
|
||||||
// been deleted;
|
// been deleted;
|
||||||
// - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \
|
// - **TOKEN_EXPIRED** (4097, SECTION_SESSION): \
|
||||||
// provided session token has expired.
|
// provided session token has expired.
|
||||||
|
@ -843,7 +847,7 @@ type ObjectServiceServer interface {
|
||||||
// 3. The application of the same patches for the object a few times.
|
// 3. The application of the same patches for the object a few times.
|
||||||
//
|
//
|
||||||
// Extended headers can change `Patch` behaviour:
|
// Extended headers can change `Patch` behaviour:
|
||||||
// * [ __SYSTEM__NETMAP_EPOCH \
|
// - [ __SYSTEM__NETMAP_EPOCH \
|
||||||
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
// (`__NEOFS__NETMAP_EPOCH` is deprecated) \
|
||||||
// Will use the requsted version of Network Map for object placement
|
// Will use the requsted version of Network Map for object placement
|
||||||
// calculation.
|
// calculation.
|
||||||
|
|
|
@ -13,6 +13,7 @@ const (
|
||||||
rpcContainerGet = "Get"
|
rpcContainerGet = "Get"
|
||||||
rpcContainerDel = "Delete"
|
rpcContainerDel = "Delete"
|
||||||
rpcContainerList = "List"
|
rpcContainerList = "List"
|
||||||
|
rpcContainerStream = "ListStream"
|
||||||
rpcContainerGetEACL = "GetExtendedACL"
|
rpcContainerGetEACL = "GetExtendedACL"
|
||||||
rpcContainerUsedSpace = "AnnounceUsedSpace"
|
rpcContainerUsedSpace = "AnnounceUsedSpace"
|
||||||
)
|
)
|
||||||
|
@ -80,3 +81,27 @@ func ListContainers(
|
||||||
|
|
||||||
return resp, nil
|
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, rpcContainerStream), req, opts...)
|
||||||
|
|||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &ListStreamResponseReader{
|
||||||
|
r: wc,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
|
@ -46,6 +46,10 @@ func serviceMessageBody(req any) stableMarshaler {
|
||||||
return v.GetBody()
|
return v.GetBody()
|
||||||
case *container.ListResponse:
|
case *container.ListResponse:
|
||||||
return v.GetBody()
|
return v.GetBody()
|
||||||
|
case *container.ListStreamRequest:
|
||||||
|
return v.GetBody()
|
||||||
|
case *container.ListStreamResponse:
|
||||||
|
return v.GetBody()
|
||||||
|
|
||||||
/* Object */
|
/* Object */
|
||||||
case *object.PutRequest:
|
case *object.PutRequest:
|
||||||
|
|
|
@ -20,7 +20,7 @@ import (
|
||||||
type PrmContainerList struct {
|
type PrmContainerList struct {
|
||||||
XHeaders []string
|
XHeaders []string
|
||||||
|
|
||||||
Account user.ID
|
OwnerID user.ID
|
||||||
|
|
||||||
Session *session.Container
|
Session *session.Container
|
||||||
}
|
}
|
||||||
|
@ -28,18 +28,18 @@ type PrmContainerList struct {
|
||||||
// SetAccount sets identifier of the FrostFS account to list the containers.
|
// SetAccount sets identifier of the FrostFS account to list the containers.
|
||||||
// Required parameter.
|
// Required parameter.
|
||||||
//
|
//
|
||||||
// Deprecated: Use PrmContainerList.Account instead.
|
// Deprecated: Use PrmContainerList.OwnerID instead.
|
||||||
func (x *PrmContainerList) SetAccount(id user.ID) {
|
func (x *PrmContainerList) SetAccount(id user.ID) {
|
||||||
x.Account = id
|
x.OwnerID = id
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PrmContainerList) buildRequest(c *Client) (*v2container.ListRequest, error) {
|
func (x *PrmContainerList) buildRequest(c *Client) (*v2container.ListRequest, error) {
|
||||||
if x.Account.IsEmpty() {
|
if x.OwnerID.IsEmpty() {
|
||||||
return nil, errorAccountNotSet
|
return nil, errorAccountNotSet
|
||||||
}
|
}
|
||||||
|
|
||||||
var ownerV2 refs.OwnerID
|
var ownerV2 refs.OwnerID
|
||||||
x.Account.WriteToV2(&ownerV2)
|
x.OwnerID.WriteToV2(&ownerV2)
|
||||||
|
|
||||||
reqBody := new(v2container.ListRequestBody)
|
reqBody := new(v2container.ListRequestBody)
|
||||||
reqBody.SetOwnerID(&ownerV2)
|
reqBody.SetOwnerID(&ownerV2)
|
||||||
|
|
203
client/container_list_stream.go
Normal file
|
@ -0,0 +1,203 @@
|
||||||
|
package client
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
|
||||||
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/container"
|
||||||
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/refs"
|
||||||
|
rpcapi "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc"
|
||||||
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/rpc/client"
|
||||||
|
v2session "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/session"
|
||||||
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/signature"
|
||||||
|
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
|
||||||
|
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
|
||||||
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/session"
|
||||||
|
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PrmContainerListStream groups parameters of ContainerListStream operation.
|
||||||
|
type PrmContainerListStream struct {
|
||||||
|
XHeaders []string
|
||||||
|
|
||||||
|
OwnerID user.ID
|
||||||
aarifullin
commented
Please, leave a comment how this parameter is used :) Please, leave a comment how this parameter is used :)
elebedeva
commented
For request building, as in existing For request building, as in existing `Container.List`
aarifullin
commented
I meant - to leave a comment in the code :) to describe the field. But as far as I see you fixed the field's name. So, the comment is not required I meant - to leave a comment in the code :) to describe the field. But as far as I see you fixed the field's name. So, the comment is not required
|
|||||||
|
|
||||||
dstepanov-yadro marked this conversation as resolved
Outdated
dstepanov-yadro
commented
Maybe Maybe `Account` -> `OwnerID`?
fyrchik
commented
It should be the same as It should be the same as `PrmContainerList`.
Please, either use `Account` or rename `Account` to `OwnerID` in `PrmContainerList` (in a separate commit, of course).
elebedeva
commented
Fixed Fixed
|
|||||||
|
Session *session.Container
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *PrmContainerListStream) buildRequest(c *Client) (*container.ListStreamRequest, error) {
|
||||||
|
if x.OwnerID.IsEmpty() {
|
||||||
|
return nil, errorAccountNotSet
|
||||||
|
}
|
||||||
|
|
||||||
aarifullin marked this conversation as resolved
Outdated
aarifullin
commented
You can't get deprecated the method that has never been used as it's new :) So, you don't need this setter You can't get deprecated the method that has never been used as it's new :) So, you don't need this setter
elebedeva
commented
Removed! 🙈 Removed! 🙈
|
|||||||
|
var ownerV2 refs.OwnerID
|
||||||
|
x.OwnerID.WriteToV2(&ownerV2)
|
||||||
|
|
||||||
|
reqBody := new(container.ListStreamRequestBody)
|
||||||
|
reqBody.SetOwnerID(&ownerV2)
|
||||||
|
|
||||||
|
var meta v2session.RequestMetaHeader
|
||||||
|
writeXHeadersToMeta(x.XHeaders, &meta)
|
||||||
|
|
||||||
|
if x.Session != nil {
|
||||||
|
var tokv2 v2session.Token
|
||||||
|
x.Session.WriteToV2(&tokv2)
|
||||||
|
|
||||||
|
meta.SetSessionToken(&tokv2)
|
||||||
|
}
|
||||||
|
|
||||||
|
var req container.ListStreamRequest
|
||||||
|
req.SetBody(reqBody)
|
||||||
|
c.prepareRequest(&req, &meta)
|
||||||
|
return &req, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ResContainerListStream groups the final result values of ContainerListStream operation.
|
||||||
|
type ResContainerListStream struct {
|
||||||
|
statusRes
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContainerListReader is designed to read list of container identifiers from FrostFS system.
|
||||||
|
//
|
||||||
|
// Must be initialized using Client.ContainerListInit, any other usage is unsafe.
|
||||||
|
type ContainerListReader struct {
|
||||||
|
client *Client
|
||||||
|
cancelCtxStream context.CancelFunc
|
||||||
|
err error
|
||||||
|
res ResContainerListStream
|
||||||
|
stream interface {
|
||||||
|
Read(resp *container.ListStreamResponse) error
|
||||||
|
}
|
||||||
|
tail []refs.ContainerID
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read reads another list of the container identifiers. Works similar to
|
||||||
|
// io.Reader.Read but copies cid.ID and returns success flag instead of error.
|
||||||
|
//
|
||||||
|
// Failure reason can be received via Close.
|
||||||
|
//
|
||||||
dstepanov-yadro
commented
`int` is count of read containers. What is `bool`?
elebedeva
commented
`bool` indicates if `Read()` was successful or not.
|
|||||||
|
// Panics if buf has zero length.
|
||||||
|
func (x *ContainerListReader) Read(buf []cid.ID) (int, bool) {
|
||||||
aarifullin
commented
`Read` instead of `Read.List` ? :)
To be honest, this panic looks unnecessarily. You can define
```go
var errEmptyBuffer = errors.New("empty read buffer")
```
```go
if len(buf) == 0 {
x.err = errEmptyBuffer
return 0, false
}
```
fyrchik
commented
Why do we panic or error at all? Why do we panic or error at all?
If we remove this `if`, will the code still work?
elebedeva
commented
If we remove this check the list command will hang indefinitely. I believe we should keep the panic as the clear indication of incorrect passed argument. If we remove this check the list command will hang indefinitely. I believe we should keep the panic as the clear indication of incorrect passed argument.
|
|||||||
|
// if len(buf) == 0 {
|
||||||
|
// panic("empty buffer in ContainerListReader.ReadList")
|
||||||
|
// }
|
||||||
|
|
||||||
|
read := copyCnrIDBuffers(buf, x.tail)
|
||||||
|
x.tail = x.tail[read:]
|
||||||
|
|
||||||
|
if len(buf) == read {
|
||||||
|
return read, true
|
||||||
|
}
|
||||||
|
|
||||||
|
for {
|
||||||
|
var resp container.ListStreamResponse
|
||||||
|
x.err = x.stream.Read(&resp)
|
||||||
|
if x.err != nil {
|
||||||
|
return read, false
|
||||||
|
}
|
||||||
|
|
||||||
|
x.res.st, x.err = x.client.processResponse(&resp)
|
||||||
|
if x.err != nil || !apistatus.IsSuccessful(x.res.st) {
|
||||||
|
return read, false
|
||||||
|
}
|
||||||
|
|
||||||
|
// read new chunk of containers
|
||||||
|
ids := resp.GetBody().GetContainerIDs()
|
||||||
|
if len(ids) == 0 {
|
||||||
|
// just skip empty lists since they are not prohibited by protocol
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
ln := copyCnrIDBuffers(buf[read:], ids)
|
||||||
|
read += ln
|
||||||
|
|
||||||
|
if read == len(buf) {
|
||||||
aarifullin marked this conversation as resolved
Outdated
aarifullin
commented
Optional changeThat's barely possible for listing containers but if read buffer is quite small and stream is going to send a big number of containers then such accumulation in the tail may lead to overflow.
P.S. about small buffer: ### Optional change
That's barely possible for listing containers but if read buffer is quite small and stream is going to send a big number of containers then such accumulation in the tail may lead to overflow.
Didn't you consider?
```go
if len(x.tail)+len(remainingIDs) > x.maxTailSize {
x.err = errors.New("internal buffer overflow")
return 0, false
}
```
P.S. about small buffer: `Iterate` already uses such buffer
elebedeva
commented
I don't see how accumulation in the tail may lead to overflow. We do exactly the same in I don't see how accumulation in the tail may lead to overflow. We do exactly the same in `Object.Search` [here](https://git.frostfs.info/TrueCloudLab/frostfs-sdk-go/src/commit/81c423e7094d870f7e38e5ccca8e4690dfe89699/client/object_search.go#L167), and it seems there's been no problem so far.
|
|||||||
|
// save the tail
|
||||||
|
x.tail = append(x.tail, ids[ln:]...)
|
||||||
|
|
||||||
|
return read, true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func copyCnrIDBuffers(dst []cid.ID, src []refs.ContainerID) int {
|
||||||
|
var i int
|
||||||
|
for ; i < len(dst) && i < len(src); i++ {
|
||||||
|
_ = dst[i].ReadFromV2(src[i])
|
||||||
|
}
|
||||||
|
return i
|
||||||
|
}
|
||||||
|
|
||||||
|
// Iterate iterates over the list of found container identifiers.
|
||||||
|
// f can return true to stop iteration earlier.
|
||||||
|
//
|
||||||
|
// Returns an error if container can't be read.
|
||||||
|
func (x *ContainerListReader) Iterate(f func(cid.ID) bool) error {
|
||||||
|
buf := make([]cid.ID, 1)
|
||||||
|
|
||||||
|
for {
|
||||||
|
// Do not check first return value because `len(buf) == 1`,
|
||||||
|
// so false means nothing was read.
|
||||||
|
_, ok := x.Read(buf)
|
||||||
|
if !ok {
|
||||||
|
res, err := x.Close()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return apistatus.ErrFromStatus(res.Status())
|
||||||
|
}
|
||||||
|
if f(buf[0]) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close ends reading list of the matched containers and returns the result of the operation
|
||||||
|
// along with the final results. Must be called after using the ContainerListReader.
|
||||||
|
//
|
||||||
|
// Exactly one return value is non-nil. By default, server status is returned in res structure.
|
||||||
|
// Any client's internal or transport errors are returned as Go built-in error.
|
||||||
|
// If Client is tuned to resolve FrostFS API statuses, then FrostFS failures
|
||||||
|
// codes are returned as error.
|
||||||
|
func (x *ContainerListReader) Close() (*ResContainerListStream, error) {
|
||||||
|
defer x.cancelCtxStream()
|
||||||
|
|
||||||
|
if x.err != nil && !errors.Is(x.err, io.EOF) {
|
||||||
|
return nil, x.err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &x.res, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContainerListInit initiates container selection through a remote server using FrostFS API protocol.
|
||||||
|
//
|
||||||
|
// The call only opens the transmission channel, explicit fetching of identifiers of the account-owned
|
||||||
|
// containers is done using the ContainerListReader. Exactly one return value is non-nil.
|
||||||
|
// Resulting reader must be finally closed.
|
||||||
|
//
|
||||||
|
// Returns an error if parameters are set incorrectly (see PrmContainerListStream docs).
|
||||||
|
// Context is required and must not be nil. It is used for network communication.
|
||||||
|
func (c *Client) ContainerListInit(ctx context.Context, prm PrmContainerListStream) (*ContainerListReader, error) {
|
||||||
|
req, err := prm.buildRequest(c)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = signature.SignServiceMessage(&c.prm.Key, req)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("sign request: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var r ContainerListReader
|
||||||
|
ctx, r.cancelCtxStream = context.WithCancel(ctx)
|
||||||
|
|
||||||
|
r.stream, err = rpcapi.ListContainersStream(&c.c, req, client.WithContext(ctx))
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("open stream: %w", err)
|
||||||
|
}
|
||||||
|
r.client = c
|
||||||
|
|
||||||
|
return &r, nil
|
||||||
|
}
|
|
@ -104,6 +104,10 @@ func (m *mockClient) containerList(context.Context, PrmContainerList) ([]cid.ID,
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *mockClient) containerListStream(context.Context, PrmListStream) (ResListStream, error) {
|
||||||
|
return ResListStream{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (m *mockClient) containerDelete(context.Context, PrmContainerDelete) error {
|
func (m *mockClient) containerDelete(context.Context, PrmContainerDelete) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
90
pool/pool.go
|
@ -47,6 +47,8 @@ type client interface {
|
||||||
containerGet(context.Context, PrmContainerGet) (container.Container, error)
|
containerGet(context.Context, PrmContainerGet) (container.Container, error)
|
||||||
// see clientWrapper.containerList.
|
// see clientWrapper.containerList.
|
||||||
containerList(context.Context, PrmContainerList) ([]cid.ID, error)
|
containerList(context.Context, PrmContainerList) ([]cid.ID, error)
|
||||||
|
// see clientWrapper.containerListStream.
|
||||||
|
containerListStream(context.Context, PrmListStream) (ResListStream, error)
|
||||||
// see clientWrapper.containerDelete.
|
// see clientWrapper.containerDelete.
|
||||||
containerDelete(context.Context, PrmContainerDelete) error
|
containerDelete(context.Context, PrmContainerDelete) error
|
||||||
// see clientWrapper.apeManagerAddChain.
|
// see clientWrapper.apeManagerAddChain.
|
||||||
|
@ -145,6 +147,7 @@ const (
|
||||||
methodContainerPut
|
methodContainerPut
|
||||||
methodContainerGet
|
methodContainerGet
|
||||||
methodContainerList
|
methodContainerList
|
||||||
|
methodContainerListStream
|
||||||
methodContainerDelete
|
methodContainerDelete
|
||||||
methodEndpointInfo
|
methodEndpointInfo
|
||||||
methodNetworkInfo
|
methodNetworkInfo
|
||||||
|
@ -512,7 +515,7 @@ func (c *clientWrapper) containerList(ctx context.Context, prm PrmContainerList)
|
||||||
}
|
}
|
||||||
|
|
||||||
cliPrm := sdkClient.PrmContainerList{
|
cliPrm := sdkClient.PrmContainerList{
|
||||||
Account: prm.OwnerID,
|
OwnerID: prm.OwnerID,
|
||||||
Session: prm.Session,
|
Session: prm.Session,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,6 +532,75 @@ func (c *clientWrapper) containerList(ctx context.Context, prm PrmContainerList)
|
||||||
return res.Containers(), nil
|
return res.Containers(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PrmListStream groups parameters of ListContainersStream operation.
|
||||||
|
type PrmListStream struct {
|
||||||
|
OwnerID user.ID
|
||||||
|
|
||||||
|
Session *session.Container
|
||||||
|
}
|
||||||
|
|
||||||
|
// ResListStream is designed to read list of object identifiers from FrostFS system.
|
||||||
|
//
|
||||||
|
// Must be initialized using Pool.ListContainersStream, any other usage is unsafe.
|
||||||
|
type ResListStream struct {
|
||||||
|
r *sdkClient.ContainerListReader
|
||||||
|
handleError func(context.Context, apistatus.Status, error) error
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read reads another list of the container identifiers.
|
||||||
|
func (x *ResListStream) Read(buf []cid.ID) (int, error) {
|
||||||
|
n, ok := x.r.Read(buf)
|
||||||
|
if !ok {
|
||||||
|
res, err := x.r.Close()
|
||||||
|
if err == nil {
|
||||||
|
return n, io.EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
var status apistatus.Status
|
||||||
|
if res != nil {
|
||||||
|
status = res.Status()
|
||||||
|
}
|
||||||
|
err = x.handleError(nil, status, err)
|
||||||
|
|
||||||
|
return n, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return n, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Iterate iterates over the list of found container identifiers.
|
||||||
|
// f can return true to stop iteration earlier.
|
||||||
|
//
|
||||||
|
// Returns an error if container can't be read.
|
||||||
|
func (x *ResListStream) Iterate(f func(cid.ID) bool) error {
|
||||||
|
return x.r.Iterate(f)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close ends reading list of the matched containers and returns the result of the operation
|
||||||
|
// along with the final results. Must be called after using the ResListStream.
|
||||||
|
func (x *ResListStream) Close() {
|
||||||
|
_, _ = x.r.Close()
|
||||||
|
}
|
||||||
|
|
||||||
|
// containerList invokes sdkClient.ContainerList parse response status to error and return result as is.
|
||||||
|
func (c *clientWrapper) containerListStream(ctx context.Context, prm PrmListStream) (ResListStream, error) {
|
||||||
|
cl, err := c.getClient()
|
||||||
|
if err != nil {
|
||||||
|
return ResListStream{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
cliPrm := sdkClient.PrmContainerListStream{
|
||||||
|
OwnerID: prm.OwnerID,
|
||||||
|
Session: prm.Session,
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := cl.ContainerListInit(ctx, cliPrm)
|
||||||
|
if err = c.handleError(ctx, nil, err); err != nil {
|
||||||
|
return ResListStream{}, fmt.Errorf("init container listing on client: %w", err)
|
||||||
|
}
|
||||||
|
return ResListStream{r: res, handleError: c.handleError}, nil
|
||||||
|
}
|
||||||
|
|
||||||
// containerDelete invokes sdkClient.ContainerDelete parse response status to error.
|
// containerDelete invokes sdkClient.ContainerDelete parse response status to error.
|
||||||
// It also waits for the container to be removed from the network.
|
// It also waits for the container to be removed from the network.
|
||||||
func (c *clientWrapper) containerDelete(ctx context.Context, prm PrmContainerDelete) error {
|
func (c *clientWrapper) containerDelete(ctx context.Context, prm PrmContainerDelete) error {
|
||||||
|
@ -2887,6 +2959,22 @@ func (p *Pool) ListContainers(ctx context.Context, prm PrmContainerList) ([]cid.
|
||||||
return cnrIDs, nil
|
return cnrIDs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ListContainersStream requests identifiers of the account-owned containers.
|
||||||
fyrchik
commented
Please, remove one Please, remove one `//`
fyrchik
commented
Also, fix the name. Also, fix the name.
elebedeva
commented
Fixed Fixed
|
|||||||
|
func (p *Pool) ListContainersStream(ctx context.Context, prm PrmListStream) (ResListStream, error) {
|
||||||
|
var res ResListStream
|
||||||
|
cp, err := p.connection()
|
||||||
|
if err != nil {
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err = cp.containerListStream(ctx, prm)
|
||||||
|
if err != nil {
|
||||||
|
return res, fmt.Errorf("list containers stream via client '%s': %w", cp.address(), err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return res, nil
|
||||||
|
}
|
||||||
|
|
||||||
// DeleteContainer sends request to remove the FrostFS container and waits for the operation to complete.
|
// DeleteContainer sends request to remove the FrostFS container and waits for the operation to complete.
|
||||||
//
|
//
|
||||||
// Waiting parameters can be specified using SetWaitParams. If not called, defaults are used:
|
// Waiting parameters can be specified using SetWaitParams. If not called, defaults are used:
|
||||||
|
|
This line is also changed in the second commit, it shouldn't be there.
Fixed