mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-08 05:57:03 +09:00
GO-1931: consensusproto delete log method
This commit is contained in:
parent
b4b7cf2320
commit
eeea38bf2a
5 changed files with 297 additions and 62 deletions
|
@ -37,6 +37,8 @@ type Watcher interface {
|
|||
type Service interface {
|
||||
// AddLog adds new log to consensus servers
|
||||
AddLog(ctx context.Context, rec *consensusproto.RawRecordWithId) (err error)
|
||||
// DeleteLog deletes the log from the consensus node
|
||||
DeleteLog(ctx context.Context, logId string) (err error)
|
||||
// AddRecord adds new record to consensus servers
|
||||
AddRecord(ctx context.Context, logId string, rec *consensusproto.RawRecord) (record *consensusproto.RawRecordWithId, err error)
|
||||
// Watch starts watching to given logId and calls watcher when any relative event received
|
||||
|
@ -97,6 +99,17 @@ func (s *service) AddLog(ctx context.Context, rec *consensusproto.RawRecordWithI
|
|||
})
|
||||
}
|
||||
|
||||
func (s *service) DeleteLog(ctx context.Context, logId string) (err error) {
|
||||
return s.doClient(ctx, func(cl consensusproto.DRPCConsensusClient) error {
|
||||
if _, err = cl.LogDelete(ctx, &consensusproto.LogDeleteRequest{
|
||||
LogId: logId,
|
||||
}); err != nil {
|
||||
return rpcerr.Unwrap(err)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (s *service) AddRecord(ctx context.Context, logId string, rec *consensusproto.RawRecord) (record *consensusproto.RawRecordWithId, err error) {
|
||||
err = s.doClient(ctx, func(cl consensusproto.DRPCConsensusClient) error {
|
||||
if record, err = cl.RecordAdd(ctx, &consensusproto.RecordAddRequest{
|
||||
|
|
|
@ -180,6 +180,10 @@ type testServer struct {
|
|||
watchErrOnce bool
|
||||
}
|
||||
|
||||
func (t *testServer) LogDelete(ctx context.Context, req *consensusproto.LogDeleteRequest) (*consensusproto.Ok, error) {
|
||||
return &consensusproto.Ok{}, nil
|
||||
}
|
||||
|
||||
func (t *testServer) LogAdd(ctx context.Context, req *consensusproto.LogAddRequest) (*consensusproto.Ok, error) {
|
||||
if t.addLog != nil {
|
||||
if err := t.addLog(ctx, req); err != nil {
|
||||
|
|
|
@ -558,6 +558,50 @@ func (m *LogWatchEvent) GetError() *Err {
|
|||
return nil
|
||||
}
|
||||
|
||||
type LogDeleteRequest struct {
|
||||
LogId string `protobuf:"bytes,1,opt,name=logId,proto3" json:"logId,omitempty"`
|
||||
}
|
||||
|
||||
func (m *LogDeleteRequest) Reset() { *m = LogDeleteRequest{} }
|
||||
func (m *LogDeleteRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*LogDeleteRequest) ProtoMessage() {}
|
||||
func (*LogDeleteRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_b8d7f1c16b400059, []int{9}
|
||||
}
|
||||
func (m *LogDeleteRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *LogDeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_LogDeleteRequest.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 *LogDeleteRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_LogDeleteRequest.Merge(m, src)
|
||||
}
|
||||
func (m *LogDeleteRequest) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *LogDeleteRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_LogDeleteRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_LogDeleteRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *LogDeleteRequest) GetLogId() string {
|
||||
if m != nil {
|
||||
return m.LogId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type Err struct {
|
||||
Error ErrCodes `protobuf:"varint,1,opt,name=error,proto3,enum=consensusProto.ErrCodes" json:"error,omitempty"`
|
||||
}
|
||||
|
@ -566,7 +610,7 @@ func (m *Err) Reset() { *m = Err{} }
|
|||
func (m *Err) String() string { return proto.CompactTextString(m) }
|
||||
func (*Err) ProtoMessage() {}
|
||||
func (*Err) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_b8d7f1c16b400059, []int{9}
|
||||
return fileDescriptor_b8d7f1c16b400059, []int{10}
|
||||
}
|
||||
func (m *Err) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -616,7 +660,7 @@ func (m *LogSyncContentValue) Reset() { *m = LogSyncContentValue{} }
|
|||
func (m *LogSyncContentValue) String() string { return proto.CompactTextString(m) }
|
||||
func (*LogSyncContentValue) ProtoMessage() {}
|
||||
func (*LogSyncContentValue) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_b8d7f1c16b400059, []int{10}
|
||||
return fileDescriptor_b8d7f1c16b400059, []int{11}
|
||||
}
|
||||
func (m *LogSyncContentValue) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -713,7 +757,7 @@ func (m *LogSyncMessage) Reset() { *m = LogSyncMessage{} }
|
|||
func (m *LogSyncMessage) String() string { return proto.CompactTextString(m) }
|
||||
func (*LogSyncMessage) ProtoMessage() {}
|
||||
func (*LogSyncMessage) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_b8d7f1c16b400059, []int{11}
|
||||
return fileDescriptor_b8d7f1c16b400059, []int{12}
|
||||
}
|
||||
func (m *LogSyncMessage) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -773,7 +817,7 @@ func (m *LogHeadUpdate) Reset() { *m = LogHeadUpdate{} }
|
|||
func (m *LogHeadUpdate) String() string { return proto.CompactTextString(m) }
|
||||
func (*LogHeadUpdate) ProtoMessage() {}
|
||||
func (*LogHeadUpdate) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_b8d7f1c16b400059, []int{12}
|
||||
return fileDescriptor_b8d7f1c16b400059, []int{13}
|
||||
}
|
||||
func (m *LogHeadUpdate) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -826,7 +870,7 @@ func (m *LogFullSyncRequest) Reset() { *m = LogFullSyncRequest{} }
|
|||
func (m *LogFullSyncRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*LogFullSyncRequest) ProtoMessage() {}
|
||||
func (*LogFullSyncRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_b8d7f1c16b400059, []int{13}
|
||||
return fileDescriptor_b8d7f1c16b400059, []int{14}
|
||||
}
|
||||
func (m *LogFullSyncRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -879,7 +923,7 @@ func (m *LogFullSyncResponse) Reset() { *m = LogFullSyncResponse{} }
|
|||
func (m *LogFullSyncResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*LogFullSyncResponse) ProtoMessage() {}
|
||||
func (*LogFullSyncResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_b8d7f1c16b400059, []int{14}
|
||||
return fileDescriptor_b8d7f1c16b400059, []int{15}
|
||||
}
|
||||
func (m *LogFullSyncResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
|
@ -933,6 +977,7 @@ func init() {
|
|||
proto.RegisterType((*RecordAddRequest)(nil), "consensusProto.RecordAddRequest")
|
||||
proto.RegisterType((*LogWatchRequest)(nil), "consensusProto.LogWatchRequest")
|
||||
proto.RegisterType((*LogWatchEvent)(nil), "consensusProto.LogWatchEvent")
|
||||
proto.RegisterType((*LogDeleteRequest)(nil), "consensusProto.LogDeleteRequest")
|
||||
proto.RegisterType((*Err)(nil), "consensusProto.Err")
|
||||
proto.RegisterType((*LogSyncContentValue)(nil), "consensusProto.LogSyncContentValue")
|
||||
proto.RegisterType((*LogSyncMessage)(nil), "consensusProto.LogSyncMessage")
|
||||
|
@ -946,58 +991,60 @@ func init() {
|
|||
}
|
||||
|
||||
var fileDescriptor_b8d7f1c16b400059 = []byte{
|
||||
// 806 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x6f, 0xeb, 0x44,
|
||||
0x10, 0x8f, 0xed, 0xfc, 0x9d, 0xf0, 0x12, 0x33, 0x0f, 0x21, 0x13, 0xf1, 0xf2, 0x22, 0x73, 0x09,
|
||||
0x4f, 0x28, 0x0f, 0x82, 0x10, 0x42, 0x15, 0x42, 0x34, 0x4a, 0x95, 0x48, 0x69, 0x5a, 0x5c, 0x4a,
|
||||
0x25, 0x90, 0x90, 0x5c, 0xef, 0xc6, 0xb5, 0x9a, 0x7a, 0x8d, 0xbd, 0x49, 0x9b, 0x2b, 0x1c, 0xb9,
|
||||
0xf0, 0xb1, 0x90, 0xb8, 0xf4, 0xc8, 0x11, 0xb5, 0x17, 0x3e, 0x00, 0x1f, 0x00, 0x79, 0xfd, 0x27,
|
||||
0xae, 0x93, 0x14, 0x10, 0xbd, 0xb4, 0x9e, 0x99, 0xdf, 0xfc, 0x66, 0xe6, 0xb7, 0xbb, 0xa3, 0xc0,
|
||||
0x6b, 0x8b, 0xb9, 0x01, 0x75, 0x83, 0x45, 0xb0, 0xfe, 0xf2, 0x7c, 0xc6, 0xd9, 0x6b, 0xf1, 0x37,
|
||||
0xe3, 0xed, 0x09, 0x07, 0x36, 0x52, 0xc7, 0x71, 0x68, 0xeb, 0xc7, 0xa0, 0x4c, 0x98, 0x8d, 0x0d,
|
||||
0x90, 0x1d, 0xa2, 0x49, 0x1d, 0xa9, 0x5b, 0x33, 0x64, 0x87, 0xe0, 0x67, 0x50, 0xf1, 0xa9, 0xc5,
|
||||
0x7c, 0x12, 0x68, 0x4a, 0x47, 0xe9, 0xd6, 0xfb, 0x2f, 0x7b, 0x0f, 0x13, 0x7b, 0x86, 0x79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x32, 0x86, 0xeb, 0xdf,
|
||||
0x81, 0x1a, 0xf9, 0x33, 0x64, 0x6f, 0x41, 0x69, 0xce, 0xec, 0x74, 0x90, 0xc8, 0xc0, 0x8f, 0xd2,
|
||||
0x12, 0xb2, 0x28, 0xf1, 0xce, 0xce, 0x12, 0x29, 0xf9, 0x21, 0x34, 0x27, 0xcc, 0x3e, 0x33, 0xb9,
|
||||
0x75, 0x91, 0x70, 0xb7, 0xa0, 0x7a, 0x1d, 0xda, 0x63, 0x12, 0x68, 0x52, 0x47, 0xe9, 0xd6, 0x8c,
|
||||
0xd4, 0xc6, 0x36, 0xc0, 0xc2, 0x4d, 0xa3, 0xb2, 0x88, 0x66, 0x3c, 0xfa, 0xcf, 0x92, 0x18, 0x5b,
|
||||
0xf0, 0x0d, 0x97, 0xd4, 0xdd, 0xd5, 0x69, 0xe6, 0x66, 0xcb, 0xff, 0xed, 0x66, 0xe3, 0xfb, 0x50,
|
||||
0xa2, 0xbe, 0xcf, 0x7c, 0x71, 0x22, 0xf5, 0xfe, 0xf3, 0x7c, 0xe2, 0xd0, 0xf7, 0x8d, 0x08, 0xa1,
|
||||
0x7f, 0x02, 0xca, 0xd0, 0xf7, 0xb1, 0x97, 0x64, 0x84, 0x2d, 0x34, 0xfa, 0xda, 0x96, 0x8c, 0x01,
|
||||
0x23, 0x34, 0x48, 0xd2, 0x7e, 0x94, 0xe1, 0xf9, 0x84, 0xd9, 0x27, 0x2b, 0xd7, 0x1a, 0x30, 0x97,
|
||||
0x53, 0x97, 0x7f, 0x63, 0xce, 0x17, 0x14, 0xbf, 0x00, 0xb8, 0xa0, 0x26, 0x39, 0xf5, 0x88, 0xc9,
|
||||
0x69, 0x7c, 0x8a, 0x2f, 0xf2, 0x64, 0x13, 0x66, 0x8f, 0x52, 0xd0, 0xa8, 0x60, 0x64, 0x52, 0x70,
|
||||
0x0a, 0xcd, 0xd9, 0x62, 0x3e, 0x0f, 0x89, 0x63, 0xb1, 0xe3, 0x83, 0xd2,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a, 0x42, 0x15, 0xea, 0xc3, 0xf0,
|
||||
0x9d, 0x1c, 0xcd, 0x66, 0x01, 0xe5, 0xea, 0x5f, 0x4a, 0xff, 0x4f, 0x09, 0x6a, 0x83, 0xa4, 0x63,
|
||||
0xdc, 0x83, 0x72, 0xb4, 0xf9, 0x70, 0xdb, 0xe3, 0x58, 0x2f, 0xb1, 0x16, 0xe6, 0xc3, 0x47, 0x97,
|
||||
0x38, 0x85, 0x5a, 0xba, 0xec, 0xb0, 0xb3, 0xa1, 0x43, 0x6e, 0x0f, 0xb6, 0xfe, 0x49, 0x29, 0x9c,
|
||||
0x42, 0x35, 0xd9, 0x47, 0xf8, 0x72, 0x4b, 0x3b, 0xd9, 0xcd, 0xd7, 0x7a, 0xb1, 0x0b, 0x20, 0x56,
|
||||
0x59, 0x57, 0xfa, 0x50, 0xda, 0xef, 0xff, 0x7a, 0xd7, 0x96, 0x6e, 0xef, 0xda, 0xd2, 0x1f, 0x77,
|
||||
0x6d, 0xe9, 0x97, 0xfb, 0x76, 0xe1, 0xf6, 0xbe, 0x5d, 0xf8, 0xfd, 0xbe, 0x5d, 0xf8, 0x56, 0xdb,
|
||||
0xf5, 0x23, 0xe0, 0xbc, 0x2c, 0xfe, 0x7d, 0xfc, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x98, 0x49,
|
||||
0x74, 0x26, 0x27, 0x08, 0x00, 0x00,
|
||||
// 833 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x8f, 0xdb, 0x54,
|
||||
0x10, 0x8f, 0xed, 0x24, 0x9b, 0x4c, 0x68, 0x62, 0xa6, 0x08, 0x99, 0x88, 0xa6, 0x91, 0xb9, 0x84,
|
||||
0x0a, 0xa5, 0x10, 0x84, 0x10, 0xaa, 0x10, 0x6a, 0x43, 0x56, 0x89, 0xe4, 0x66, 0x17, 0x97, 0x52,
|
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69, 0x63, 0xf6, 0xff, 0x49, 0x29, 0x5c, 0x42, 0x2b,
|
||||
0xdb, 0x5c, 0x78, 0x7b, 0x4f, 0x3b, 0xc5, 0x1d, 0xd9, 0xbf, 0x75, 0x08, 0x20, 0x96, 0xde, 0x48,
|
||||
0xfa, 0x50, 0xc2, 0xfb, 0x42, 0xd3, 0x64, 0xf9, 0x54, 0xfb, 0x2b, 0xef, 0xa5, 0x7d, 0x23, 0x3e,
|
||||
0x98, 0xfc, 0x76, 0x39, 0x90, 0x5e, 0x5d, 0x0e, 0xa4, 0x3f, 0x2f, 0x07, 0xd2, 0x2f, 0x57, 0x83,
|
||||
0xda, 0xab, 0xab, 0x41, 0xed, 0x8f, 0xab, 0x41, 0xed, 0x5b, 0xed, 0xd0, 0x2f, 0x8e, 0xa7, 0x4d,
|
||||
0xf1, 0xef, 0xe3, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x75, 0xd4, 0x24, 0x0c, 0x94, 0x08, 0x00,
|
||||
0x00,
|
||||
}
|
||||
|
||||
func (m *Log) Marshal() (dAtA []byte, err error) {
|
||||
|
@ -1383,6 +1430,36 @@ func (m *LogWatchEvent) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *LogDeleteRequest) 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 *LogDeleteRequest) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *LogDeleteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.LogId) > 0 {
|
||||
i -= len(m.LogId)
|
||||
copy(dAtA[i:], m.LogId)
|
||||
i = encodeVarintConsensus(dAtA, i, uint64(len(m.LogId)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *Err) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
|
@ -1869,6 +1946,19 @@ func (m *LogWatchEvent) Size() (n int) {
|
|||
return n
|
||||
}
|
||||
|
||||
func (m *LogDeleteRequest) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.LogId)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovConsensus(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *Err) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
|
@ -3139,6 +3229,88 @@ func (m *LogWatchEvent) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
func (m *LogDeleteRequest) 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 ErrIntOverflowConsensus
|
||||
}
|
||||
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: LogDeleteRequest: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: LogDeleteRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field LogId", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowConsensus
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthConsensus
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthConsensus
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.LogId = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipConsensus(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthConsensus
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *Err) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
|
|
@ -43,6 +43,7 @@ type DRPCConsensusClient interface {
|
|||
LogAdd(ctx context.Context, in *LogAddRequest) (*Ok, error)
|
||||
RecordAdd(ctx context.Context, in *RecordAddRequest) (*RawRecordWithId, error)
|
||||
LogWatch(ctx context.Context) (DRPCConsensus_LogWatchClient, error)
|
||||
LogDelete(ctx context.Context, in *LogDeleteRequest) (*Ok, error)
|
||||
}
|
||||
|
||||
type drpcConsensusClient struct {
|
||||
|
@ -112,10 +113,20 @@ func (x *drpcConsensus_LogWatchClient) RecvMsg(m *LogWatchEvent) error {
|
|||
return x.MsgRecv(m, drpcEncoding_File_consensus_consensusproto_protos_consensus_proto{})
|
||||
}
|
||||
|
||||
func (c *drpcConsensusClient) LogDelete(ctx context.Context, in *LogDeleteRequest) (*Ok, error) {
|
||||
out := new(Ok)
|
||||
err := c.cc.Invoke(ctx, "/consensusProto.Consensus/LogDelete", drpcEncoding_File_consensus_consensusproto_protos_consensus_proto{}, in, out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
type DRPCConsensusServer interface {
|
||||
LogAdd(context.Context, *LogAddRequest) (*Ok, error)
|
||||
RecordAdd(context.Context, *RecordAddRequest) (*RawRecordWithId, error)
|
||||
LogWatch(DRPCConsensus_LogWatchStream) error
|
||||
LogDelete(context.Context, *LogDeleteRequest) (*Ok, error)
|
||||
}
|
||||
|
||||
type DRPCConsensusUnimplementedServer struct{}
|
||||
|
@ -132,9 +143,13 @@ func (s *DRPCConsensusUnimplementedServer) LogWatch(DRPCConsensus_LogWatchStream
|
|||
return drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||
}
|
||||
|
||||
func (s *DRPCConsensusUnimplementedServer) LogDelete(context.Context, *LogDeleteRequest) (*Ok, error) {
|
||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
||||
}
|
||||
|
||||
type DRPCConsensusDescription struct{}
|
||||
|
||||
func (DRPCConsensusDescription) NumMethods() int { return 3 }
|
||||
func (DRPCConsensusDescription) NumMethods() int { return 4 }
|
||||
|
||||
func (DRPCConsensusDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
|
||||
switch n {
|
||||
|
@ -164,6 +179,15 @@ func (DRPCConsensusDescription) Method(n int) (string, drpc.Encoding, drpc.Recei
|
|||
&drpcConsensus_LogWatchStream{in1.(drpc.Stream)},
|
||||
)
|
||||
}, DRPCConsensusServer.LogWatch, true
|
||||
case 3:
|
||||
return "/consensusProto.Consensus/LogDelete", drpcEncoding_File_consensus_consensusproto_protos_consensus_proto{},
|
||||
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
||||
return srv.(DRPCConsensusServer).
|
||||
LogDelete(
|
||||
ctx,
|
||||
in1.(*LogDeleteRequest),
|
||||
)
|
||||
}, DRPCConsensusServer.LogDelete, true
|
||||
default:
|
||||
return "", nil, nil, nil, false
|
||||
}
|
||||
|
@ -230,3 +254,19 @@ func (x *drpcConsensus_LogWatchStream) Recv() (*LogWatchRequest, error) {
|
|||
func (x *drpcConsensus_LogWatchStream) RecvMsg(m *LogWatchRequest) error {
|
||||
return x.MsgRecv(m, drpcEncoding_File_consensus_consensusproto_protos_consensus_proto{})
|
||||
}
|
||||
|
||||
type DRPCConsensus_LogDeleteStream interface {
|
||||
drpc.Stream
|
||||
SendAndClose(*Ok) error
|
||||
}
|
||||
|
||||
type drpcConsensus_LogDeleteStream struct {
|
||||
drpc.Stream
|
||||
}
|
||||
|
||||
func (x *drpcConsensus_LogDeleteStream) SendAndClose(m *Ok) error {
|
||||
if err := x.MsgSend(m, drpcEncoding_File_consensus_consensusproto_protos_consensus_proto{}); err != nil {
|
||||
return err
|
||||
}
|
||||
return x.CloseSend()
|
||||
}
|
||||
|
|
|
@ -44,12 +44,14 @@ message Record {
|
|||
|
||||
|
||||
service Consensus {
|
||||
// AddLog adds new log to consensus
|
||||
// LogAdd adds new log to consensus
|
||||
rpc LogAdd(LogAddRequest) returns (Ok);
|
||||
// AddRecord adds new record to log
|
||||
// RecordAdd adds new record to log
|
||||
rpc RecordAdd(RecordAddRequest) returns (RawRecordWithId);
|
||||
// WatchLog fetches log and subscribes for a changes
|
||||
// LogWatch fetches log and subscribes for a changes
|
||||
rpc LogWatch(stream LogWatchRequest) returns (stream LogWatchEvent);
|
||||
// LogDelete deletes the log from the consensus
|
||||
rpc LogDelete(LogDeleteRequest) returns (Ok);
|
||||
}
|
||||
|
||||
message Ok {}
|
||||
|
@ -75,6 +77,10 @@ message LogWatchEvent {
|
|||
Err error = 3;
|
||||
}
|
||||
|
||||
message LogDeleteRequest {
|
||||
string logId = 1;
|
||||
}
|
||||
|
||||
message Err {
|
||||
ErrCodes error = 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue