Merge remote-tracking branch 'origin/consensus-client' into acl-sync-protocol

# Conflicts:
#	consensus/consensusproto/consensus.pb.go
This commit is contained in:
mcrakhman 2023-07-03 17:16:43 +02:00
commit 8aa41da1ff
No known key found for this signature in database
GPG Key ID: DED12CFEF5B8396B
5 changed files with 131 additions and 138 deletions

View File

@ -38,11 +38,11 @@ type Service interface {
// AddLog adds new log to consensus servers // AddLog adds new log to consensus servers
AddLog(ctx context.Context, clog *consensusproto.Log) (err error) AddLog(ctx context.Context, clog *consensusproto.Log) (err error)
// AddRecord adds new record to consensus servers // AddRecord adds new record to consensus servers
AddRecord(ctx context.Context, logId []byte, clog *consensusproto.RawRecord) (record *consensusproto.RawRecordWithId, err error) AddRecord(ctx context.Context, logId string, clog *consensusproto.RawRecord) (record *consensusproto.RawRecordWithId, err error)
// Watch starts watching to given logId and calls watcher when any relative event received // Watch starts watching to given logId and calls watcher when any relative event received
Watch(logId []byte, w Watcher) (err error) Watch(logId string, w Watcher) (err error)
// UnWatch stops watching given logId and removes watcher // UnWatch stops watching given logId and removes watcher
UnWatch(logId []byte) (err error) UnWatch(logId string) (err error)
app.ComponentRunnable app.ComponentRunnable
} }
@ -97,7 +97,7 @@ func (s *service) AddLog(ctx context.Context, clog *consensusproto.Log) (err err
}) })
} }
func (s *service) AddRecord(ctx context.Context, logId []byte, clog *consensusproto.RawRecord) (record *consensusproto.RawRecordWithId, err error) { func (s *service) AddRecord(ctx context.Context, logId string, clog *consensusproto.RawRecord) (record *consensusproto.RawRecordWithId, err error) {
err = s.doClient(ctx, func(cl consensusproto.DRPCConsensusClient) error { err = s.doClient(ctx, func(cl consensusproto.DRPCConsensusClient) error {
if record, err = cl.RecordAdd(ctx, &consensusproto.RecordAddRequest{ if record, err = cl.RecordAdd(ctx, &consensusproto.RecordAddRequest{
LogId: logId, LogId: logId,
@ -110,30 +110,30 @@ func (s *service) AddRecord(ctx context.Context, logId []byte, clog *consensuspr
return return
} }
func (s *service) Watch(logId []byte, w Watcher) (err error) { func (s *service) Watch(logId string, w Watcher) (err error) {
s.mu.Lock() s.mu.Lock()
defer s.mu.Unlock() defer s.mu.Unlock()
if _, ok := s.watchers[string(logId)]; ok { if _, ok := s.watchers[logId]; ok {
return ErrWatcherExists return ErrWatcherExists
} }
s.watchers[string(logId)] = w s.watchers[logId] = w
if s.stream != nil { if s.stream != nil {
if wErr := s.stream.WatchIds([][]byte{logId}); wErr != nil { if wErr := s.stream.WatchIds([]string{logId}); wErr != nil {
log.Warn("WatchIds error", zap.Error(wErr)) log.Warn("WatchIds error", zap.Error(wErr))
} }
} }
return return
} }
func (s *service) UnWatch(logId []byte) (err error) { func (s *service) UnWatch(logId string) (err error) {
s.mu.Lock() s.mu.Lock()
defer s.mu.Unlock() defer s.mu.Unlock()
if _, ok := s.watchers[string(logId)]; !ok { if _, ok := s.watchers[logId]; !ok {
return ErrWatcherNotExists return ErrWatcherNotExists
} }
delete(s.watchers, string(logId)) delete(s.watchers, logId)
if s.stream != nil { if s.stream != nil {
if wErr := s.stream.UnwatchIds([][]byte{logId}); wErr != nil { if wErr := s.stream.UnwatchIds([]string{logId}); wErr != nil {
log.Warn("UnWatchIds error", zap.Error(wErr)) log.Warn("UnWatchIds error", zap.Error(wErr))
} }
} }
@ -182,9 +182,9 @@ func (s *service) streamWatcher() {
// collect ids and setup stream // collect ids and setup stream
s.mu.Lock() s.mu.Lock()
var logIds = make([][]byte, 0, len(s.watchers)) var logIds = make([]string, 0, len(s.watchers))
for id := range s.watchers { for id := range s.watchers {
logIds = append(logIds, []byte(id)) logIds = append(logIds, id)
} }
s.stream = st s.stream = st
s.mu.Unlock() s.mu.Unlock()
@ -213,14 +213,14 @@ func (s *service) streamReader() error {
return s.stream.Err() return s.stream.Err()
} }
for _, e := range events { for _, e := range events {
if w, ok := s.watchers[string(e.LogId)]; ok { if w, ok := s.watchers[e.LogId]; ok {
if e.Error == nil { if e.Error == nil {
w.AddConsensusRecords(e.Records) w.AddConsensusRecords(e.Records)
} else { } else {
w.AddConsensusError(rpcerr.Err(uint64(e.Error.Error))) w.AddConsensusError(rpcerr.Err(uint64(e.Error.Error)))
} }
} else { } else {
log.Warn("received unexpected log id", zap.Binary("logId", e.LogId)) log.Warn("received unexpected log id", zap.String("logId", e.LogId))
} }
} }
} }

View File

@ -24,13 +24,13 @@ func TestService_Watch(t *testing.T) {
t.Run("not found error", func(t *testing.T) { t.Run("not found error", func(t *testing.T) {
fx := newFixture(t).run(t) fx := newFixture(t).run(t)
defer fx.Finish() defer fx.Finish()
var logId = []byte{'1'} var logId = "1"
w := &testWatcher{ready: make(chan struct{})} w := &testWatcher{ready: make(chan struct{})}
require.NoError(t, fx.Watch(logId, w)) require.NoError(t, fx.Watch(logId, w))
st := fx.testServer.waitStream(t) st := fx.testServer.waitStream(t)
req, err := st.Recv() req, err := st.Recv()
require.NoError(t, err) require.NoError(t, err)
assert.Equal(t, [][]byte{logId}, req.WatchIds) assert.Equal(t, []string{logId}, req.WatchIds)
require.NoError(t, st.Send(&consensusproto.LogWatchEvent{ require.NoError(t, st.Send(&consensusproto.LogWatchEvent{
LogId: logId, LogId: logId,
Error: &consensusproto.Err{ Error: &consensusproto.Err{
@ -44,7 +44,7 @@ func TestService_Watch(t *testing.T) {
t.Run("watcherExists error", func(t *testing.T) { t.Run("watcherExists error", func(t *testing.T) {
fx := newFixture(t).run(t) fx := newFixture(t).run(t)
defer fx.Finish() defer fx.Finish()
var logId = []byte{'1'} var logId = "1"
w := &testWatcher{} w := &testWatcher{}
require.NoError(t, fx.Watch(logId, w)) require.NoError(t, fx.Watch(logId, w))
require.Error(t, fx.Watch(logId, w)) require.Error(t, fx.Watch(logId, w))
@ -55,20 +55,20 @@ func TestService_Watch(t *testing.T) {
t.Run("watch", func(t *testing.T) { t.Run("watch", func(t *testing.T) {
fx := newFixture(t).run(t) fx := newFixture(t).run(t)
defer fx.Finish() defer fx.Finish()
var logId1 = []byte{'1'} var logId1 = "1"
w := &testWatcher{} w := &testWatcher{}
require.NoError(t, fx.Watch(logId1, w)) require.NoError(t, fx.Watch(logId1, w))
st := fx.testServer.waitStream(t) st := fx.testServer.waitStream(t)
req, err := st.Recv() req, err := st.Recv()
require.NoError(t, err) require.NoError(t, err)
assert.Equal(t, [][]byte{logId1}, req.WatchIds) assert.Equal(t, []string{logId1}, req.WatchIds)
var logId2 = []byte{'2'} var logId2 = "2"
w = &testWatcher{} w = &testWatcher{}
require.NoError(t, fx.Watch(logId2, w)) require.NoError(t, fx.Watch(logId2, w))
req, err = st.Recv() req, err = st.Recv()
require.NoError(t, err) require.NoError(t, err)
assert.Equal(t, [][]byte{logId2}, req.WatchIds) assert.Equal(t, []string{logId2}, req.WatchIds)
fx.testServer.releaseStream <- nil fx.testServer.releaseStream <- nil
}) })
@ -78,14 +78,14 @@ func TestService_UnWatch(t *testing.T) {
t.Run("no watcher", func(t *testing.T) { t.Run("no watcher", func(t *testing.T) {
fx := newFixture(t).run(t) fx := newFixture(t).run(t)
defer fx.Finish() defer fx.Finish()
require.Error(t, fx.UnWatch([]byte{'1'})) require.Error(t, fx.UnWatch("1"))
}) })
t.Run("success", func(t *testing.T) { t.Run("success", func(t *testing.T) {
fx := newFixture(t).run(t) fx := newFixture(t).run(t)
defer fx.Finish() defer fx.Finish()
w := &testWatcher{} w := &testWatcher{}
require.NoError(t, fx.Watch([]byte{'1'}, w)) require.NoError(t, fx.Watch("1", w))
assert.NoError(t, fx.UnWatch([]byte{'1'})) assert.NoError(t, fx.UnWatch("1"))
}) })
} }
@ -119,7 +119,7 @@ func TestService_AddLog(t *testing.T) {
func TestService_AddRecord(t *testing.T) { func TestService_AddRecord(t *testing.T) {
fx := newFixture(t).run(t) fx := newFixture(t).run(t)
defer fx.Finish() defer fx.Finish()
rec, err := fx.AddRecord(ctx, []byte{'1'}, &consensusproto.RawRecord{}) rec, err := fx.AddRecord(ctx, "1", &consensusproto.RawRecord{})
require.NoError(t, err) require.NoError(t, err)
assert.NotEmpty(t, rec) assert.NotEmpty(t, rec)
} }

View File

@ -23,13 +23,13 @@ type stream struct {
err error err error
} }
func (s *stream) WatchIds(logIds [][]byte) (err error) { func (s *stream) WatchIds(logIds []string) (err error) {
return s.rpcStream.Send(&consensusproto.LogWatchRequest{ return s.rpcStream.Send(&consensusproto.LogWatchRequest{
WatchIds: logIds, WatchIds: logIds,
}) })
} }
func (s *stream) UnwatchIds(logIds [][]byte) (err error) { func (s *stream) UnwatchIds(logIds []string) (err error) {
return s.rpcStream.Send(&consensusproto.LogWatchRequest{ return s.rpcStream.Send(&consensusproto.LogWatchRequest{
UnwatchIds: logIds, UnwatchIds: logIds,
}) })

View File

@ -57,7 +57,7 @@ func (ErrCodes) EnumDescriptor() ([]byte, []int) {
} }
type Log struct { type Log struct {
Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
Records []*RawRecordWithId `protobuf:"bytes,3,rep,name=records,proto3" json:"records,omitempty"` Records []*RawRecordWithId `protobuf:"bytes,3,rep,name=records,proto3" json:"records,omitempty"`
} }
@ -95,11 +95,11 @@ func (m *Log) XXX_DiscardUnknown() {
var xxx_messageInfo_Log proto.InternalMessageInfo var xxx_messageInfo_Log proto.InternalMessageInfo
func (m *Log) GetId() []byte { func (m *Log) GetId() string {
if m != nil { if m != nil {
return m.Id return m.Id
} }
return nil return ""
} }
func (m *Log) GetPayload() []byte { func (m *Log) GetPayload() []byte {
@ -388,7 +388,7 @@ func (m *LogAddRequest) GetLog() *Log {
} }
type RecordAddRequest struct { type RecordAddRequest struct {
LogId []byte `protobuf:"bytes,1,opt,name=logId,proto3" json:"logId,omitempty"` LogId string `protobuf:"bytes,1,opt,name=logId,proto3" json:"logId,omitempty"`
Record *RawRecord `protobuf:"bytes,2,opt,name=record,proto3" json:"record,omitempty"` Record *RawRecord `protobuf:"bytes,2,opt,name=record,proto3" json:"record,omitempty"`
} }
@ -425,11 +425,11 @@ func (m *RecordAddRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_RecordAddRequest proto.InternalMessageInfo var xxx_messageInfo_RecordAddRequest proto.InternalMessageInfo
func (m *RecordAddRequest) GetLogId() []byte { func (m *RecordAddRequest) GetLogId() string {
if m != nil { if m != nil {
return m.LogId return m.LogId
} }
return nil return ""
} }
func (m *RecordAddRequest) GetRecord() *RawRecord { func (m *RecordAddRequest) GetRecord() *RawRecord {
@ -440,8 +440,8 @@ func (m *RecordAddRequest) GetRecord() *RawRecord {
} }
type LogWatchRequest struct { type LogWatchRequest struct {
WatchIds [][]byte `protobuf:"bytes,1,rep,name=watchIds,proto3" json:"watchIds,omitempty"` WatchIds []string `protobuf:"bytes,1,rep,name=watchIds,proto3" json:"watchIds,omitempty"`
UnwatchIds [][]byte `protobuf:"bytes,2,rep,name=unwatchIds,proto3" json:"unwatchIds,omitempty"` UnwatchIds []string `protobuf:"bytes,2,rep,name=unwatchIds,proto3" json:"unwatchIds,omitempty"`
} }
func (m *LogWatchRequest) Reset() { *m = LogWatchRequest{} } func (m *LogWatchRequest) Reset() { *m = LogWatchRequest{} }
@ -477,14 +477,14 @@ func (m *LogWatchRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_LogWatchRequest proto.InternalMessageInfo var xxx_messageInfo_LogWatchRequest proto.InternalMessageInfo
func (m *LogWatchRequest) GetWatchIds() [][]byte { func (m *LogWatchRequest) GetWatchIds() []string {
if m != nil { if m != nil {
return m.WatchIds return m.WatchIds
} }
return nil return nil
} }
func (m *LogWatchRequest) GetUnwatchIds() [][]byte { func (m *LogWatchRequest) GetUnwatchIds() []string {
if m != nil { if m != nil {
return m.UnwatchIds return m.UnwatchIds
} }
@ -492,7 +492,7 @@ func (m *LogWatchRequest) GetUnwatchIds() [][]byte {
} }
type LogWatchEvent struct { type LogWatchEvent struct {
LogId []byte `protobuf:"bytes,1,opt,name=logId,proto3" json:"logId,omitempty"` LogId string `protobuf:"bytes,1,opt,name=logId,proto3" json:"logId,omitempty"`
Records []*RawRecordWithId `protobuf:"bytes,2,rep,name=records,proto3" json:"records,omitempty"` Records []*RawRecordWithId `protobuf:"bytes,2,rep,name=records,proto3" json:"records,omitempty"`
Error *Err `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"` Error *Err `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"`
} }
@ -530,11 +530,11 @@ func (m *LogWatchEvent) XXX_DiscardUnknown() {
var xxx_messageInfo_LogWatchEvent proto.InternalMessageInfo var xxx_messageInfo_LogWatchEvent proto.InternalMessageInfo
func (m *LogWatchEvent) GetLogId() []byte { func (m *LogWatchEvent) GetLogId() string {
if m != nil { if m != nil {
return m.LogId return m.LogId
} }
return nil return ""
} }
func (m *LogWatchEvent) GetRecords() []*RawRecordWithId { func (m *LogWatchEvent) GetRecords() []*RawRecordWithId {
@ -939,57 +939,56 @@ func init() {
} }
var fileDescriptor_b8d7f1c16b400059 = []byte{ var fileDescriptor_b8d7f1c16b400059 = []byte{
// 785 bytes of a gzipped FileDescriptorProto // 780 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x5f, 0x4f, 0xdb, 0x56, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcd, 0x4e, 0xe3, 0x56,
0x14, 0x8f, 0x6d, 0x48, 0xe2, 0x93, 0x91, 0x78, 0x87, 0x69, 0xf2, 0xa2, 0x11, 0x22, 0x4f, 0x93, 0x14, 0x8e, 0x6d, 0x48, 0xe2, 0x93, 0x92, 0xb8, 0x87, 0xaa, 0x72, 0xa3, 0x12, 0x22, 0x57, 0x95,
0x18, 0x9a, 0xc2, 0x96, 0x69, 0x93, 0x26, 0x34, 0x4d, 0x23, 0x0a, 0x4a, 0xa4, 0x10,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00, 0xff, 0xff, 0x5e, 0x57, 0x8e, 0x0b, 0xdd, 0x07, 0x00, 0x00,
0x00,
} }
func (m *Log) Marshal() (dAtA []byte, err error) { func (m *Log) Marshal() (dAtA []byte, err error) {
@ -1827,14 +1826,14 @@ func (m *LogWatchRequest) Size() (n int) {
var l int var l int
_ = l _ = l
if len(m.WatchIds) > 0 { if len(m.WatchIds) > 0 {
for _, b := range m.WatchIds { for _, s := range m.WatchIds {
l = len(b) l = len(s)
n += 1 + l + sovConsensus(uint64(l)) n += 1 + l + sovConsensus(uint64(l))
} }
} }
if len(m.UnwatchIds) > 0 { if len(m.UnwatchIds) > 0 {
for _, b := range m.UnwatchIds { for _, s := range m.UnwatchIds {
l = len(b) l = len(s)
n += 1 + l + sovConsensus(uint64(l)) n += 1 + l + sovConsensus(uint64(l))
} }
} }
@ -2041,7 +2040,7 @@ func (m *Log) Unmarshal(dAtA []byte) error {
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType)
} }
var byteLen int var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowConsensus return ErrIntOverflowConsensus
@ -2051,25 +2050,23 @@ func (m *Log) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
byteLen |= int(b&0x7F) << shift stringLen |= uint64(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
} }
if byteLen < 0 { intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthConsensus return ErrInvalidLengthConsensus
} }
postIndex := iNdEx + byteLen postIndex := iNdEx + intStringLen
if postIndex < 0 { if postIndex < 0 {
return ErrInvalidLengthConsensus return ErrInvalidLengthConsensus
} }
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
m.Id = append(m.Id[:0], dAtA[iNdEx:postIndex]...) m.Id = string(dAtA[iNdEx:postIndex])
if m.Id == nil {
m.Id = []byte{}
}
iNdEx = postIndex iNdEx = postIndex
case 2: case 2:
if wireType != 2 { if wireType != 2 {
@ -2800,7 +2797,7 @@ func (m *RecordAddRequest) Unmarshal(dAtA []byte) error {
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field LogId", wireType) return fmt.Errorf("proto: wrong wireType = %d for field LogId", wireType)
} }
var byteLen int var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowConsensus return ErrIntOverflowConsensus
@ -2810,25 +2807,23 @@ func (m *RecordAddRequest) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
byteLen |= int(b&0x7F) << shift stringLen |= uint64(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
} }
if byteLen < 0 { intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthConsensus return ErrInvalidLengthConsensus
} }
postIndex := iNdEx + byteLen postIndex := iNdEx + intStringLen
if postIndex < 0 { if postIndex < 0 {
return ErrInvalidLengthConsensus return ErrInvalidLengthConsensus
} }
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
m.LogId = append(m.LogId[:0], dAtA[iNdEx:postIndex]...) m.LogId = string(dAtA[iNdEx:postIndex])
if m.LogId == nil {
m.LogId = []byte{}
}
iNdEx = postIndex iNdEx = postIndex
case 2: case 2:
if wireType != 2 { if wireType != 2 {
@ -2920,7 +2915,7 @@ func (m *LogWatchRequest) Unmarshal(dAtA []byte) error {
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field WatchIds", wireType) return fmt.Errorf("proto: wrong wireType = %d for field WatchIds", wireType)
} }
var byteLen int var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowConsensus return ErrIntOverflowConsensus
@ -2930,29 +2925,29 @@ func (m *LogWatchRequest) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
byteLen |= int(b&0x7F) << shift stringLen |= uint64(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
} }
if byteLen < 0 { intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthConsensus return ErrInvalidLengthConsensus
} }
postIndex := iNdEx + byteLen postIndex := iNdEx + intStringLen
if postIndex < 0 { if postIndex < 0 {
return ErrInvalidLengthConsensus return ErrInvalidLengthConsensus
} }
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
m.WatchIds = append(m.WatchIds, make([]byte, postIndex-iNdEx)) m.WatchIds = append(m.WatchIds, string(dAtA[iNdEx:postIndex]))
copy(m.WatchIds[len(m.WatchIds)-1], dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 2: case 2:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field UnwatchIds", wireType) return fmt.Errorf("proto: wrong wireType = %d for field UnwatchIds", wireType)
} }
var byteLen int var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowConsensus return ErrIntOverflowConsensus
@ -2962,23 +2957,23 @@ func (m *LogWatchRequest) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
byteLen |= int(b&0x7F) << shift stringLen |= uint64(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
} }
if byteLen < 0 { intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthConsensus return ErrInvalidLengthConsensus
} }
postIndex := iNdEx + byteLen postIndex := iNdEx + intStringLen
if postIndex < 0 { if postIndex < 0 {
return ErrInvalidLengthConsensus return ErrInvalidLengthConsensus
} }
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
m.UnwatchIds = append(m.UnwatchIds, make([]byte, postIndex-iNdEx)) m.UnwatchIds = append(m.UnwatchIds, string(dAtA[iNdEx:postIndex]))
copy(m.UnwatchIds[len(m.UnwatchIds)-1], dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
@ -3034,7 +3029,7 @@ func (m *LogWatchEvent) Unmarshal(dAtA []byte) error {
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field LogId", wireType) return fmt.Errorf("proto: wrong wireType = %d for field LogId", wireType)
} }
var byteLen int var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowConsensus return ErrIntOverflowConsensus
@ -3044,25 +3039,23 @@ func (m *LogWatchEvent) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
byteLen |= int(b&0x7F) << shift stringLen |= uint64(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
} }
if byteLen < 0 { intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthConsensus return ErrInvalidLengthConsensus
} }
postIndex := iNdEx + byteLen postIndex := iNdEx + intStringLen
if postIndex < 0 { if postIndex < 0 {
return ErrInvalidLengthConsensus return ErrInvalidLengthConsensus
} }
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
m.LogId = append(m.LogId[:0], dAtA[iNdEx:postIndex]...) m.LogId = string(dAtA[iNdEx:postIndex])
if m.LogId == nil {
m.LogId = []byte{}
}
iNdEx = postIndex iNdEx = postIndex
case 2: case 2:
if wireType != 2 { if wireType != 2 {

View File

@ -13,7 +13,7 @@ enum ErrCodes {
message Log { message Log {
bytes id = 1; string id = 1;
bytes payload = 2; bytes payload = 2;
repeated RawRecordWithId records = 3; repeated RawRecordWithId records = 3;
} }
@ -57,17 +57,17 @@ message LogAddRequest {
} }
message RecordAddRequest { message RecordAddRequest {
bytes logId = 1; string logId = 1;
RawRecord record = 2; RawRecord record = 2;
} }
message LogWatchRequest { message LogWatchRequest {
repeated bytes watchIds = 1; repeated string watchIds = 1;
repeated bytes unwatchIds = 2; repeated string unwatchIds = 2;
} }
message LogWatchEvent { message LogWatchEvent {
bytes logId = 1; string logId = 1;
repeated RawRecordWithId records = 2; repeated RawRecordWithId records = 2;
Err error = 3; Err error = 3;
} }