1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-08 05:57:03 +09:00

consensusproto: add logId to addLog

This commit is contained in:
Sergey Cherepanov 2024-02-12 18:58:14 +01:00
parent 5f5d3c7389
commit 5c96ca4594
No known key found for this signature in database
GPG key ID: 87F8EDE8FBDF637C
4 changed files with 124 additions and 68 deletions

View file

@ -4,15 +4,17 @@ package consensusclient
import (
"context"
"errors"
"sync"
"time"
"go.uber.org/zap"
"github.com/anyproto/any-sync/app"
"github.com/anyproto/any-sync/app/logger"
"github.com/anyproto/any-sync/consensus/consensusproto"
"github.com/anyproto/any-sync/net/pool"
"github.com/anyproto/any-sync/net/rpc/rpcerr"
"github.com/anyproto/any-sync/nodeconf"
"go.uber.org/zap"
"sync"
"time"
)
const CName = "consensus.consensusclient"
@ -36,7 +38,7 @@ type Watcher interface {
type Service interface {
// AddLog adds new log to consensus servers
AddLog(ctx context.Context, rec *consensusproto.RawRecordWithId) (err error)
AddLog(ctx context.Context, logId string, 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
@ -88,9 +90,10 @@ func (s *service) doClient(ctx context.Context, fn func(cl consensusproto.DRPCCo
return fn(consensusproto.NewDRPCConsensusClient(dc))
}
func (s *service) AddLog(ctx context.Context, rec *consensusproto.RawRecordWithId) (err error) {
func (s *service) AddLog(ctx context.Context, logId string, rec *consensusproto.RawRecordWithId) (err error) {
return s.doClient(ctx, func(cl consensusproto.DRPCConsensusClient) error {
if _, err = cl.LogAdd(ctx, &consensusproto.LogAddRequest{
LogId: logId,
Record: rec,
}); err != nil {
return rpcerr.Unwrap(err)

View file

@ -3,6 +3,14 @@ package consensusclient
import (
"context"
"fmt"
"sync"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
"github.com/anyproto/any-sync/app"
"github.com/anyproto/any-sync/consensus/consensusproto"
"github.com/anyproto/any-sync/consensus/consensusproto/consensuserr"
@ -12,12 +20,6 @@ import (
"github.com/anyproto/any-sync/nodeconf/mock_nodeconf"
"github.com/anyproto/any-sync/testutil/accounttest"
"github.com/anyproto/any-sync/util/cidutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
"sync"
"testing"
"time"
)
func TestService_Watch(t *testing.T) {
@ -113,7 +115,7 @@ func TestService_Init(t *testing.T) {
func TestService_AddLog(t *testing.T) {
fx := newFixture(t).run(t)
defer fx.Finish()
assert.NoError(t, fx.AddLog(ctx, &consensusproto.RawRecordWithId{}))
assert.NoError(t, fx.AddLog(ctx, "1", &consensusproto.RawRecordWithId{}))
}
func TestService_AddRecord(t *testing.T) {

View file

@ -350,8 +350,9 @@ func (m *Ok) XXX_DiscardUnknown() {
var xxx_messageInfo_Ok proto.InternalMessageInfo
type LogAddRequest struct {
LogId string `protobuf:"bytes,1,opt,name=logId,proto3" json:"logId,omitempty"`
// first record in the log, consensus node not sign it
Record *RawRecordWithId `protobuf:"bytes,1,opt,name=record,proto3" json:"record,omitempty"`
Record *RawRecordWithId `protobuf:"bytes,2,opt,name=record,proto3" json:"record,omitempty"`
}
func (m *LogAddRequest) Reset() { *m = LogAddRequest{} }
@ -387,6 +388,13 @@ func (m *LogAddRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_LogAddRequest proto.InternalMessageInfo
func (m *LogAddRequest) GetLogId() string {
if m != nil {
return m.LogId
}
return ""
}
func (m *LogAddRequest) GetRecord() *RawRecordWithId {
if m != nil {
return m.Record
@ -991,60 +999,59 @@ func init() {
}
var fileDescriptor_b8d7f1c16b400059 = []byte{
// 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, 0x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, 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,
// 830 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xdd, 0x8e, 0xdb, 0x54,
0x10, 0x8e, 0xed, 0xfc, 0x4e, 0x68, 0x62, 0xa6, 0x08, 0x99, 0x88, 0xa6, 0x91, 0xb9, 0x09, 0x15,
0x4a, 0x21, 0x08, 0x21, 0x54, 0x21, 0xd4, 0x86, 0xac, 0x12, 0xc9, 0xcd, 0x2e, 0x2e, 0xa5, 0x12,
0x48, 0x48, 0xae, 0xcf, 0x89, 0xd7, 0xaa, 0xeb, 0x63, 0xec, 0x93, 0xb4, 0xb9, 0x85, 0x4b, 0x6e,
0x78, 0x0f, 0x5e, 0x04, 0x89, 0x9b, 0x5e, 0x72, 0x89, 0x76, 0x5f, 0x81, 0x07, 0x40, 0x3e, 0xfe,
0x49, 0xd6, 0x4e, 0x52, 0x50, 0xf7, 0x66, 0xd7, 0x33, 0xf3, 0xcd, 0x37, 0x73, 0xbe, 0x73, 0x66,
0x14, 0xb8, 0x6b, 0x33, 0x3f, 0xa2, 0x7e, 0xb4, 0x8a, 0xb6, 0x5f, 0x41, 0xc8, 0x38, 0xbb, 0x2b,
0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f9, 0x4b, 0xcf, 0xb5, 0xb9, 0xaa,
0xc4, 0x39, 0x27, 0x2c, 0x7c, 0xea, 0x12, 0x42, 0x7d, 0xb5, 0x1a, 0x43, 0xe6, 0xfe, 0xda, 0xf2,
0x5c, 0x72, 0x96, 0xdc, 0xad, 0x5a, 0x43, 0x15, 0xda, 0xd3, 0x78, 0x4e, 0x4e, 0x97, 0xcb, 0x88,
0x72, 0xf5, 0x1f, 0x65, 0xfc, 0xbb, 0x0c, 0xad, 0x49, 0xd6, 0x31, 0xde, 0x83, 0x7a, 0xb2, 0x39,
0x71, 0xdf, 0x70, 0x6c, 0xd7, 0x5d, 0x0f, 0x8b, 0xe1, 0xd3, 0x67, 0xb8, 0x80, 0x56, 0xbe, 0x16,
0x71, 0x50, 0xd2, 0xa1, 0xb0, 0x31, 0x7b, 0xaf, 0x53, 0x0a, 0x17, 0xd0, 0xcc, 0x36, 0x17, 0xde,
0xde, 0xd3, 0xce, 0xee, 0x8e, 0xec, 0xdd, 0x3a, 0x04, 0x10, 0x4b, 0x6f, 0x28, 0x7d, 0x2c, 0xe1,
0x7d, 0xa1, 0x69, 0xb2, 0x7c, 0xca, 0xfd, 0x15, 0xf7, 0xd2, 0xbe, 0x23, 0x3e, 0x18, 0xff, 0x71,
0xd1, 0x97, 0x5e, 0x5d, 0xf4, 0xa5, 0xbf, 0x2f, 0xfa, 0xd2, 0x6f, 0x97, 0xfd, 0xca, 0xab, 0xcb,
0x7e, 0xe5, 0xaf, 0xcb, 0x7e, 0xe5, 0x7b, 0xed, 0xd0, 0xef, 0x90, 0xa7, 0x75, 0xf1, 0xef, 0xd3,
0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x12, 0x81, 0xbd, 0x26, 0xaa, 0x08, 0x00, 0x00,
}
func (m *Log) Marshal() (dAtA []byte, err error) {
@ -1286,6 +1293,13 @@ func (m *LogAddRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i = encodeVarintConsensus(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
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
@ -1878,6 +1892,10 @@ func (m *LogAddRequest) Size() (n int) {
}
var l int
_ = l
l = len(m.LogId)
if l > 0 {
n += 1 + l + sovConsensus(uint64(l))
}
if m.Record != nil {
l = m.Record.Size()
n += 1 + l + sovConsensus(uint64(l))
@ -2789,6 +2807,38 @@ func (m *LogAddRequest) Unmarshal(dAtA []byte) error {
}
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
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Record", wireType)
}

View file

@ -57,8 +57,9 @@ service Consensus {
message Ok {}
message LogAddRequest {
string logId = 1;
// first record in the log, consensus node not sign it
RawRecordWithId record = 1;
RawRecordWithId record = 2;
}
message RecordAddRequest {