From ddb60e498d6184202cb7485617e4c564abe33b9e Mon Sep 17 00:00:00 2001 From: mcrakhman Date: Fri, 3 Mar 2023 23:10:05 +0100 Subject: [PATCH] Update status method --- .../coordinatorclient/coordinatorclient.go | 21 +- .../coordinatorproto/coordinator.pb.go | 433 ++++++++++++++---- .../coordinatorproto/protos/coordinator.proto | 16 +- 3 files changed, 363 insertions(+), 107 deletions(-) diff --git a/coordinator/coordinatorclient/coordinatorclient.go b/coordinator/coordinatorclient/coordinatorclient.go index 03852795..627bba1b 100644 --- a/coordinator/coordinatorclient/coordinatorclient.go +++ b/coordinator/coordinatorclient/coordinatorclient.go @@ -17,8 +17,8 @@ func New() CoordinatorClient { } type CoordinatorClient interface { - ChangeStatus(ctx context.Context, spaceId string, deleteRaw *treechangeproto.RawTreeChangeWithId) (err error) - StatusCheck(ctx context.Context, spaceId string) (status *coordinatorproto.SpaceStatusCheckResponse, err error) + ChangeStatus(ctx context.Context, spaceId string, deleteRaw *treechangeproto.RawTreeChangeWithId) (status *coordinatorproto.SpaceStatusPayload, err error) + StatusCheck(ctx context.Context, spaceId string) (status *coordinatorproto.SpaceStatusPayload, err error) SpaceSign(ctx context.Context, spaceId string, spaceHeader []byte) (receipt *coordinatorproto.SpaceReceiptWithSignature, err error) FileLimitCheck(ctx context.Context, spaceId string, identity []byte) (limit uint64, err error) app.Component @@ -29,27 +29,36 @@ type coordinatorClient struct { nodeConf nodeconf.Service } -func (c *coordinatorClient) ChangeStatus(ctx context.Context, spaceId string, deleteRaw *treechangeproto.RawTreeChangeWithId) (err error) { +func (c *coordinatorClient) ChangeStatus(ctx context.Context, spaceId string, deleteRaw *treechangeproto.RawTreeChangeWithId) (status *coordinatorproto.SpaceStatusPayload, err error) { cl, err := c.client(ctx) if err != nil { return } - _, err = cl.SpaceStatusChange(ctx, &coordinatorproto.SpaceStatusChangeRequest{ + resp, err := cl.SpaceStatusChange(ctx, &coordinatorproto.SpaceStatusChangeRequest{ SpaceId: spaceId, DeletionChangeId: deleteRaw.Id, DeletionChangePayload: deleteRaw.RawChange, }) + if err != nil { + return + } + status = resp.Payload return } -func (c *coordinatorClient) StatusCheck(ctx context.Context, spaceId string) (response *coordinatorproto.SpaceStatusCheckResponse, err error) { +func (c *coordinatorClient) StatusCheck(ctx context.Context, spaceId string) (status *coordinatorproto.SpaceStatusPayload, err error) { cl, err := c.client(ctx) if err != nil { return } - return cl.SpaceStatusCheck(ctx, &coordinatorproto.SpaceStatusCheckRequest{ + resp, err := cl.SpaceStatusCheck(ctx, &coordinatorproto.SpaceStatusCheckRequest{ SpaceId: spaceId, }) + if err != nil { + return + } + status = resp.Payload + return } func (c *coordinatorClient) Init(a *app.App) (err error) { diff --git a/coordinator/coordinatorproto/coordinator.pb.go b/coordinator/coordinatorproto/coordinator.pb.go index 4e7e5d6f..b638938c 100644 --- a/coordinator/coordinatorproto/coordinator.pb.go +++ b/coordinator/coordinatorproto/coordinator.pb.go @@ -105,6 +105,58 @@ func (m *SpaceSignRequest) GetHeader() []byte { return nil } +type SpaceStatusPayload struct { + Status SpaceStatus `protobuf:"varint,1,opt,name=status,proto3,enum=coordinator.SpaceStatus" json:"status,omitempty"` + DeletionTimestamp int64 `protobuf:"varint,2,opt,name=deletionTimestamp,proto3" json:"deletionTimestamp,omitempty"` +} + +func (m *SpaceStatusPayload) Reset() { *m = SpaceStatusPayload{} } +func (m *SpaceStatusPayload) String() string { return proto.CompactTextString(m) } +func (*SpaceStatusPayload) ProtoMessage() {} +func (*SpaceStatusPayload) Descriptor() ([]byte, []int) { + return fileDescriptor_d94f6f99586adae2, []int{1} +} +func (m *SpaceStatusPayload) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SpaceStatusPayload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SpaceStatusPayload.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SpaceStatusPayload) XXX_Merge(src proto.Message) { + xxx_messageInfo_SpaceStatusPayload.Merge(m, src) +} +func (m *SpaceStatusPayload) XXX_Size() int { + return m.Size() +} +func (m *SpaceStatusPayload) XXX_DiscardUnknown() { + xxx_messageInfo_SpaceStatusPayload.DiscardUnknown(m) +} + +var xxx_messageInfo_SpaceStatusPayload proto.InternalMessageInfo + +func (m *SpaceStatusPayload) GetStatus() SpaceStatus { + if m != nil { + return m.Status + } + return SpaceStatus_SpaceStatusCreated +} + +func (m *SpaceStatusPayload) GetDeletionTimestamp() int64 { + if m != nil { + return m.DeletionTimestamp + } + return 0 +} + type SpaceSignResponse struct { Receipt *SpaceReceiptWithSignature `protobuf:"bytes,1,opt,name=receipt,proto3" json:"receipt,omitempty"` } @@ -113,7 +165,7 @@ func (m *SpaceSignResponse) Reset() { *m = SpaceSignResponse{} } func (m *SpaceSignResponse) String() string { return proto.CompactTextString(m) } func (*SpaceSignResponse) ProtoMessage() {} func (*SpaceSignResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{1} + return fileDescriptor_d94f6f99586adae2, []int{2} } func (m *SpaceSignResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -159,7 +211,7 @@ func (m *SpaceReceiptWithSignature) Reset() { *m = SpaceReceiptWithSigna func (m *SpaceReceiptWithSignature) String() string { return proto.CompactTextString(m) } func (*SpaceReceiptWithSignature) ProtoMessage() {} func (*SpaceReceiptWithSignature) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{2} + return fileDescriptor_d94f6f99586adae2, []int{3} } func (m *SpaceReceiptWithSignature) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -220,7 +272,7 @@ func (m *SpaceReceipt) Reset() { *m = SpaceReceipt{} } func (m *SpaceReceipt) String() string { return proto.CompactTextString(m) } func (*SpaceReceipt) ProtoMessage() {} func (*SpaceReceipt) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{3} + return fileDescriptor_d94f6f99586adae2, []int{4} } func (m *SpaceReceipt) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -295,7 +347,7 @@ func (m *FileLimitCheckRequest) Reset() { *m = FileLimitCheckRequest{} } func (m *FileLimitCheckRequest) String() string { return proto.CompactTextString(m) } func (*FileLimitCheckRequest) ProtoMessage() {} func (*FileLimitCheckRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{4} + return fileDescriptor_d94f6f99586adae2, []int{5} } func (m *FileLimitCheckRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -347,7 +399,7 @@ func (m *FileLimitCheckResponse) Reset() { *m = FileLimitCheckResponse{} func (m *FileLimitCheckResponse) String() string { return proto.CompactTextString(m) } func (*FileLimitCheckResponse) ProtoMessage() {} func (*FileLimitCheckResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{5} + return fileDescriptor_d94f6f99586adae2, []int{6} } func (m *FileLimitCheckResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -392,7 +444,7 @@ func (m *SpaceStatusCheckRequest) Reset() { *m = SpaceStatusCheckRequest func (m *SpaceStatusCheckRequest) String() string { return proto.CompactTextString(m) } func (*SpaceStatusCheckRequest) ProtoMessage() {} func (*SpaceStatusCheckRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{6} + return fileDescriptor_d94f6f99586adae2, []int{7} } func (m *SpaceStatusCheckRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -428,17 +480,16 @@ func (m *SpaceStatusCheckRequest) GetSpaceId() string { return "" } -// SpaceStatusCheckResponse contains the status and deletion timestamp if needed +// SpaceStatusCheckResponse contains the current status of space type SpaceStatusCheckResponse struct { - Status SpaceStatus `protobuf:"varint,1,opt,name=status,proto3,enum=coordinator.SpaceStatus" json:"status,omitempty"` - DeletionTimestamp int64 `protobuf:"varint,2,opt,name=deletionTimestamp,proto3" json:"deletionTimestamp,omitempty"` + Payload *SpaceStatusPayload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` } func (m *SpaceStatusCheckResponse) Reset() { *m = SpaceStatusCheckResponse{} } func (m *SpaceStatusCheckResponse) String() string { return proto.CompactTextString(m) } func (*SpaceStatusCheckResponse) ProtoMessage() {} func (*SpaceStatusCheckResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{7} + return fileDescriptor_d94f6f99586adae2, []int{8} } func (m *SpaceStatusCheckResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -467,18 +518,11 @@ func (m *SpaceStatusCheckResponse) XXX_DiscardUnknown() { var xxx_messageInfo_SpaceStatusCheckResponse proto.InternalMessageInfo -func (m *SpaceStatusCheckResponse) GetStatus() SpaceStatus { +func (m *SpaceStatusCheckResponse) GetPayload() *SpaceStatusPayload { if m != nil { - return m.Status + return m.Payload } - return SpaceStatus_SpaceStatusCreated -} - -func (m *SpaceStatusCheckResponse) GetDeletionTimestamp() int64 { - if m != nil { - return m.DeletionTimestamp - } - return 0 + return nil } // SpaceStatusChangeRequest contains the deletionChange if we want to delete space, or it is empty otherwise @@ -492,7 +536,7 @@ func (m *SpaceStatusChangeRequest) Reset() { *m = SpaceStatusChangeReque func (m *SpaceStatusChangeRequest) String() string { return proto.CompactTextString(m) } func (*SpaceStatusChangeRequest) ProtoMessage() {} func (*SpaceStatusChangeRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{8} + return fileDescriptor_d94f6f99586adae2, []int{9} } func (m *SpaceStatusChangeRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -542,15 +586,16 @@ func (m *SpaceStatusChangeRequest) GetDeletionChangePayload() []byte { return nil } -// SpaceStatusChangeResponse is always empty, you should check error in case something was wrong +// SpaceStatusChangeResponse contains changed status of space type SpaceStatusChangeResponse struct { + Payload *SpaceStatusPayload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` } func (m *SpaceStatusChangeResponse) Reset() { *m = SpaceStatusChangeResponse{} } func (m *SpaceStatusChangeResponse) String() string { return proto.CompactTextString(m) } func (*SpaceStatusChangeResponse) ProtoMessage() {} func (*SpaceStatusChangeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d94f6f99586adae2, []int{9} + return fileDescriptor_d94f6f99586adae2, []int{10} } func (m *SpaceStatusChangeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -579,9 +624,17 @@ func (m *SpaceStatusChangeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_SpaceStatusChangeResponse proto.InternalMessageInfo +func (m *SpaceStatusChangeResponse) GetPayload() *SpaceStatusPayload { + if m != nil { + return m.Payload + } + return nil +} + func init() { proto.RegisterEnum("coordinator.SpaceStatus", SpaceStatus_name, SpaceStatus_value) proto.RegisterType((*SpaceSignRequest)(nil), "coordinator.SpaceSignRequest") + proto.RegisterType((*SpaceStatusPayload)(nil), "coordinator.SpaceStatusPayload") proto.RegisterType((*SpaceSignResponse)(nil), "coordinator.SpaceSignResponse") proto.RegisterType((*SpaceReceiptWithSignature)(nil), "coordinator.SpaceReceiptWithSignature") proto.RegisterType((*SpaceReceipt)(nil), "coordinator.SpaceReceipt") @@ -598,45 +651,47 @@ func init() { } var fileDescriptor_d94f6f99586adae2 = []byte{ - // 604 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0x41, 0x6f, 0x12, 0x41, - 0x14, 0x66, 0x81, 0xd2, 0xf0, 0x20, 0x95, 0x8e, 0x16, 0x57, 0xac, 0x1b, 0xb2, 0x6a, 0x43, 0x1a, - 0x43, 0x1b, 0xaa, 0x9e, 0x8d, 0x6d, 0x4c, 0x30, 0xc6, 0x34, 0x8b, 0x8d, 0x51, 0x0f, 0x66, 0xba, - 0xfb, 0x02, 0x93, 0x2e,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ff, 0x9a, 0xc2, 0x98, 0x37, 0x3c, 0x06, 0x00, 0x00, + // 630 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcd, 0x6e, 0x13, 0x3d, + 0x14, 0xcd, 0xa4, 0x7f, 0xca, 0x4d, 0xd5, 0x2f, 0xf5, 0x47, 0xcb, 0x10, 0x95, 0xa1, 0x32, 0x50, + 0x45, 0x15, 0x6a, 0xab, 0x14, 0x90, 0xd8, 0x21, 0x5a, 0x21, 0x15, 0x21, 0x84, 0x5c, 0x02, 0x02, + 0x16, 0xc8, 0x1d, 0x5b, 0x89, 0xd5, 0xc9, 0x78, 0x98, 0x71, 0x90, 0xba, 0xe0, 0x1d, 0x58, 0xf1, + 0x34, 0x3c, 0x00, 0xcb, 0x2e, 0x59, 0xa2, 0xe4, 0x29, 0xd8, 0xa1, 0x78, 0x3c, 0x89, 0x27, 0x99, + 0x24, 0x0b, 0x36, 0x49, 0x7c, 0xce, 0xbd, 0xe7, 0x1e, 0x5f, 0x5f, 0x3b, 0xf0, 0xc8, 0x97, 0x32, + 0x66, 0x22, 0xa4, 0x4a, 0xc6, 0x87, 0xd6, 0xef, 0x28, 0x96, 0x4a, 0x1e, 0xea, 0xcf, 0xc4, 0xc6, + 0x0f, 0x34, 0x84, 0xaa, 0x16, 0x84, 0x4f, 0xa1, 0x76, 0x1e, 0x51, 0x9f, 0x9f, 0x8b, 0x76, 0x48, + 0xf8, 0xe7, 0x1e, 0x4f, 0x14, 0x72, 0x61, 0x2d, 0x19, 0x62, 0x67, 0xcc, 0x75, 0x76, 0x9d, 0x46, + 0x85, 0x64, 0x4b, 0xb4, 0x0d, 0xab, 0x1d, 0x4e, 0x19, 0x8f, 0xdd, 0xf2, 0xae, 0xd3, 0x58, 0x27, + 0x66, 0x85, 0x15, 0xa0, 0x54, 0x45, 0x51, 0xd5, 0x4b, 0x5e, 0xd3, 0xab, 0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 0x70, 0x2e, 0xa3, 0xf0, 0x06, 0xd4, + 0xef, 0xce, 0x8d, 0x31, 0xd2, 0x9f, 0xb2, 0xe7, 0x77, 0x3c, 0x7d, 0xe8, 0xde, 0xac, 0x9e, 0xe7, + 0xe4, 0xef, 0x2f, 0x88, 0x32, 0x05, 0x2e, 0xb2, 0x37, 0xd2, 0x3a, 0x6e, 0x34, 0x27, 0xd7, 0x1a, + 0xd3, 0xfa, 0xde, 0xa2, 0xb0, 0xb4, 0xc6, 0xb3, 0xc7, 0x3f, 0xfb, 0x9e, 0x73, 0xdd, 0xf7, 0x9c, + 0xdf, 0x7d, 0xcf, 0xf9, 0x36, 0xf0, 0x4a, 0xd7, 0x03, 0xaf, 0xf4, 0x6b, 0xe0, 0x95, 0x3e, 0xec, + 0xcc, 0xfb, 0x87, 0xba, 0x58, 0xd5, 0x5f, 0xc7, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xf7, 0x70, + 0x9d, 0x63, 0xc8, 0x06, 0x00, 0x00, } func (m *SpaceSignRequest) Marshal() (dAtA []byte, err error) { @@ -676,6 +731,39 @@ func (m *SpaceSignRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *SpaceStatusPayload) 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 *SpaceStatusPayload) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SpaceStatusPayload) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.DeletionTimestamp != 0 { + i = encodeVarintCoordinator(dAtA, i, uint64(m.DeletionTimestamp)) + i-- + dAtA[i] = 0x10 + } + if m.Status != 0 { + i = encodeVarintCoordinator(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func (m *SpaceSignResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -919,15 +1007,17 @@ func (m *SpaceStatusCheckResponse) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l - if m.DeletionTimestamp != 0 { - i = encodeVarintCoordinator(dAtA, i, uint64(m.DeletionTimestamp)) + if m.Payload != nil { + { + size, err := m.Payload.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCoordinator(dAtA, i, uint64(size)) + } i-- - dAtA[i] = 0x10 - } - if m.Status != 0 { - i = encodeVarintCoordinator(dAtA, i, uint64(m.Status)) - i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -996,6 +1086,18 @@ func (m *SpaceStatusChangeResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro _ = i var l int _ = l + if m.Payload != nil { + { + size, err := m.Payload.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCoordinator(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } @@ -1027,6 +1129,21 @@ func (m *SpaceSignRequest) Size() (n int) { return n } +func (m *SpaceStatusPayload) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Status != 0 { + n += 1 + sovCoordinator(uint64(m.Status)) + } + if m.DeletionTimestamp != 0 { + n += 1 + sovCoordinator(uint64(m.DeletionTimestamp)) + } + return n +} + func (m *SpaceSignResponse) Size() (n int) { if m == nil { return 0 @@ -1133,11 +1250,9 @@ func (m *SpaceStatusCheckResponse) Size() (n int) { } var l int _ = l - if m.Status != 0 { - n += 1 + sovCoordinator(uint64(m.Status)) - } - if m.DeletionTimestamp != 0 { - n += 1 + sovCoordinator(uint64(m.DeletionTimestamp)) + if m.Payload != nil { + l = m.Payload.Size() + n += 1 + l + sovCoordinator(uint64(l)) } return n } @@ -1169,6 +1284,10 @@ func (m *SpaceStatusChangeResponse) Size() (n int) { } var l int _ = l + if m.Payload != nil { + l = m.Payload.Size() + n += 1 + l + sovCoordinator(uint64(l)) + } return n } @@ -1294,6 +1413,94 @@ func (m *SpaceSignRequest) Unmarshal(dAtA []byte) error { } return nil } +func (m *SpaceStatusPayload) 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 ErrIntOverflowCoordinator + } + 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: SpaceStatusPayload: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SpaceStatusPayload: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoordinator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= SpaceStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DeletionTimestamp", wireType) + } + m.DeletionTimestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoordinator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DeletionTimestamp |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipCoordinator(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCoordinator + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *SpaceSignResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1996,10 +2203,10 @@ func (m *SpaceStatusCheckResponse) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) } - m.Status = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowCoordinator @@ -2009,30 +2216,28 @@ func (m *SpaceStatusCheckResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Status |= SpaceStatus(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DeletionTimestamp", wireType) + if msglen < 0 { + return ErrInvalidLengthCoordinator } - m.DeletionTimestamp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoordinator - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.DeletionTimestamp |= int64(b&0x7F) << shift - if b < 0x80 { - break - } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCoordinator } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Payload == nil { + m.Payload = &SpaceStatusPayload{} + } + if err := m.Payload.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipCoordinator(dAtA[iNdEx:]) @@ -2231,6 +2436,42 @@ func (m *SpaceStatusChangeResponse) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: SpaceStatusChangeResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoordinator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCoordinator + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCoordinator + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Payload == nil { + m.Payload = &SpaceStatusPayload{} + } + if err := m.Payload.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipCoordinator(dAtA[iNdEx:]) diff --git a/coordinator/coordinatorproto/protos/coordinator.proto b/coordinator/coordinatorproto/protos/coordinator.proto index 3d8a6959..4e2c2777 100644 --- a/coordinator/coordinatorproto/protos/coordinator.proto +++ b/coordinator/coordinatorproto/protos/coordinator.proto @@ -32,6 +32,11 @@ enum SpaceStatus { SpaceStatusDeleted = 3; } +message SpaceStatusPayload { + SpaceStatus status = 1; + int64 deletionTimestamp = 2; +} + message SpaceSignResponse { SpaceReceiptWithSignature receipt = 1; } @@ -73,10 +78,9 @@ message SpaceStatusCheckRequest { string spaceId = 1; } -// SpaceStatusCheckResponse contains the status and deletion timestamp if needed +// SpaceStatusCheckResponse contains the current status of space message SpaceStatusCheckResponse { - SpaceStatus status = 1; - int64 deletionTimestamp = 2; + SpaceStatusPayload payload = 1; } // SpaceStatusChangeRequest contains the deletionChange if we want to delete space, or it is empty otherwise @@ -86,5 +90,7 @@ message SpaceStatusChangeRequest { bytes deletionChangePayload = 3; } -// SpaceStatusChangeResponse is always empty, you should check error in case something was wrong -message SpaceStatusChangeResponse {} +// SpaceStatusChangeResponse contains changed status of space +message SpaceStatusChangeResponse { + SpaceStatusPayload payload = 1; +}