forked from TrueCloudLab/frostfs-api-go
Response meta header
This commit is contained in:
parent
4709193cae
commit
de09878df1
6 changed files with 692 additions and 91 deletions
|
@ -88,14 +88,71 @@ func (m *RequestMetaHeader) GetVersion() uint32 {
|
|||
return 0
|
||||
}
|
||||
|
||||
// ResponseMetaHeader contains meta information based on request processing by server
|
||||
// (should be embedded into message)
|
||||
type ResponseMetaHeader struct {
|
||||
// Current NeoFS epoch on server
|
||||
Epoch uint64 `protobuf:"varint,1,opt,name=Epoch,proto3" json:"Epoch,omitempty"`
|
||||
// Version defines protocol version
|
||||
// TODO: not used for now, should be implemented in future
|
||||
Version uint32 `protobuf:"varint,2,opt,name=Version,proto3" json:"Version,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ResponseMetaHeader) Reset() { *m = ResponseMetaHeader{} }
|
||||
func (m *ResponseMetaHeader) String() string { return proto.CompactTextString(m) }
|
||||
func (*ResponseMetaHeader) ProtoMessage() {}
|
||||
func (*ResponseMetaHeader) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_a638867e7b43457c, []int{1}
|
||||
}
|
||||
func (m *ResponseMetaHeader) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *ResponseMetaHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalToSizedBuffer(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
func (m *ResponseMetaHeader) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ResponseMetaHeader.Merge(m, src)
|
||||
}
|
||||
func (m *ResponseMetaHeader) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *ResponseMetaHeader) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ResponseMetaHeader.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ResponseMetaHeader proto.InternalMessageInfo
|
||||
|
||||
func (m *ResponseMetaHeader) GetEpoch() uint64 {
|
||||
if m != nil {
|
||||
return m.Epoch
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ResponseMetaHeader) GetVersion() uint32 {
|
||||
if m != nil {
|
||||
return m.Version
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*RequestMetaHeader)(nil), "service.RequestMetaHeader")
|
||||
proto.RegisterType((*ResponseMetaHeader)(nil), "service.ResponseMetaHeader")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("service/meta.proto", fileDescriptor_a638867e7b43457c) }
|
||||
|
||||
var fileDescriptor_a638867e7b43457c = []byte{
|
||||
// 220 bytes of a gzipped FileDescriptorProto
|
||||
// 244 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2a, 0x4e, 0x2d, 0x2a,
|
||||
0xcb, 0x4c, 0x4e, 0xd5, 0xcf, 0x4d, 0x2d, 0x49, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62,
|
||||
0x87, 0x8a, 0x49, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7,
|
||||
|
@ -104,12 +161,14 @@ var fileDescriptor_a638867e7b43457c = []byte{
|
|||
0x48, 0x4d, 0x4c, 0x49, 0x2d, 0x12, 0x12, 0xe0, 0x62, 0x0e, 0x09, 0xf1, 0x91, 0x60, 0x54, 0x60,
|
||||
0xd4, 0xe0, 0x0d, 0x02, 0x31, 0x85, 0x44, 0xb8, 0x58, 0x5d, 0x0b, 0xf2, 0x93, 0x33, 0x24, 0x98,
|
||||
0x14, 0x18, 0x35, 0x58, 0x82, 0x20, 0x1c, 0x21, 0x09, 0x2e, 0xf6, 0xb0, 0xd4, 0xa2, 0xe2, 0xcc,
|
||||
0xfc, 0x3c, 0x09, 0x66, 0xb0, 0x5a, 0x18, 0xd7, 0x29, 0xe0, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f,
|
||||
0xe4, 0x18, 0x6f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc6, 0x63, 0x39, 0x86, 0x28,
|
||||
0x35, 0x24, 0xb7, 0xe5, 0x15, 0x17, 0x24, 0x27, 0xeb, 0xa6, 0xa4, 0x96, 0xe9, 0xe7, 0xa5, 0xe6,
|
||||
0xa7, 0x15, 0xeb, 0x26, 0x16, 0x64, 0xea, 0x43, 0xfd, 0xb0, 0x8a, 0x49, 0xd0, 0x2f, 0x35, 0xdf,
|
||||
0x2d, 0x58, 0xcf, 0x31, 0xc0, 0x53, 0x2f, 0x18, 0x22, 0x96, 0xc4, 0x06, 0x76, 0xaf, 0x31, 0x20,
|
||||
0x00, 0x00, 0xff, 0xff, 0x78, 0x63, 0x03, 0x7b, 0xfd, 0x00, 0x00, 0x00,
|
||||
0xfc, 0x3c, 0x09, 0x66, 0xb0, 0x5a, 0x18, 0x57, 0xc9, 0x85, 0x4b, 0x28, 0x28, 0xb5, 0xb8, 0x20,
|
||||
0x3f, 0xaf, 0x38, 0x15, 0xc9, 0x5c, 0xb8, 0x29, 0x8c, 0x38, 0x4c, 0x61, 0x42, 0x31, 0xc5, 0x29,
|
||||
0xe0, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x6f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48,
|
||||
0x8e, 0x71, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x35, 0x24, 0x1f, 0xe6, 0x15, 0x17, 0x24, 0x27, 0xeb,
|
||||
0xa6, 0xa4, 0x96, 0xe9, 0xe7, 0xa5, 0xe6, 0xa7, 0x15, 0xeb, 0x26, 0x16, 0x64, 0xea, 0x43, 0x43,
|
||||
0x62, 0x15, 0x93, 0xa0, 0x5f, 0x6a, 0xbe, 0x5b, 0xb0, 0x9e, 0x63, 0x80, 0xa7, 0x5e, 0x30, 0x44,
|
||||
0x2c, 0x89, 0x0d, 0xec, 0x6b, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd5, 0x3a, 0x21, 0x1a,
|
||||
0x43, 0x01, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *RequestMetaHeader) Marshal() (dAtA []byte, err error) {
|
||||
|
@ -154,6 +213,43 @@ func (m *RequestMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *ResponseMetaHeader) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *ResponseMetaHeader) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *ResponseMetaHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.XXX_unrecognized != nil {
|
||||
i -= len(m.XXX_unrecognized)
|
||||
copy(dAtA[i:], m.XXX_unrecognized)
|
||||
}
|
||||
if m.Version != 0 {
|
||||
i = encodeVarintMeta(dAtA, i, uint64(m.Version))
|
||||
i--
|
||||
dAtA[i] = 0x10
|
||||
}
|
||||
if m.Epoch != 0 {
|
||||
i = encodeVarintMeta(dAtA, i, uint64(m.Epoch))
|
||||
i--
|
||||
dAtA[i] = 0x8
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintMeta(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovMeta(v)
|
||||
base := offset
|
||||
|
@ -186,6 +282,24 @@ func (m *RequestMetaHeader) Size() (n int) {
|
|||
return n
|
||||
}
|
||||
|
||||
func (m *ResponseMetaHeader) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.Epoch != 0 {
|
||||
n += 1 + sovMeta(uint64(m.Epoch))
|
||||
}
|
||||
if m.Version != 0 {
|
||||
n += 1 + sovMeta(uint64(m.Version))
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovMeta(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
|
@ -303,6 +417,98 @@ func (m *RequestMetaHeader) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
func (m *ResponseMetaHeader) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowMeta
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: ResponseMetaHeader: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: ResponseMetaHeader: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Epoch", wireType)
|
||||
}
|
||||
m.Epoch = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowMeta
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.Epoch |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 2:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType)
|
||||
}
|
||||
m.Version = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowMeta
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.Version |= uint32(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipMeta(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthMeta
|
||||
}
|
||||
if (iNdEx + skippy) < 0 {
|
||||
return ErrInvalidLengthMeta
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipMeta(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
|
|
@ -18,3 +18,13 @@ message RequestMetaHeader {
|
|||
// TODO: not used for now, should be implemented in future
|
||||
uint32 Version = 3;
|
||||
}
|
||||
|
||||
// ResponseMetaHeader contains meta information based on request processing by server
|
||||
// (should be embedded into message)
|
||||
message ResponseMetaHeader {
|
||||
// Current NeoFS epoch on server
|
||||
uint64 Epoch = 1;
|
||||
// Version defines protocol version
|
||||
// TODO: not used for now, should be implemented in future
|
||||
uint32 Version = 2;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue