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

Implement sync protocol

This commit is contained in:
mcrakhman 2023-07-03 18:19:23 +02:00
parent 8aa41da1ff
commit bef93d46ad
No known key found for this signature in database
GPG key ID: DED12CFEF5B8396B
7 changed files with 167 additions and 75 deletions

View file

@ -143,28 +143,30 @@ func (d *diffSyncer) syncWithPeer(ctx context.Context, p peer.Peer) (err error)
totalLen := len(newIds) + len(changedIds) + len(removedIds)
// not syncing ids which were removed through settings document
missingIds := d.deletionState.Filter(newIds)
prevLen := len(changedIds)
changedIds = slice.DiscardFromSlice(changedIds, func(s string) bool {
existingIds := append(d.deletionState.Filter(removedIds), d.deletionState.Filter(changedIds)...)
d.syncStatus.RemoveAllExcept(p.Id(), existingIds, stateCounter)
prevExistingLen := len(existingIds)
existingIds = slice.DiscardFromSlice(existingIds, func(s string) bool {
return s == syncAclId
})
// if acl head is different
if len(changedIds) < prevLen {
// if we removed acl head from the list
if len(existingIds) < prevExistingLen {
if syncErr := d.syncAcl.SyncWithPeer(ctx, p.Id()); syncErr != nil {
log.Warn("failed to send acl sync message to peer", zap.String("aclId", syncAclId))
}
}
existingIds := append(d.deletionState.Filter(removedIds), d.deletionState.Filter(changedIds)...)
d.syncStatus.RemoveAllExcept(p.Id(), existingIds, stateCounter)
// treeSyncer should not get acl id, that's why we filter existing ids before
err = d.treeSyncer.SyncAll(ctx, p.Id(), existingIds, missingIds)
if err != nil {
return err
}
d.log.Info("sync done:", zap.Int("newIds", len(newIds)),
d.log.Info("sync done:",
zap.Int("newIds", len(newIds)),
zap.Int("changedIds", len(changedIds)),
zap.Int("removedIds", len(removedIds)),
zap.Int("already deleted ids", totalLen-len(existingIds)-len(missingIds)),
zap.Int("already deleted ids", totalLen-prevExistingLen-len(missingIds)),
zap.String("peerId", p.Id()),
)
return

View file

@ -46,6 +46,8 @@ type AclList interface {
IsAfter(first string, second string) (bool, error)
HasHead(head string) bool
Head() *AclRecord
RecordsAfter(ctx context.Context, id string) (records []*consensusproto.RawRecordWithId, err error)
Get(id string) (*AclRecord, error)
GetIndex(idx int) (*AclRecord, error)
Iterate(iterFunc IterFunc)
@ -287,6 +289,21 @@ func (a *aclList) Iterate(iterFunc IterFunc) {
}
}
func (a *aclList) RecordsAfter(ctx context.Context, id string) (records []*consensusproto.RawRecordWithId, err error) {
recIdx, ok := a.indexes[id]
if !ok {
return nil, ErrNoSuchRecord
}
for i := recIdx + 1; i < len(a.records); i++ {
rawRec, err := a.storage.GetRawRecord(ctx, a.records[i].Id)
if err != nil {
return nil, err
}
records = append(records, rawRec)
}
return
}
func (a *aclList) IterateFrom(startId string, iterFunc IterFunc) {
recIdx, ok := a.indexes[startId]
if !ok {

View file

@ -1,6 +1,8 @@
package syncacl
import (
"context"
"github.com/anyproto/any-sync/commonspace/object/acl/list"
"github.com/anyproto/any-sync/consensus/consensusproto"
)
@ -11,20 +13,42 @@ type RequestFactory interface {
CreateFullSyncResponse(l list.AclList, theirHead string) (*consensusproto.LogSyncMessage, error)
}
type requestFactory struct{}
func NewRequestFactory() RequestFactory {
return &requestFactory{}
}
type requestFactory struct{}
func (r *requestFactory) CreateHeadUpdate(l list.AclList, added []*consensusproto.RawRecordWithId) (msg *consensusproto.LogSyncMessage) {
return
return consensusproto.WrapHeadUpdate(&consensusproto.LogHeadUpdate{
Head: l.Head().Id,
Records: added,
}, l.Root())
}
func (r *requestFactory) CreateFullSyncRequest(l list.AclList, theirHead string) (req *consensusproto.LogSyncMessage, err error) {
return
if !l.HasHead(theirHead) {
return consensusproto.WrapFullRequest(&consensusproto.LogFullSyncRequest{
Head: l.Head().Id,
}, l.Root()), nil
}
records, err := l.RecordsAfter(context.Background(), theirHead)
if err != nil {
return
}
return consensusproto.WrapFullRequest(&consensusproto.LogFullSyncRequest{
Head: l.Head().Id,
Records: records,
}, l.Root()), nil
}
func (r *requestFactory) CreateFullSyncResponse(l list.AclList, theirHead string) (*consensusproto.LogSyncMessage, error) {
return nil, nil
func (r *requestFactory) CreateFullSyncResponse(l list.AclList, theirHead string) (resp *consensusproto.LogSyncMessage, err error) {
records, err := l.RecordsAfter(context.Background(), theirHead)
if err != nil {
return
}
return consensusproto.WrapFullResponse(&consensusproto.LogFullSyncResponse{
Head: l.Head().Id,
Records: records,
}, l.Root()), nil
}

View file

@ -42,6 +42,8 @@ func (s *syncAclHandler) HandleMessage(ctx context.Context, senderId string, mes
return
}
content := unmarshalled.GetContent()
head := consensusproto.GetHead(unmarshalled)
s.syncStatus.HeadsReceive(senderId, s.aclList.Id(), []string{head})
s.aclList.Lock()
defer s.aclList.Unlock()
switch {

View file

@ -0,0 +1,45 @@
package consensusproto
func WrapHeadUpdate(update *LogHeadUpdate, rootRecord *RawRecordWithId) *LogSyncMessage {
return &LogSyncMessage{
Content: &LogSyncContentValue{
Value: &LogSyncContentValue_HeadUpdate{HeadUpdate: update},
},
Id: rootRecord.Id,
Payload: rootRecord.Payload,
}
}
func WrapFullRequest(request *LogFullSyncRequest, rootRecord *RawRecordWithId) *LogSyncMessage {
return &LogSyncMessage{
Content: &LogSyncContentValue{
Value: &LogSyncContentValue_FullSyncRequest{FullSyncRequest: request},
},
Id: rootRecord.Id,
Payload: rootRecord.Payload,
}
}
func WrapFullResponse(response *LogFullSyncResponse, rootRecord *RawRecordWithId) *LogSyncMessage {
return &LogSyncMessage{
Content: &LogSyncContentValue{
Value: &LogSyncContentValue_FullSyncResponse{FullSyncResponse: response},
},
Id: rootRecord.Id,
Payload: rootRecord.Payload,
}
}
func GetHead(msg *LogSyncMessage) (head string) {
content := msg.GetContent()
switch {
case content.GetHeadUpdate() != nil:
return content.GetHeadUpdate().Head
case content.GetFullSyncRequest() != nil:
return content.GetFullSyncRequest().Head
case content.GetFullSyncResponse() != nil:
return content.GetFullSyncResponse().Head
default:
return ""
}
}

View file

@ -698,7 +698,7 @@ func (*LogSyncContentValue) XXX_OneofWrappers() []interface{} {
// LogSyncMessage is a message sent when we are syncing logs
type LogSyncMessage struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Payload string `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
Content *LogSyncContentValue `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"`
}
@ -742,11 +742,11 @@ func (m *LogSyncMessage) GetId() string {
return ""
}
func (m *LogSyncMessage) GetPayload() string {
func (m *LogSyncMessage) GetPayload() []byte {
if m != nil {
return m.Payload
}
return ""
return nil
}
func (m *LogSyncMessage) GetContent() *LogSyncContentValue {
@ -939,56 +939,56 @@ func init() {
}
var fileDescriptor_b8d7f1c16b400059 = []byte{
// 780 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcd, 0x4e, 0xe3, 0x56,
0x14, 0x8e, 0x6d, 0x48, 0xe2, 0x93, 0x92, 0xb8, 0x87, 0xaa, 0x72, 0xa3, 0x12, 0x22, 0x57, 0x95,
0x52, 0x54, 0x85, 0x36, 0x55, 0x2b, 0x55, 0xa8, 0xaa, 0x4a, 0x14, 0x94, 0x48, 0x21, 0xb4, 0x46,
0x14, 0xa9, 0x95, 0xaa, 0xba, 0xbe, 0x37, 0xc6, 0x25, 0xf8, 0xba, 0xf6, 0x0d, 0x90, 0x6d, 0xb7,
0xb3, 0x99, 0x17, 0x98, 0xf7, 0x99, 0x25, 0xcb, 0x59, 0x8e, 0x60, 0x33, 0x0f, 0x30, 0x0f, 0x30,
0xf2, 0xf5, 0x4f, 0x42, 0x7e, 0x40, 0xa3, 0x61, 0x03, 0x3e, 0xff, 0xdf, 0xf9, 0xce, 0xb9, 0x27,
0xb0, 0x6b, 0x33, 0x2f, 0xa4, 0x5e, 0x38, 0x0e, 0xa7, 0x5f, 0x7e, 0xc0, 0x38, 0xdb, 0x15, 0x7f,
0x67, 0xb4, 0x4d, 0xa1, 0xc0,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xeb, 0x8d, 0x04, 0x6a, 0x3b, 0x45, 0x83, 0x7b, 0x90, 0x8f, 0x6f, 0x18, 0x2e, 0x5b, 0xfc,
0xe9, 0x81, 0xaa, 0xe2, 0xbc, 0xf9, 0xe8, 0x1c, 0x07, 0xa0, 0x66, 0x87, 0x0c, 0xeb, 0x0b, 0x3d,
0xce, 0xdd, 0xb8, 0xea, 0x63, 0x2c, 0xe0, 0x00, 0x8a, 0xe9, 0xad, 0xc1, 0xed, 0x25, 0x70, 0x66,
0xaf, 0x5a, 0x75, 0x6b, 0x95, 0x83, 0x38, 0x53, 0x0d, 0xe9, 0x1b, 0x69, 0xbf, 0xf5, 0xf2, 0xb6,
0x26, 0xdd, 0xdc, 0xd6, 0xa4, 0xd7, 0xb7, 0x35, 0xe9, 0xf9, 0x5d, 0x2d, 0x77, 0x73, 0x57, 0xcb,
0xbd, 0xba, 0xab, 0xe5, 0xfe, 0xd0, 0x57, 0xfd, 0x74, 0xff, 0x93, 0x17, 0xff, 0xbe, 0x7b, 0x17,
0x00, 0x00, 0xff, 0xff, 0x5e, 0x57, 0x8e, 0x0b, 0xdd, 0x07, 0x00, 0x00,
// 778 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x5f, 0x4f, 0xdb, 0x56,
0x14, 0x8f, 0x6d, 0xc8, 0x9f, 0x93, 0x91, 0x78, 0x87, 0x69, 0xf2, 0xa2, 0x11, 0x22, 0x4f, 0x93,
0x32, 0x34, 0x85, 0x2d, 0xd3, 0x26, 0x4d, 0x68, 0x9a, 0x46, 0x14, 0x94, 0x48, 0x21, 0x6c, 0x46,
0x0c, 0xa9, 0x95, 0xaa, 0xba, 0xbe, 0x37, 0xc6, 0x25, 0xf8, 0xba, 0xf6, 0x0d, 0x90, 0xd7, 0xbe,
0xf6, 0xa5, 0x5f, 0xa0, 0xdf, 0xa7, 0x8f, 0x3c, 0xf6, 0xb1,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0, 0x81, 0x2a, 0x61, 0x19, 0x8a, 0x3d, 0x66, 0xf7, 0x19, 0xdf,
0x63, 0x23, 0x97, 0xa8, 0x32, 0x22, 0x94, 0xa2, 0xa4, 0x2d, 0xe6, 0x0e, 0x86, 0x8e, 0xc5, 0x55,
0x05, 0x55, 0x28, 0xb6, 0xc3, 0x6f, 0xe0, 0x60, 0x30, 0x08, 0x28, 0x57, 0x3f, 0x2a, 0xcd, 0x0f,
0x12, 0x14, 0x5a, 0x09, 0x1a, 0xdc, 0x81, 0x6c, 0x74, 0xc3, 0x70, 0xd1, 0xe2, 0x4f, 0x0e, 0x54,
0x05, 0x67, 0xcd, 0x07, 0xa7, 0xd8, 0x87, 0x42, 0x7a, 0xc8, 0xb0, 0x36, 0xd7, 0xe3, 0xcc, 0x8d,
0xab, 0x7c, 0x8e, 0x05, 0xec, 0x43, 0x3e, 0xb9, 0x35, 0xb8, 0xb9, 0x00, 0xce, 0xf4, 0x55, 0xab,
0x6c, 0x2c, 0x73, 0x10, 0x67, 0xaa, 0x2e, 0xfd, 0x22, 0xed, 0x36, 0xdf, 0x5e, 0x57, 0xa5, 0xab,
0xeb, 0xaa, 0xf4, 0xfe, 0xba, 0x2a, 0xbd, 0xbe, 0xa9, 0x66, 0xae, 0x6e, 0xaa, 0x99, 0x77, 0x37,
0xd5, 0xcc, 0x23, 0x6d, 0xd9, 0x4f, 0xf7, 0xb3, 0xac, 0xf8, 0xf7, 0xdb, 0xa7, 0x00, 0x00, 0x00,
0xff, 0xff, 0x9e, 0x4a, 0x75, 0x11, 0xdd, 0x07, 0x00, 0x00,
}
func (m *Log) Marshal() (dAtA []byte, err error) {
@ -3437,7 +3437,7 @@ func (m *LogSyncMessage) Unmarshal(dAtA []byte) error {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType)
}
var stringLen uint64
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowConsensus
@ -3447,23 +3447,25 @@ func (m *LogSyncMessage) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
if byteLen < 0 {
return ErrInvalidLengthConsensus
}
postIndex := iNdEx + intStringLen
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthConsensus
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Payload = string(dAtA[iNdEx:postIndex])
m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...)
if m.Payload == nil {
m.Payload = []byte{}
}
iNdEx = postIndex
case 3:
if wireType != 2 {

View file

@ -88,7 +88,7 @@ message LogSyncContentValue {
// LogSyncMessage is a message sent when we are syncing logs
message LogSyncMessage {
string id = 1;
string payload = 2;
bytes payload = 2;
LogSyncContentValue content = 3;
}