diff --git a/common/commonspace/space.go b/common/commonspace/space.go index b957a515..dd2541bd 100644 --- a/common/commonspace/space.go +++ b/common/commonspace/space.go @@ -6,7 +6,6 @@ import ( "fmt" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/account" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/diffservice" - "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/storage" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/syncacl" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/syncservice" @@ -15,7 +14,6 @@ import ( "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/treegetter" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/nodeconf" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/list" - aclstorage "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage" tree "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/tree" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/encryptionkey" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/signingkey" @@ -167,51 +165,6 @@ func (s *space) BuildTree(ctx context.Context, id string, listener updatelistene err = ErrSpaceClosed return } - getTreeRemote := func() (*spacesyncproto.ObjectSyncMessage, error) { - // TODO: add empty context handling (when this is not happening due to head update) - peerId, err := syncservice.GetPeerIdFromStreamContext(ctx) - if err != nil { - return nil, err - } - return s.syncService.StreamPool().SendSync( - peerId, - synctree.GetRequestFactory().CreateNewTreeRequest(id), - ) - } - - store, err := s.storage.TreeStorage(id) - if err != nil && err != aclstorage.ErrUnknownTreeId { - return - } - - isFirstBuild := false - if err == aclstorage.ErrUnknownTreeId { - isFirstBuild = true - var resp *spacesyncproto.ObjectSyncMessage - resp, err = getTreeRemote() - if err != nil { - return - } - fullSyncResp := resp.GetContent().GetFullSyncResponse() - - payload := aclstorage.TreeStorageCreatePayload{ - TreeId: resp.TreeId, - RootRawChange: resp.RootChange, - Changes: fullSyncResp.Changes, - Heads: fullSyncResp.Heads, - } - - // basically building tree with inmemory storage and validating that it was without errors - err = tree.ValidateRawTree(payload, s.aclList) - if err != nil { - return - } - // now we are sure that we can save it to the storage - store, err = s.storage.CreateTreeStorage(payload) - if err != nil { - return - } - } deps := synctree.BuildDeps{ SpaceId: s.id, StreamPool: s.syncService.StreamPool(), @@ -219,9 +172,9 @@ func (s *space) BuildTree(ctx context.Context, id string, listener updatelistene HeadNotifiable: s.diffService, Listener: listener, AclList: s.aclList, - Storage: store, + SpaceStorage: s.storage, } - return synctree.BuildSyncTree(ctx, isFirstBuild, deps) + return synctree.BuildSyncTreeOrGetRemote(ctx, id, deps) } func (s *space) Close() error { diff --git a/common/commonspace/spacesyncproto/protos/spacesync.proto b/common/commonspace/spacesyncproto/protos/spacesync.proto index c218b1a9..d8dc0153 100644 --- a/common/commonspace/spacesyncproto/protos/spacesync.proto +++ b/common/commonspace/spacesyncproto/protos/spacesync.proto @@ -2,7 +2,6 @@ syntax = "proto3"; package anySpace; option go_package = "commonspace/spacesyncproto"; -import "pkg/acl/treechangeproto/protos/treechange.proto"; import "pkg/acl/aclrecordproto/protos/aclrecord.proto"; enum ErrCodes { @@ -55,51 +54,13 @@ message HeadSyncResponse { // ObjectSyncMessage is a message sent on object sync message ObjectSyncMessage { string spaceId = 1; - ObjectSyncContentValue content = 2; - treechange.RawTreeChangeWithId rootChange = 3; - string treeId = 4; - string trackingId = 5; - + string replyId = 2; + bytes payload = 3; + string objectId = 4; // string identity = 5; // string peerSignature = 6; } -// ObjectSyncContentValue provides different types for object sync -message ObjectSyncContentValue { - oneof value { - ObjectHeadUpdate headUpdate = 1; - ObjectFullSyncRequest fullSyncRequest = 2; - ObjectFullSyncResponse fullSyncResponse = 3; - ObjectErrorResponse errorResponse = 4; - } -} - -// ObjectHeadUpdate is a message sent on document head update -message ObjectHeadUpdate { - repeated string heads = 1; - repeated treechange.RawTreeChangeWithId changes = 2; - repeated string snapshotPath = 3; -} - -// ObjectHeadUpdate is a message sent when document needs full sync -message ObjectFullSyncRequest { - repeated string heads = 1; - repeated treechange.RawTreeChangeWithId changes = 2; - repeated string snapshotPath = 3; -} - -// ObjectFullSyncResponse is a message sent as a response for a specific full sync -message ObjectFullSyncResponse { - repeated string heads = 1; - repeated treechange.RawTreeChangeWithId changes = 2; - repeated string snapshotPath = 3; -} - -// ObjectErrorResponse is an error sent as a response for a full sync request -message ObjectErrorResponse { - string error = 1; -} - // PushSpaceRequest is a request to add space on a node containing only one acl record message PushSpaceRequest { RawSpaceHeaderWithId spaceHeader = 2; diff --git a/common/commonspace/spacesyncproto/spacesync.go b/common/commonspace/spacesyncproto/spacesync.go index 952faf4b..7c55930f 100644 --- a/common/commonspace/spacesyncproto/spacesync.go +++ b/common/commonspace/spacesyncproto/spacesync.go @@ -2,8 +2,6 @@ package spacesyncproto import ( - "fmt" - "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/treechangeproto" "storj.io/drpc" ) @@ -18,63 +16,3 @@ func (c ClientFactoryFunc) Client(cc drpc.Conn) DRPCSpaceClient { type ClientFactory interface { Client(cc drpc.Conn) DRPCSpaceClient } - -func WrapHeadUpdate(update *ObjectHeadUpdate, rootChange *treechangeproto.RawTreeChangeWithId, treeId, trackingId string) *ObjectSyncMessage { - return &ObjectSyncMessage{ - Content: &ObjectSyncContentValue{ - Value: &ObjectSyncContentValue_HeadUpdate{HeadUpdate: update}, - }, - RootChange: rootChange, - TreeId: treeId, - TrackingId: trackingId, - } -} - -func WrapFullRequest(request *ObjectFullSyncRequest, rootChange *treechangeproto.RawTreeChangeWithId, treeId, trackingId string) *ObjectSyncMessage { - return &ObjectSyncMessage{ - Content: &ObjectSyncContentValue{ - Value: &ObjectSyncContentValue_FullSyncRequest{FullSyncRequest: request}, - }, - RootChange: rootChange, - TreeId: treeId, - TrackingId: trackingId, - } -} - -func WrapFullResponse(response *ObjectFullSyncResponse, rootChange *treechangeproto.RawTreeChangeWithId, treeId, trackingId string) *ObjectSyncMessage { - return &ObjectSyncMessage{ - Content: &ObjectSyncContentValue{ - Value: &ObjectSyncContentValue_FullSyncResponse{FullSyncResponse: response}, - }, - RootChange: rootChange, - TreeId: treeId, - TrackingId: trackingId, - } -} - -func WrapError(err error, rootChange *treechangeproto.RawTreeChangeWithId, treeId, trackingId string) *ObjectSyncMessage { - return &ObjectSyncMessage{ - Content: &ObjectSyncContentValue{ - Value: &ObjectSyncContentValue_ErrorResponse{ErrorResponse: &ObjectErrorResponse{Error: err.Error()}}, - }, - RootChange: rootChange, - TreeId: treeId, - TrackingId: trackingId, - } -} - -func MessageDescription(msg *ObjectSyncMessage) (res string) { - content := msg.GetContent() - switch { - case content.GetHeadUpdate() != nil: - res = fmt.Sprintf("head update/%v", content.GetHeadUpdate().Heads) - case content.GetFullSyncRequest() != nil: - res = fmt.Sprintf("fullsync request/%v", content.GetFullSyncRequest().Heads) - case content.GetFullSyncResponse() != nil: - res = fmt.Sprintf("fullsync response/%v", content.GetFullSyncResponse().Heads) - case content.GetErrorResponse() != nil: - res = fmt.Sprintf("error response/%v", content.GetErrorResponse().Error) - } - res = fmt.Sprintf("%s/tracking=[%s]", res, msg.TrackingId) - return res -} diff --git a/common/commonspace/spacesyncproto/spacesync.pb.go b/common/commonspace/spacesyncproto/spacesync.pb.go index 1764e6e3..2c4115a3 100644 --- a/common/commonspace/spacesyncproto/spacesync.pb.go +++ b/common/commonspace/spacesyncproto/spacesync.pb.go @@ -6,7 +6,6 @@ package spacesyncproto import ( fmt "fmt" aclrecordproto "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/aclrecordproto" - treechangeproto "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/treechangeproto" proto "github.com/gogo/protobuf/proto" io "io" math "math" @@ -330,11 +329,10 @@ func (m *HeadSyncResponse) GetResults() []*HeadSyncResult { // ObjectSyncMessage is a message sent on object sync type ObjectSyncMessage struct { - SpaceId string `protobuf:"bytes,1,opt,name=spaceId,proto3" json:"spaceId,omitempty"` - Content *ObjectSyncContentValue `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` - RootChange *treechangeproto.RawTreeChangeWithId `protobuf:"bytes,3,opt,name=rootChange,proto3" json:"rootChange,omitempty"` - TreeId string `protobuf:"bytes,4,opt,name=treeId,proto3" json:"treeId,omitempty"` - TrackingId string `protobuf:"bytes,5,opt,name=trackingId,proto3" json:"trackingId,omitempty"` + SpaceId string `protobuf:"bytes,1,opt,name=spaceId,proto3" json:"spaceId,omitempty"` + ReplyId string `protobuf:"bytes,2,opt,name=replyId,proto3" json:"replyId,omitempty"` + Payload []byte `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` + ObjectId string `protobuf:"bytes,4,opt,name=objectId,proto3" json:"objectId,omitempty"` } func (m *ObjectSyncMessage) Reset() { *m = ObjectSyncMessage{} } @@ -377,370 +375,23 @@ func (m *ObjectSyncMessage) GetSpaceId() string { return "" } -func (m *ObjectSyncMessage) GetContent() *ObjectSyncContentValue { +func (m *ObjectSyncMessage) GetReplyId() string { if m != nil { - return m.Content - } - return nil -} - -func (m *ObjectSyncMessage) GetRootChange() *treechangeproto.RawTreeChangeWithId { - if m != nil { - return m.RootChange - } - return nil -} - -func (m *ObjectSyncMessage) GetTreeId() string { - if m != nil { - return m.TreeId + return m.ReplyId } return "" } -func (m *ObjectSyncMessage) GetTrackingId() string { +func (m *ObjectSyncMessage) GetPayload() []byte { if m != nil { - return m.TrackingId + return m.Payload } - return "" + return nil } -// ObjectSyncContentValue provides different types for object sync -type ObjectSyncContentValue struct { - // Types that are valid to be assigned to Value: - // *ObjectSyncContentValue_HeadUpdate - // *ObjectSyncContentValue_FullSyncRequest - // *ObjectSyncContentValue_FullSyncResponse - // *ObjectSyncContentValue_ErrorResponse - Value isObjectSyncContentValue_Value `protobuf_oneof:"value"` -} - -func (m *ObjectSyncContentValue) Reset() { *m = ObjectSyncContentValue{} } -func (m *ObjectSyncContentValue) String() string { return proto.CompactTextString(m) } -func (*ObjectSyncContentValue) ProtoMessage() {} -func (*ObjectSyncContentValue) Descriptor() ([]byte, []int) { - return fileDescriptor_80e49f1f4ac27799, []int{6} -} -func (m *ObjectSyncContentValue) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ObjectSyncContentValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ObjectSyncContentValue.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 *ObjectSyncContentValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_ObjectSyncContentValue.Merge(m, src) -} -func (m *ObjectSyncContentValue) XXX_Size() int { - return m.Size() -} -func (m *ObjectSyncContentValue) XXX_DiscardUnknown() { - xxx_messageInfo_ObjectSyncContentValue.DiscardUnknown(m) -} - -var xxx_messageInfo_ObjectSyncContentValue proto.InternalMessageInfo - -type isObjectSyncContentValue_Value interface { - isObjectSyncContentValue_Value() - MarshalTo([]byte) (int, error) - Size() int -} - -type ObjectSyncContentValue_HeadUpdate struct { - HeadUpdate *ObjectHeadUpdate `protobuf:"bytes,1,opt,name=headUpdate,proto3,oneof" json:"headUpdate,omitempty"` -} -type ObjectSyncContentValue_FullSyncRequest struct { - FullSyncRequest *ObjectFullSyncRequest `protobuf:"bytes,2,opt,name=fullSyncRequest,proto3,oneof" json:"fullSyncRequest,omitempty"` -} -type ObjectSyncContentValue_FullSyncResponse struct { - FullSyncResponse *ObjectFullSyncResponse `protobuf:"bytes,3,opt,name=fullSyncResponse,proto3,oneof" json:"fullSyncResponse,omitempty"` -} -type ObjectSyncContentValue_ErrorResponse struct { - ErrorResponse *ObjectErrorResponse `protobuf:"bytes,4,opt,name=errorResponse,proto3,oneof" json:"errorResponse,omitempty"` -} - -func (*ObjectSyncContentValue_HeadUpdate) isObjectSyncContentValue_Value() {} -func (*ObjectSyncContentValue_FullSyncRequest) isObjectSyncContentValue_Value() {} -func (*ObjectSyncContentValue_FullSyncResponse) isObjectSyncContentValue_Value() {} -func (*ObjectSyncContentValue_ErrorResponse) isObjectSyncContentValue_Value() {} - -func (m *ObjectSyncContentValue) GetValue() isObjectSyncContentValue_Value { +func (m *ObjectSyncMessage) GetObjectId() string { if m != nil { - return m.Value - } - return nil -} - -func (m *ObjectSyncContentValue) GetHeadUpdate() *ObjectHeadUpdate { - if x, ok := m.GetValue().(*ObjectSyncContentValue_HeadUpdate); ok { - return x.HeadUpdate - } - return nil -} - -func (m *ObjectSyncContentValue) GetFullSyncRequest() *ObjectFullSyncRequest { - if x, ok := m.GetValue().(*ObjectSyncContentValue_FullSyncRequest); ok { - return x.FullSyncRequest - } - return nil -} - -func (m *ObjectSyncContentValue) GetFullSyncResponse() *ObjectFullSyncResponse { - if x, ok := m.GetValue().(*ObjectSyncContentValue_FullSyncResponse); ok { - return x.FullSyncResponse - } - return nil -} - -func (m *ObjectSyncContentValue) GetErrorResponse() *ObjectErrorResponse { - if x, ok := m.GetValue().(*ObjectSyncContentValue_ErrorResponse); ok { - return x.ErrorResponse - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*ObjectSyncContentValue) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*ObjectSyncContentValue_HeadUpdate)(nil), - (*ObjectSyncContentValue_FullSyncRequest)(nil), - (*ObjectSyncContentValue_FullSyncResponse)(nil), - (*ObjectSyncContentValue_ErrorResponse)(nil), - } -} - -// ObjectHeadUpdate is a message sent on document head update -type ObjectHeadUpdate struct { - Heads []string `protobuf:"bytes,1,rep,name=heads,proto3" json:"heads,omitempty"` - Changes []*treechangeproto.RawTreeChangeWithId `protobuf:"bytes,2,rep,name=changes,proto3" json:"changes,omitempty"` - SnapshotPath []string `protobuf:"bytes,3,rep,name=snapshotPath,proto3" json:"snapshotPath,omitempty"` -} - -func (m *ObjectHeadUpdate) Reset() { *m = ObjectHeadUpdate{} } -func (m *ObjectHeadUpdate) String() string { return proto.CompactTextString(m) } -func (*ObjectHeadUpdate) ProtoMessage() {} -func (*ObjectHeadUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_80e49f1f4ac27799, []int{7} -} -func (m *ObjectHeadUpdate) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ObjectHeadUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ObjectHeadUpdate.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 *ObjectHeadUpdate) XXX_Merge(src proto.Message) { - xxx_messageInfo_ObjectHeadUpdate.Merge(m, src) -} -func (m *ObjectHeadUpdate) XXX_Size() int { - return m.Size() -} -func (m *ObjectHeadUpdate) XXX_DiscardUnknown() { - xxx_messageInfo_ObjectHeadUpdate.DiscardUnknown(m) -} - -var xxx_messageInfo_ObjectHeadUpdate proto.InternalMessageInfo - -func (m *ObjectHeadUpdate) GetHeads() []string { - if m != nil { - return m.Heads - } - return nil -} - -func (m *ObjectHeadUpdate) GetChanges() []*treechangeproto.RawTreeChangeWithId { - if m != nil { - return m.Changes - } - return nil -} - -func (m *ObjectHeadUpdate) GetSnapshotPath() []string { - if m != nil { - return m.SnapshotPath - } - return nil -} - -// ObjectHeadUpdate is a message sent when document needs full sync -type ObjectFullSyncRequest struct { - Heads []string `protobuf:"bytes,1,rep,name=heads,proto3" json:"heads,omitempty"` - Changes []*treechangeproto.RawTreeChangeWithId `protobuf:"bytes,2,rep,name=changes,proto3" json:"changes,omitempty"` - SnapshotPath []string `protobuf:"bytes,3,rep,name=snapshotPath,proto3" json:"snapshotPath,omitempty"` -} - -func (m *ObjectFullSyncRequest) Reset() { *m = ObjectFullSyncRequest{} } -func (m *ObjectFullSyncRequest) String() string { return proto.CompactTextString(m) } -func (*ObjectFullSyncRequest) ProtoMessage() {} -func (*ObjectFullSyncRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_80e49f1f4ac27799, []int{8} -} -func (m *ObjectFullSyncRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ObjectFullSyncRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ObjectFullSyncRequest.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 *ObjectFullSyncRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ObjectFullSyncRequest.Merge(m, src) -} -func (m *ObjectFullSyncRequest) XXX_Size() int { - return m.Size() -} -func (m *ObjectFullSyncRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ObjectFullSyncRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ObjectFullSyncRequest proto.InternalMessageInfo - -func (m *ObjectFullSyncRequest) GetHeads() []string { - if m != nil { - return m.Heads - } - return nil -} - -func (m *ObjectFullSyncRequest) GetChanges() []*treechangeproto.RawTreeChangeWithId { - if m != nil { - return m.Changes - } - return nil -} - -func (m *ObjectFullSyncRequest) GetSnapshotPath() []string { - if m != nil { - return m.SnapshotPath - } - return nil -} - -// ObjectFullSyncResponse is a message sent as a response for a specific full sync -type ObjectFullSyncResponse struct { - Heads []string `protobuf:"bytes,1,rep,name=heads,proto3" json:"heads,omitempty"` - Changes []*treechangeproto.RawTreeChangeWithId `protobuf:"bytes,2,rep,name=changes,proto3" json:"changes,omitempty"` - SnapshotPath []string `protobuf:"bytes,3,rep,name=snapshotPath,proto3" json:"snapshotPath,omitempty"` -} - -func (m *ObjectFullSyncResponse) Reset() { *m = ObjectFullSyncResponse{} } -func (m *ObjectFullSyncResponse) String() string { return proto.CompactTextString(m) } -func (*ObjectFullSyncResponse) ProtoMessage() {} -func (*ObjectFullSyncResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_80e49f1f4ac27799, []int{9} -} -func (m *ObjectFullSyncResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ObjectFullSyncResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ObjectFullSyncResponse.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 *ObjectFullSyncResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ObjectFullSyncResponse.Merge(m, src) -} -func (m *ObjectFullSyncResponse) XXX_Size() int { - return m.Size() -} -func (m *ObjectFullSyncResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ObjectFullSyncResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ObjectFullSyncResponse proto.InternalMessageInfo - -func (m *ObjectFullSyncResponse) GetHeads() []string { - if m != nil { - return m.Heads - } - return nil -} - -func (m *ObjectFullSyncResponse) GetChanges() []*treechangeproto.RawTreeChangeWithId { - if m != nil { - return m.Changes - } - return nil -} - -func (m *ObjectFullSyncResponse) GetSnapshotPath() []string { - if m != nil { - return m.SnapshotPath - } - return nil -} - -// ObjectErrorResponse is an error sent as a response for a full sync request -type ObjectErrorResponse struct { - Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` -} - -func (m *ObjectErrorResponse) Reset() { *m = ObjectErrorResponse{} } -func (m *ObjectErrorResponse) String() string { return proto.CompactTextString(m) } -func (*ObjectErrorResponse) ProtoMessage() {} -func (*ObjectErrorResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_80e49f1f4ac27799, []int{10} -} -func (m *ObjectErrorResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ObjectErrorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ObjectErrorResponse.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 *ObjectErrorResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ObjectErrorResponse.Merge(m, src) -} -func (m *ObjectErrorResponse) XXX_Size() int { - return m.Size() -} -func (m *ObjectErrorResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ObjectErrorResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ObjectErrorResponse proto.InternalMessageInfo - -func (m *ObjectErrorResponse) GetError() string { - if m != nil { - return m.Error + return m.ObjectId } return "" } @@ -755,7 +406,7 @@ func (m *PushSpaceRequest) Reset() { *m = PushSpaceRequest{} } func (m *PushSpaceRequest) String() string { return proto.CompactTextString(m) } func (*PushSpaceRequest) ProtoMessage() {} func (*PushSpaceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_80e49f1f4ac27799, []int{11} + return fileDescriptor_80e49f1f4ac27799, []int{6} } func (m *PushSpaceRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -806,7 +457,7 @@ func (m *PushSpaceResponse) Reset() { *m = PushSpaceResponse{} } func (m *PushSpaceResponse) String() string { return proto.CompactTextString(m) } func (*PushSpaceResponse) ProtoMessage() {} func (*PushSpaceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_80e49f1f4ac27799, []int{12} + return fileDescriptor_80e49f1f4ac27799, []int{7} } func (m *PushSpaceResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -848,7 +499,7 @@ func (m *SpaceHeader) Reset() { *m = SpaceHeader{} } func (m *SpaceHeader) String() string { return proto.CompactTextString(m) } func (*SpaceHeader) ProtoMessage() {} func (*SpaceHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_80e49f1f4ac27799, []int{13} + return fileDescriptor_80e49f1f4ac27799, []int{8} } func (m *SpaceHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -921,7 +572,7 @@ func (m *RawSpaceHeader) Reset() { *m = RawSpaceHeader{} } func (m *RawSpaceHeader) String() string { return proto.CompactTextString(m) } func (*RawSpaceHeader) ProtoMessage() {} func (*RawSpaceHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_80e49f1f4ac27799, []int{14} + return fileDescriptor_80e49f1f4ac27799, []int{9} } func (m *RawSpaceHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -973,7 +624,7 @@ func (m *RawSpaceHeaderWithId) Reset() { *m = RawSpaceHeaderWithId{} } func (m *RawSpaceHeaderWithId) String() string { return proto.CompactTextString(m) } func (*RawSpaceHeaderWithId) ProtoMessage() {} func (*RawSpaceHeaderWithId) Descriptor() ([]byte, []int) { - return fileDescriptor_80e49f1f4ac27799, []int{15} + return fileDescriptor_80e49f1f4ac27799, []int{10} } func (m *RawSpaceHeaderWithId) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1024,11 +675,6 @@ func init() { proto.RegisterType((*HeadSyncRequest)(nil), "anySpace.HeadSyncRequest") proto.RegisterType((*HeadSyncResponse)(nil), "anySpace.HeadSyncResponse") proto.RegisterType((*ObjectSyncMessage)(nil), "anySpace.ObjectSyncMessage") - proto.RegisterType((*ObjectSyncContentValue)(nil), "anySpace.ObjectSyncContentValue") - proto.RegisterType((*ObjectHeadUpdate)(nil), "anySpace.ObjectHeadUpdate") - proto.RegisterType((*ObjectFullSyncRequest)(nil), "anySpace.ObjectFullSyncRequest") - proto.RegisterType((*ObjectFullSyncResponse)(nil), "anySpace.ObjectFullSyncResponse") - proto.RegisterType((*ObjectErrorResponse)(nil), "anySpace.ObjectErrorResponse") proto.RegisterType((*PushSpaceRequest)(nil), "anySpace.PushSpaceRequest") proto.RegisterType((*PushSpaceResponse)(nil), "anySpace.PushSpaceResponse") proto.RegisterType((*SpaceHeader)(nil), "anySpace.SpaceHeader") @@ -1041,68 +687,52 @@ func init() { } var fileDescriptor_80e49f1f4ac27799 = []byte{ - // 963 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b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 0xcd, 0x03, 0xeb, 0x63, - 0xeb, 0xfe, 0x67, 0x7f, 0x9f, 0xf7, 0xad, 0x57, 0xe7, 0x7d, 0xeb, 0x9f, 0xf3, 0xbe, 0xf5, 0xc7, - 0x45, 0xbf, 0xf2, 0xea, 0xa2, 0x5f, 0x79, 0x7d, 0xd1, 0xaf, 0xfc, 0xd0, 0xbb, 0xfc, 0x5f, 0xad, - 0xe7, 0x7b, 0xf8, 0xe7, 0xd3, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x39, 0x40, 0xba, 0x5d, 0x8f, - 0x09, 0x00, 0x00, + // 717 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0x4f, 0x6f, 0xda, 0x48, + 0x14, 0xc7, 0x84, 0x24, 0xf0, 0x20, 0x84, 0xcc, 0x66, 0xb5, 0x5e, 0x76, 0x97, 0x45, 0x3e, 0xac, + 0xd0, 0x4a, 0x0b, 0x5b, 0x5a, 0xa9, 0x87, 0x5c, 0x9a, 0x26, 0x44, 0x45, 0x6d, 0x9a, 0x68, 0x68, + 0x55, 0xa9, 0xea, 0x65, 0x62, 0x4f, 0xc0, 0x2d, 0xf6, 0xb8, 0x33, 0x83, 0x88, 0x0f, 0xfd, 0x08, + 0x95, 0xfa, 0x15, 0xfa, 0x6d, 0x7a, 0xcc, 0x31, 0xc7, 0x2a, 0xf9, 0x22, 0xd5, 0x3c, 0x63, 0x0c, + 0x29, 0xc9, 0x01, 0x33, 0xef, 0xcf, 0xef, 0xbd, 0xdf, 0xfc, 0xfc, 0x9e, 0xe1, 0x81, 0x2b, 0x82, + 0x40, 0x84, 0x2a, 0x62, 0x2e, 0xef, 0xe0, 0x53, 0xc5, 0xa1, 0x1b, 0x49, 0xa1, 0x45, 0x07, 0x9f, + 0x2a, 0xf3, 0xb6, 0xd1, 0x41, 0x8a, 0x2c, 0x8c, 0x07, 0xc6, 0x57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 0xff, 0x5b, 0x4f, 0x1f, 0x7d, + 0xbb, 0x6e, 0x58, 0x97, 0xd7, 0x0d, 0xeb, 0xfb, 0x75, 0xc3, 0xfa, 0x72, 0xd3, 0xc8, 0x5d, 0xde, + 0x34, 0x72, 0x57, 0x37, 0x8d, 0xdc, 0xdb, 0xfa, 0xdd, 0xdf, 0xed, 0xb3, 0x0d, 0xfc, 0x7b, 0xf8, + 0x23, 0x00, 0x00, 0xff, 0xff, 0x84, 0x55, 0x32, 0xc7, 0xdc, 0x05, 0x00, 0x00, } func (m *HeadSyncRange) Marshal() (dAtA []byte, err error) { @@ -1330,41 +960,24 @@ func (m *ObjectSyncMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.TrackingId) > 0 { - i -= len(m.TrackingId) - copy(dAtA[i:], m.TrackingId) - i = encodeVarintSpacesync(dAtA, i, uint64(len(m.TrackingId))) - i-- - dAtA[i] = 0x2a - } - if len(m.TreeId) > 0 { - i -= len(m.TreeId) - copy(dAtA[i:], m.TreeId) - i = encodeVarintSpacesync(dAtA, i, uint64(len(m.TreeId))) + if len(m.ObjectId) > 0 { + i -= len(m.ObjectId) + copy(dAtA[i:], m.ObjectId) + i = encodeVarintSpacesync(dAtA, i, uint64(len(m.ObjectId))) i-- dAtA[i] = 0x22 } - if m.RootChange != nil { - { - size, err := m.RootChange.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSpacesync(dAtA, i, uint64(size)) - } + if len(m.Payload) > 0 { + i -= len(m.Payload) + copy(dAtA[i:], m.Payload) + i = encodeVarintSpacesync(dAtA, i, uint64(len(m.Payload))) i-- dAtA[i] = 0x1a } - if m.Content != nil { - { - size, err := m.Content.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSpacesync(dAtA, i, uint64(size)) - } + if len(m.ReplyId) > 0 { + i -= len(m.ReplyId) + copy(dAtA[i:], m.ReplyId) + i = encodeVarintSpacesync(dAtA, i, uint64(len(m.ReplyId))) i-- dAtA[i] = 0x12 } @@ -1378,317 +991,6 @@ func (m *ObjectSyncMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ObjectSyncContentValue) 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 *ObjectSyncContentValue) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ObjectSyncContentValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Value != nil { - { - size := m.Value.Size() - i -= size - if _, err := m.Value.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *ObjectSyncContentValue_HeadUpdate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ObjectSyncContentValue_HeadUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.HeadUpdate != nil { - { - size, err := m.HeadUpdate.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSpacesync(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *ObjectSyncContentValue_FullSyncRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ObjectSyncContentValue_FullSyncRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.FullSyncRequest != nil { - { - size, err := m.FullSyncRequest.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSpacesync(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *ObjectSyncContentValue_FullSyncResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ObjectSyncContentValue_FullSyncResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.FullSyncResponse != nil { - { - size, err := m.FullSyncResponse.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSpacesync(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} -func (m *ObjectSyncContentValue_ErrorResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ObjectSyncContentValue_ErrorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.ErrorResponse != nil { - { - size, err := m.ErrorResponse.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSpacesync(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - return len(dAtA) - i, nil -} -func (m *ObjectHeadUpdate) 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 *ObjectHeadUpdate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ObjectHeadUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.SnapshotPath) > 0 { - for iNdEx := len(m.SnapshotPath) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.SnapshotPath[iNdEx]) - copy(dAtA[i:], m.SnapshotPath[iNdEx]) - i = encodeVarintSpacesync(dAtA, i, uint64(len(m.SnapshotPath[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Changes) > 0 { - for iNdEx := len(m.Changes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Changes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSpacesync(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Heads) > 0 { - for iNdEx := len(m.Heads) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Heads[iNdEx]) - copy(dAtA[i:], m.Heads[iNdEx]) - i = encodeVarintSpacesync(dAtA, i, uint64(len(m.Heads[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *ObjectFullSyncRequest) 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 *ObjectFullSyncRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ObjectFullSyncRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.SnapshotPath) > 0 { - for iNdEx := len(m.SnapshotPath) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.SnapshotPath[iNdEx]) - copy(dAtA[i:], m.SnapshotPath[iNdEx]) - i = encodeVarintSpacesync(dAtA, i, uint64(len(m.SnapshotPath[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Changes) > 0 { - for iNdEx := len(m.Changes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Changes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSpacesync(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Heads) > 0 { - for iNdEx := len(m.Heads) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Heads[iNdEx]) - copy(dAtA[i:], m.Heads[iNdEx]) - i = encodeVarintSpacesync(dAtA, i, uint64(len(m.Heads[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *ObjectFullSyncResponse) 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 *ObjectFullSyncResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ObjectFullSyncResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.SnapshotPath) > 0 { - for iNdEx := len(m.SnapshotPath) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.SnapshotPath[iNdEx]) - copy(dAtA[i:], m.SnapshotPath[iNdEx]) - i = encodeVarintSpacesync(dAtA, i, uint64(len(m.SnapshotPath[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Changes) > 0 { - for iNdEx := len(m.Changes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Changes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSpacesync(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Heads) > 0 { - for iNdEx := len(m.Heads) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Heads[iNdEx]) - copy(dAtA[i:], m.Heads[iNdEx]) - i = encodeVarintSpacesync(dAtA, i, uint64(len(m.Heads[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *ObjectErrorResponse) 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 *ObjectErrorResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ObjectErrorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Error) > 0 { - i -= len(m.Error) - copy(dAtA[i:], m.Error) - i = encodeVarintSpacesync(dAtA, i, uint64(len(m.Error))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *PushSpaceRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1999,173 +1301,15 @@ func (m *ObjectSyncMessage) Size() (n int) { if l > 0 { n += 1 + l + sovSpacesync(uint64(l)) } - if m.Content != nil { - l = m.Content.Size() - n += 1 + l + sovSpacesync(uint64(l)) - } - if m.RootChange != nil { - l = m.RootChange.Size() - n += 1 + l + sovSpacesync(uint64(l)) - } - l = len(m.TreeId) + l = len(m.ReplyId) if l > 0 { n += 1 + l + sovSpacesync(uint64(l)) } - l = len(m.TrackingId) + l = len(m.Payload) if l > 0 { n += 1 + l + sovSpacesync(uint64(l)) } - return n -} - -func (m *ObjectSyncContentValue) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Value != nil { - n += m.Value.Size() - } - return n -} - -func (m *ObjectSyncContentValue_HeadUpdate) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.HeadUpdate != nil { - l = m.HeadUpdate.Size() - n += 1 + l + sovSpacesync(uint64(l)) - } - return n -} -func (m *ObjectSyncContentValue_FullSyncRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.FullSyncRequest != nil { - l = m.FullSyncRequest.Size() - n += 1 + l + sovSpacesync(uint64(l)) - } - return n -} -func (m *ObjectSyncContentValue_FullSyncResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.FullSyncResponse != nil { - l = m.FullSyncResponse.Size() - n += 1 + l + sovSpacesync(uint64(l)) - } - return n -} -func (m *ObjectSyncContentValue_ErrorResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ErrorResponse != nil { - l = m.ErrorResponse.Size() - n += 1 + l + sovSpacesync(uint64(l)) - } - return n -} -func (m *ObjectHeadUpdate) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Heads) > 0 { - for _, s := range m.Heads { - l = len(s) - n += 1 + l + sovSpacesync(uint64(l)) - } - } - if len(m.Changes) > 0 { - for _, e := range m.Changes { - l = e.Size() - n += 1 + l + sovSpacesync(uint64(l)) - } - } - if len(m.SnapshotPath) > 0 { - for _, s := range m.SnapshotPath { - l = len(s) - n += 1 + l + sovSpacesync(uint64(l)) - } - } - return n -} - -func (m *ObjectFullSyncRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Heads) > 0 { - for _, s := range m.Heads { - l = len(s) - n += 1 + l + sovSpacesync(uint64(l)) - } - } - if len(m.Changes) > 0 { - for _, e := range m.Changes { - l = e.Size() - n += 1 + l + sovSpacesync(uint64(l)) - } - } - if len(m.SnapshotPath) > 0 { - for _, s := range m.SnapshotPath { - l = len(s) - n += 1 + l + sovSpacesync(uint64(l)) - } - } - return n -} - -func (m *ObjectFullSyncResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Heads) > 0 { - for _, s := range m.Heads { - l = len(s) - n += 1 + l + sovSpacesync(uint64(l)) - } - } - if len(m.Changes) > 0 { - for _, e := range m.Changes { - l = e.Size() - n += 1 + l + sovSpacesync(uint64(l)) - } - } - if len(m.SnapshotPath) > 0 { - for _, s := range m.SnapshotPath { - l = len(s) - n += 1 + l + sovSpacesync(uint64(l)) - } - } - return n -} - -func (m *ObjectErrorResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Error) + l = len(m.ObjectId) if l > 0 { n += 1 + l + sovSpacesync(uint64(l)) } @@ -2886,9 +2030,9 @@ func (m *ObjectSyncMessage) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ReplyId", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowSpacesync @@ -2898,33 +2042,29 @@ func (m *ObjectSyncMessage) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthSpacesync } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthSpacesync } if postIndex > l { return io.ErrUnexpectedEOF } - if m.Content == nil { - m.Content = &ObjectSyncContentValue{} - } - if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.ReplyId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RootChange", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowSpacesync @@ -2934,31 +2074,29 @@ func (m *ObjectSyncMessage) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return ErrInvalidLengthSpacesync } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthSpacesync } if postIndex > l { return io.ErrUnexpectedEOF } - if m.RootChange == nil { - m.RootChange = &treechangeproto.RawTreeChangeWithId{} - } - if err := m.RootChange.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) + if m.Payload == nil { + m.Payload = []byte{} } iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TreeId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ObjectId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2986,755 +2124,7 @@ func (m *ObjectSyncMessage) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.TreeId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TrackingId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSpacesync - } - 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 ErrInvalidLengthSpacesync - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSpacesync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TrackingId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSpacesync(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSpacesync - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ObjectSyncContentValue) 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 ErrIntOverflowSpacesync - } - 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: ObjectSyncContentValue: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ObjectSyncContentValue: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field HeadUpdate", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSpacesync - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSpacesync - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSpacesync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &ObjectHeadUpdate{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Value = &ObjectSyncContentValue_HeadUpdate{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FullSyncRequest", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSpacesync - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSpacesync - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSpacesync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &ObjectFullSyncRequest{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Value = &ObjectSyncContentValue_FullSyncRequest{v} - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FullSyncResponse", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSpacesync - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSpacesync - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSpacesync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &ObjectFullSyncResponse{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Value = &ObjectSyncContentValue_FullSyncResponse{v} - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ErrorResponse", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSpacesync - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSpacesync - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSpacesync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &ObjectErrorResponse{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Value = &ObjectSyncContentValue_ErrorResponse{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSpacesync(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSpacesync - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ObjectHeadUpdate) 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 ErrIntOverflowSpacesync - } - 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: ObjectHeadUpdate: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ObjectHeadUpdate: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Heads", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSpacesync - } - 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 ErrInvalidLengthSpacesync - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSpacesync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Heads = append(m.Heads, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Changes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSpacesync - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSpacesync - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSpacesync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Changes = append(m.Changes, &treechangeproto.RawTreeChangeWithId{}) - if err := m.Changes[len(m.Changes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SnapshotPath", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSpacesync - } - 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 ErrInvalidLengthSpacesync - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSpacesync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SnapshotPath = append(m.SnapshotPath, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSpacesync(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSpacesync - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ObjectFullSyncRequest) 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 ErrIntOverflowSpacesync - } - 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: ObjectFullSyncRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ObjectFullSyncRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Heads", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSpacesync - } - 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 ErrInvalidLengthSpacesync - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSpacesync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Heads = append(m.Heads, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Changes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSpacesync - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSpacesync - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSpacesync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Changes = append(m.Changes, &treechangeproto.RawTreeChangeWithId{}) - if err := m.Changes[len(m.Changes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SnapshotPath", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSpacesync - } - 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 ErrInvalidLengthSpacesync - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSpacesync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SnapshotPath = append(m.SnapshotPath, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSpacesync(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSpacesync - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ObjectFullSyncResponse) 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 ErrIntOverflowSpacesync - } - 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: ObjectFullSyncResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ObjectFullSyncResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Heads", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSpacesync - } - 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 ErrInvalidLengthSpacesync - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSpacesync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Heads = append(m.Heads, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Changes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSpacesync - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSpacesync - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSpacesync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Changes = append(m.Changes, &treechangeproto.RawTreeChangeWithId{}) - if err := m.Changes[len(m.Changes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SnapshotPath", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSpacesync - } - 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 ErrInvalidLengthSpacesync - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSpacesync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SnapshotPath = append(m.SnapshotPath, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSpacesync(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSpacesync - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ObjectErrorResponse) 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 ErrIntOverflowSpacesync - } - 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: ObjectErrorResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ObjectErrorResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSpacesync - } - 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 ErrInvalidLengthSpacesync - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSpacesync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Error = string(dAtA[iNdEx:postIndex]) + m.ObjectId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/common/commonspace/syncservice/streampool.go b/common/commonspace/syncservice/streampool.go index f3d872a7..89572992 100644 --- a/common/commonspace/syncservice/streampool.go +++ b/common/commonspace/syncservice/streampool.go @@ -78,13 +78,13 @@ func (s *streamPool) SendSync( peerId string, msg *spacesyncproto.ObjectSyncMessage) (reply *spacesyncproto.ObjectSyncMessage, err error) { newCounter := s.counter.Add(1) - msg.TrackingId = genStreamPoolKey(peerId, msg.TreeId, newCounter) + msg.ReplyId = genStreamPoolKey(peerId, msg.ObjectId, newCounter) s.waitersMx.Lock() waiter := responseWaiter{ ch: make(chan *spacesyncproto.ObjectSyncMessage, 1), } - s.waiters[msg.TrackingId] = waiter + s.waiters[msg.ReplyId] = waiter s.waitersMx.Unlock() err = s.SendAsync([]string{peerId}, msg) @@ -95,10 +95,10 @@ func (s *streamPool) SendSync( select { case <-delay.C: s.waitersMx.Lock() - delete(s.waiters, msg.TrackingId) + delete(s.waiters, msg.ReplyId) s.waitersMx.Unlock() - log.With("trackingId", msg.TrackingId).Error("time elapsed when waiting") + log.With("trackingId", msg.ReplyId).Error("time elapsed when waiting") err = ErrSyncTimeout case reply = <-waiter.ch: if !delay.Stop() { @@ -125,8 +125,7 @@ func (s *streamPool) SendAsync(peers []string, message *spacesyncproto.ObjectSyn streams := getStreams() s.Unlock() - log.With("description", spacesyncproto.MessageDescription(message)). - With("treeId", message.TreeId). + log.With("objectId", message.ObjectId). Debugf("sending message to %d peers", len(streams)) for _, s := range streams { err = s.Send(message) @@ -174,8 +173,7 @@ Loop: func (s *streamPool) BroadcastAsync(message *spacesyncproto.ObjectSyncMessage) (err error) { streams := s.getAllStreams() - log.With("description", spacesyncproto.MessageDescription(message)). - With("treeId", message.TreeId). + log.With("objectId", message.ObjectId). Debugf("broadcasting message to %d peers", len(streams)) for _, stream := range streams { if err = stream.Send(message); err != nil { @@ -224,23 +222,23 @@ func (s *streamPool) readPeerLoop(peerId string, stream spacesyncproto.SpaceStre process := func(msg *spacesyncproto.ObjectSyncMessage) { s.lastUsage.Store(time.Now().Unix()) - if msg.TrackingId == "" { + if msg.ReplyId == "" { s.messageHandler(stream.Context(), peerId, msg) return } - log.With("trackingId", msg.TrackingId).Debug("getting message with tracking id") + log.With("trackingId", msg.ReplyId).Debug("getting message with tracking id") s.waitersMx.Lock() - waiter, exists := s.waiters[msg.TrackingId] + waiter, exists := s.waiters[msg.ReplyId] if !exists { - log.With("trackingId", msg.TrackingId).Debug("tracking id not exists") + log.With("trackingId", msg.ReplyId).Debug("tracking id not exists") s.waitersMx.Unlock() s.messageHandler(stream.Context(), peerId, msg) return } - log.With("trackingId", msg.TrackingId).Debug("tracking id exists") + log.With("trackingId", msg.ReplyId).Debug("tracking id exists") - delete(s.waiters, msg.TrackingId) + delete(s.waiters, msg.ReplyId) s.waitersMx.Unlock() waiter.ch <- msg } diff --git a/common/commonspace/syncservice/syncservice.go b/common/commonspace/syncservice/syncservice.go index d07cb1b2..24eb3054 100644 --- a/common/commonspace/syncservice/syncservice.go +++ b/common/commonspace/syncservice/syncservice.go @@ -84,7 +84,7 @@ func (s *syncService) LastUsage() time.Time { } func (s *syncService) HandleMessage(ctx context.Context, senderId string, message *spacesyncproto.ObjectSyncMessage) (err error) { - obj, err := s.objectGetter.GetObject(ctx, message.TreeId) + obj, err := s.objectGetter.GetObject(ctx, message.ObjectId) if err != nil { return } diff --git a/common/commonspace/synctree/requestfactory.go b/common/commonspace/synctree/requestfactory.go index f35133ae..8e05267a 100644 --- a/common/commonspace/synctree/requestfactory.go +++ b/common/commonspace/synctree/requestfactory.go @@ -2,17 +2,16 @@ package synctree import ( "fmt" - "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/tree" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/treechangeproto" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/slice" ) type RequestFactory interface { - CreateHeadUpdate(t tree.ObjectTree, added []*treechangeproto.RawTreeChangeWithId) (msg *spacesyncproto.ObjectSyncMessage) - CreateNewTreeRequest(id string) (msg *spacesyncproto.ObjectSyncMessage) - CreateFullSyncRequest(t tree.ObjectTree, theirHeads, theirSnapshotPath []string, trackingId string) (req *spacesyncproto.ObjectSyncMessage, err error) - CreateFullSyncResponse(t tree.ObjectTree, theirHeads, theirSnapshotPath []string, trackingId string) (*spacesyncproto.ObjectSyncMessage, error) + CreateHeadUpdate(t tree.ObjectTree, added []*treechangeproto.RawTreeChangeWithId) (msg *treechangeproto.TreeSyncMessage) + CreateNewTreeRequest() (msg *treechangeproto.TreeSyncMessage) + CreateFullSyncRequest(t tree.ObjectTree, theirHeads, theirSnapshotPath []string) (req *treechangeproto.TreeSyncMessage, err error) + CreateFullSyncResponse(t tree.ObjectTree, theirHeads, theirSnapshotPath []string) (*treechangeproto.TreeSyncMessage, error) } var factory = &requestFactory{} @@ -23,20 +22,20 @@ func GetRequestFactory() RequestFactory { type requestFactory struct{} -func (r *requestFactory) CreateHeadUpdate(t tree.ObjectTree, added []*treechangeproto.RawTreeChangeWithId) (msg *spacesyncproto.ObjectSyncMessage) { - return spacesyncproto.WrapHeadUpdate(&spacesyncproto.ObjectHeadUpdate{ +func (r *requestFactory) CreateHeadUpdate(t tree.ObjectTree, added []*treechangeproto.RawTreeChangeWithId) (msg *treechangeproto.TreeSyncMessage) { + return treechangeproto.WrapHeadUpdate(&treechangeproto.TreeHeadUpdate{ Heads: t.Heads(), Changes: added, SnapshotPath: t.SnapshotPath(), - }, t.Header(), t.ID(), "") + }, t.Header()) } -func (r *requestFactory) CreateNewTreeRequest(id string) (msg *spacesyncproto.ObjectSyncMessage) { - return spacesyncproto.WrapFullRequest(&spacesyncproto.ObjectFullSyncRequest{}, nil, id, "") +func (r *requestFactory) CreateNewTreeRequest() (msg *treechangeproto.TreeSyncMessage) { + return treechangeproto.WrapFullRequest(&treechangeproto.TreeFullSyncRequest{}, nil) } -func (r *requestFactory) CreateFullSyncRequest(t tree.ObjectTree, theirHeads, theirSnapshotPath []string, trackingId string) (msg *spacesyncproto.ObjectSyncMessage, err error) { - req := &spacesyncproto.ObjectFullSyncRequest{} +func (r *requestFactory) CreateFullSyncRequest(t tree.ObjectTree, theirHeads, theirSnapshotPath []string) (msg *treechangeproto.TreeSyncMessage, err error) { + req := &treechangeproto.TreeFullSyncRequest{} if t == nil { return nil, fmt.Errorf("tree should not be empty") } @@ -51,17 +50,17 @@ func (r *requestFactory) CreateFullSyncRequest(t tree.ObjectTree, theirHeads, th } req.Changes = changesAfterSnapshot - msg = spacesyncproto.WrapFullRequest(req, t.Header(), t.ID(), trackingId) + msg = treechangeproto.WrapFullRequest(req, t.Header()) return } -func (r *requestFactory) CreateFullSyncResponse(t tree.ObjectTree, theirHeads, theirSnapshotPath []string, trackingId string) (msg *spacesyncproto.ObjectSyncMessage, err error) { - resp := &spacesyncproto.ObjectFullSyncResponse{ +func (r *requestFactory) CreateFullSyncResponse(t tree.ObjectTree, theirHeads, theirSnapshotPath []string) (msg *treechangeproto.TreeSyncMessage, err error) { + resp := &treechangeproto.TreeFullSyncResponse{ Heads: t.Heads(), SnapshotPath: t.SnapshotPath(), } if slice.UnsortedEquals(theirHeads, t.Heads()) { - msg = spacesyncproto.WrapFullResponse(resp, t.Header(), t.ID(), trackingId) + msg = treechangeproto.WrapFullResponse(resp, t.Header()) return } @@ -70,6 +69,6 @@ func (r *requestFactory) CreateFullSyncResponse(t tree.ObjectTree, theirHeads, t return } resp.Changes = ourChanges - msg = spacesyncproto.WrapFullResponse(resp, t.Header(), t.ID(), trackingId) + msg = treechangeproto.WrapFullResponse(resp, t.Header()) return } diff --git a/common/commonspace/synctree/syncclient.go b/common/commonspace/synctree/syncclient.go index 842d796b..15631c93 100644 --- a/common/commonspace/synctree/syncclient.go +++ b/common/commonspace/synctree/syncclient.go @@ -5,15 +5,17 @@ import ( "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/syncservice" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/nodeconf" + "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/treechangeproto" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/ocache" "time" ) type SyncClient interface { - syncservice.StreamPool RequestFactory ocache.ObjectLastUsage - BroadcastAsyncOrSendResponsible(message *spacesyncproto.ObjectSyncMessage) (err error) + BroadcastAsync(message *treechangeproto.TreeSyncMessage) (err error) + BroadcastAsyncOrSendResponsible(message *treechangeproto.TreeSyncMessage) (err error) + SendAsync(peerId string, message *treechangeproto.TreeSyncMessage, replyId string) (err error) } type syncClient struct { @@ -43,21 +45,51 @@ func (s *syncClient) LastUsage() time.Time { return s.StreamPool.LastUsage() } -func (s *syncClient) BroadcastAsync(message *spacesyncproto.ObjectSyncMessage) (err error) { +func (s *syncClient) BroadcastAsync(message *treechangeproto.TreeSyncMessage) (err error) { s.notifyIfNeeded(message) - return s.StreamPool.BroadcastAsync(message) + objMsg, err := marshallTreeMessage(message, message.RootChange.Id, "") + if err != nil { + return + } + return s.StreamPool.BroadcastAsync(objMsg) } -func (s *syncClient) BroadcastAsyncOrSendResponsible(message *spacesyncproto.ObjectSyncMessage) (err error) { +func (s *syncClient) SendAsync(peerId string, message *treechangeproto.TreeSyncMessage, replyId string) (err error) { + objMsg, err := marshallTreeMessage(message, message.RootChange.Id, replyId) + if err != nil { + return + } + return s.StreamPool.SendAsync([]string{peerId}, objMsg) +} + +func (s *syncClient) BroadcastAsyncOrSendResponsible(message *treechangeproto.TreeSyncMessage) (err error) { + s.notifyIfNeeded(message) + objMsg, err := marshallTreeMessage(message, message.RootChange.Id, "") + if err != nil { + return + } if s.configuration.IsResponsible(s.spaceId) { - return s.SendAsync(s.configuration.NodeIds(s.spaceId), message) + return s.StreamPool.SendAsync(s.configuration.NodeIds(s.spaceId), objMsg) } return s.BroadcastAsync(message) } -func (s *syncClient) notifyIfNeeded(message *spacesyncproto.ObjectSyncMessage) { +func (s *syncClient) notifyIfNeeded(message *treechangeproto.TreeSyncMessage) { if message.GetContent().GetHeadUpdate() != nil { update := message.GetContent().GetHeadUpdate() - s.notifiable.UpdateHeads(message.TreeId, update.Heads) + s.notifiable.UpdateHeads(message.RootChange.Id, update.Heads) } } + +func marshallTreeMessage(message *treechangeproto.TreeSyncMessage, id, replyId string) (objMsg *spacesyncproto.ObjectSyncMessage, err error) { + payload, err := message.Marshal() + if err != nil { + return + } + objMsg = &spacesyncproto.ObjectSyncMessage{ + ReplyId: replyId, + Payload: payload, + ObjectId: id, + } + return +} diff --git a/common/commonspace/synctree/synctree.go b/common/commonspace/synctree/synctree.go index fd32a06b..c8221024 100644 --- a/common/commonspace/synctree/synctree.go +++ b/common/commonspace/synctree/synctree.go @@ -5,6 +5,7 @@ import ( "errors" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/logger" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/diffservice" + spacestorage "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/storage" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/syncservice" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/syncservice/synchandler" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/synctree/updatelistener" @@ -13,6 +14,7 @@ import ( "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/tree" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/treechangeproto" + "github.com/gogo/protobuf/proto" ) var ErrSyncTreeClosed = errors.New("sync tree is closed") @@ -50,7 +52,8 @@ type BuildDeps struct { HeadNotifiable diffservice.HeadNotifiable Listener updatelistener.UpdateListener AclList list.ACLList - Storage storage.TreeStorage + SpaceStorage spacestorage.SpaceStorage + TreeStorage storage.TreeStorage } func DeriveSyncTree( @@ -107,12 +110,72 @@ func CreateSyncTree( return } +func BuildSyncTreeOrGetRemote(ctx context.Context, id string, deps BuildDeps) (t tree.ObjectTree, err error) { + getTreeRemote := func() (msg *treechangeproto.TreeSyncMessage, err error) { + // TODO: add empty context handling (when this is not happening due to head update) + peerId, err := syncservice.GetPeerIdFromStreamContext(ctx) + if err != nil { + return + } + newTreeRequest := GetRequestFactory().CreateNewTreeRequest() + objMsg, err := marshallTreeMessage(newTreeRequest, id, "") + if err != nil { + return + } + + resp, err := deps.StreamPool.SendSync(peerId, objMsg) + if resp != nil { + return + } + msg = &treechangeproto.TreeSyncMessage{} + err = proto.Unmarshal(resp.Payload, msg) + return + } + + store, err := deps.SpaceStorage.TreeStorage(id) + if err != nil && err != storage.ErrUnknownTreeId { + return + } + + isFirstBuild := false + if err == storage.ErrUnknownTreeId { + isFirstBuild = true + + var resp *treechangeproto.TreeSyncMessage + resp, err = getTreeRemote() + if err != nil { + return + } + fullSyncResp := resp.GetContent().GetFullSyncResponse() + + payload := storage.TreeStorageCreatePayload{ + TreeId: id, + RootRawChange: resp.RootChange, + Changes: fullSyncResp.Changes, + Heads: fullSyncResp.Heads, + } + + // basically building tree with inmemory storage and validating that it was without errors + err = tree.ValidateRawTree(payload, deps.AclList) + if err != nil { + return + } + // now we are sure that we can save it to the storage + store, err = deps.SpaceStorage.CreateTreeStorage(payload) + if err != nil { + return + } + } + deps.TreeStorage = store + return BuildSyncTree(ctx, isFirstBuild, deps) +} + func BuildSyncTree( ctx context.Context, isFirstBuild bool, deps BuildDeps) (t tree.ObjectTree, err error) { - t, err = buildObjectTree(deps.Storage, deps.AclList) + t, err = buildObjectTree(deps.TreeStorage, deps.AclList) if err != nil { return } diff --git a/common/commonspace/synctree/synctreehandler.go b/common/commonspace/synctree/synctreehandler.go index 441e71de..22792be3 100644 --- a/common/commonspace/synctree/synctreehandler.go +++ b/common/commonspace/synctree/synctreehandler.go @@ -5,7 +5,9 @@ import ( "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/syncservice/synchandler" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/tree" + "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/treechangeproto" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/slice" + "github.com/gogo/protobuf/proto" ) type syncTreeHandler struct { @@ -20,15 +22,21 @@ func newSyncTreeHandler(objTree tree.ObjectTree, syncClient SyncClient) synchand } } -func (s *syncTreeHandler) HandleMessage(ctx context.Context, senderId string, msg *spacesyncproto.ObjectSyncMessage) error { - content := msg.GetContent() +func (s *syncTreeHandler) HandleMessage(ctx context.Context, senderId string, msg *spacesyncproto.ObjectSyncMessage) (err error) { + unmarshalled := &treechangeproto.TreeSyncMessage{} + err = proto.Unmarshal(msg.Payload, unmarshalled) + if err != nil { + return + } + + content := unmarshalled.GetContent() switch { - case content.GetFullSyncRequest() != nil: - return s.handleFullSyncRequest(ctx, senderId, content.GetFullSyncRequest(), msg) - case content.GetFullSyncResponse() != nil: - return s.handleFullSyncResponse(ctx, senderId, content.GetFullSyncResponse(), msg) case content.GetHeadUpdate() != nil: - return s.handleHeadUpdate(ctx, senderId, content.GetHeadUpdate(), msg) + return s.handleHeadUpdate(ctx, senderId, content.GetHeadUpdate(), msg.ReplyId) + case content.GetFullSyncRequest() != nil: + return s.handleFullSyncRequest(ctx, senderId, content.GetFullSyncRequest(), msg.ReplyId) + case content.GetFullSyncResponse() != nil: + return s.handleFullSyncResponse(ctx, senderId, content.GetFullSyncResponse()) } return nil } @@ -36,14 +44,14 @@ func (s *syncTreeHandler) HandleMessage(ctx context.Context, senderId string, ms func (s *syncTreeHandler) handleHeadUpdate( ctx context.Context, senderId string, - update *spacesyncproto.ObjectHeadUpdate, - msg *spacesyncproto.ObjectSyncMessage) (err error) { + update *treechangeproto.TreeHeadUpdate, + replyId string) (err error) { log.With("senderId", senderId). With("heads", update.Heads). - With("treeId", msg.TreeId). + With("treeId", s.objTree.ID()). Debug("received head update message") var ( - fullRequest *spacesyncproto.ObjectSyncMessage + fullRequest *treechangeproto.TreeSyncMessage isEmptyUpdate = len(update.Changes) == 0 objTree = s.objTree ) @@ -54,12 +62,12 @@ func (s *syncTreeHandler) handleHeadUpdate( // isEmptyUpdate is sent when the tree is brought up from cache if isEmptyUpdate { - log.With("treeId", msg.TreeId).Debug("is empty update") + log.With("treeId", objTree.ID()).Debug("is empty update") if slice.UnsortedEquals(objTree.Heads(), update.Heads) { return nil } // we need to sync in any case - fullRequest, err = s.syncClient.CreateFullSyncRequest(objTree, update.Heads, update.SnapshotPath, msg.TrackingId) + fullRequest, err = s.syncClient.CreateFullSyncRequest(objTree, update.Heads, update.SnapshotPath) return err } @@ -76,20 +84,20 @@ func (s *syncTreeHandler) handleHeadUpdate( return nil } - fullRequest, err = s.syncClient.CreateFullSyncRequest(objTree, update.Heads, update.SnapshotPath, msg.TrackingId) + fullRequest, err = s.syncClient.CreateFullSyncRequest(objTree, update.Heads, update.SnapshotPath) return err }() if fullRequest != nil { log.With("senderId", senderId). With("heads", fullRequest.GetContent().GetFullSyncRequest().Heads). - With("treeId", msg.TreeId). + With("treeId", objTree.ID()). Debug("sending full sync request") - return s.syncClient.SendAsync([]string{senderId}, fullRequest) + return s.syncClient.SendAsync(senderId, fullRequest, replyId) } log.With("senderId", senderId). With("heads", update.Heads). - With("treeId", msg.TreeId). + With("treeId", objTree.ID()). Debug("head update finished correctly") return } @@ -97,21 +105,21 @@ func (s *syncTreeHandler) handleHeadUpdate( func (s *syncTreeHandler) handleFullSyncRequest( ctx context.Context, senderId string, - request *spacesyncproto.ObjectFullSyncRequest, - msg *spacesyncproto.ObjectSyncMessage) (err error) { + request *treechangeproto.TreeFullSyncRequest, + replyId string) (err error) { log.With("senderId", senderId). With("heads", request.Heads). - With("treeId", msg.TreeId). - With("trackingId", msg.TrackingId). + With("treeId", s.objTree.ID()). + With("trackingId", replyId). Debug("received full sync request message") var ( - fullResponse *spacesyncproto.ObjectSyncMessage - header = msg.RootChange + fullResponse *treechangeproto.TreeSyncMessage + header = s.objTree.Header() objTree = s.objTree ) defer func() { if err != nil { - s.syncClient.SendAsync([]string{senderId}, spacesyncproto.WrapError(err, header, msg.TreeId, msg.TrackingId)) + s.syncClient.SendAsync(senderId, treechangeproto.WrapError(err, header), replyId) } }() @@ -130,30 +138,29 @@ func (s *syncTreeHandler) handleFullSyncRequest( } } - fullResponse, err = s.syncClient.CreateFullSyncResponse(objTree, request.Heads, request.SnapshotPath, msg.TrackingId) + fullResponse, err = s.syncClient.CreateFullSyncResponse(objTree, request.Heads, request.SnapshotPath) return err }() if err != nil { return } - return s.syncClient.SendAsync([]string{senderId}, fullResponse) + return s.syncClient.SendAsync(senderId, fullResponse, replyId) } func (s *syncTreeHandler) handleFullSyncResponse( ctx context.Context, senderId string, - response *spacesyncproto.ObjectFullSyncResponse, - msg *spacesyncproto.ObjectSyncMessage) (err error) { + response *treechangeproto.TreeFullSyncResponse) (err error) { log.With("senderId", senderId). With("heads", response.Heads). - With("treeId", msg.TreeId). + With("treeId", s.objTree.ID()). Debug("received full sync response message") objTree := s.objTree if err != nil { log.With("senderId", senderId). With("heads", response.Heads). - With("treeId", msg.TreeId). + With("treeId", s.objTree.ID()). Debug("failed to find the tree in full sync response") return } @@ -170,7 +177,7 @@ func (s *syncTreeHandler) handleFullSyncResponse( }() log.With("error", err != nil). With("heads", response.Heads). - With("treeId", msg.TreeId). + With("treeId", s.objTree.ID()). Debug("finished full sync response") return diff --git a/common/pkg/acl/tree/mock_objecttree/mock_objecttree.go b/common/pkg/acl/tree/mock_objecttree/mock_objecttree.go index 205fb8ce..4c1925fd 100644 --- a/common/pkg/acl/tree/mock_objecttree/mock_objecttree.go +++ b/common/pkg/acl/tree/mock_objecttree/mock_objecttree.go @@ -271,7 +271,7 @@ func (mr *MockObjectTreeMockRecorder) SnapshotPath() *gomock.Call { // Storage mocks base method. func (m *MockObjectTree) Storage() storage.TreeStorage { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Storage") + ret := m.ctrl.Call(m, "SpaceStorage") ret0, _ := ret[0].(storage.TreeStorage) return ret0 } @@ -279,7 +279,7 @@ func (m *MockObjectTree) Storage() storage.TreeStorage { // Storage indicates an expected call of Storage. func (mr *MockObjectTreeMockRecorder) Storage() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Storage", reflect.TypeOf((*MockObjectTree)(nil).Storage)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpaceStorage", reflect.TypeOf((*MockObjectTree)(nil).Storage)) } // Unlock mocks base method. diff --git a/common/pkg/acl/treechangeproto/protos/treechange.proto b/common/pkg/acl/treechangeproto/protos/treechange.proto index 8f733a5d..3a55e031 100644 --- a/common/pkg/acl/treechangeproto/protos/treechange.proto +++ b/common/pkg/acl/treechangeproto/protos/treechange.proto @@ -53,3 +53,44 @@ message RawTreeChangeWithId { // Id is a cid made from rawChange payload string id = 2; } + +message TreeSyncMessage { + TreeSyncContentValue content = 1; + RawTreeChangeWithId rootChange = 2; +} + +// TreeSyncContentValue provides different types for tree sync +message TreeSyncContentValue { + oneof value { + TreeHeadUpdate headUpdate = 1; + TreeFullSyncRequest fullSyncRequest = 2; + TreeFullSyncResponse fullSyncResponse = 3; + TreeErrorResponse errorResponse = 4; + } +} + +// TreeHeadUpdate is a message sent on document head update +message TreeHeadUpdate { + repeated string heads = 1; + repeated RawTreeChangeWithId changes = 2; + repeated string snapshotPath = 3; +} + +// TreeHeadUpdate is a message sent when document needs full sync +message TreeFullSyncRequest { + repeated string heads = 1; + repeated RawTreeChangeWithId changes = 2; + repeated string snapshotPath = 3; +} + +// TreeFullSyncResponse is a message sent as a response for a specific full sync +message TreeFullSyncResponse { + repeated string heads = 1; + repeated RawTreeChangeWithId changes = 2; + repeated string snapshotPath = 3; +} + +// TreeErrorResponse is an error sent as a response for a full sync request +message TreeErrorResponse { + string error = 1; +} diff --git a/common/pkg/acl/treechangeproto/treechange.go b/common/pkg/acl/treechangeproto/treechange.go new file mode 100644 index 00000000..9e4f1854 --- /dev/null +++ b/common/pkg/acl/treechangeproto/treechange.go @@ -0,0 +1,37 @@ +package treechangeproto + +func WrapHeadUpdate(update *TreeHeadUpdate, rootChange *RawTreeChangeWithId) *TreeSyncMessage { + return &TreeSyncMessage{ + Content: &TreeSyncContentValue{ + Value: &TreeSyncContentValue_HeadUpdate{HeadUpdate: update}, + }, + RootChange: rootChange, + } +} + +func WrapFullRequest(request *TreeFullSyncRequest, rootChange *RawTreeChangeWithId) *TreeSyncMessage { + return &TreeSyncMessage{ + Content: &TreeSyncContentValue{ + Value: &TreeSyncContentValue_FullSyncRequest{FullSyncRequest: request}, + }, + RootChange: rootChange, + } +} + +func WrapFullResponse(response *TreeFullSyncResponse, rootChange *RawTreeChangeWithId) *TreeSyncMessage { + return &TreeSyncMessage{ + Content: &TreeSyncContentValue{ + Value: &TreeSyncContentValue_FullSyncResponse{FullSyncResponse: response}, + }, + RootChange: rootChange, + } +} + +func WrapError(err error, rootChange *RawTreeChangeWithId) *TreeSyncMessage { + return &TreeSyncMessage{ + Content: &TreeSyncContentValue{ + Value: &TreeSyncContentValue_ErrorResponse{ErrorResponse: &TreeErrorResponse{Error: err.Error()}}, + }, + RootChange: rootChange, + } +} diff --git a/common/pkg/acl/treechangeproto/treechange.pb.go b/common/pkg/acl/treechangeproto/treechange.pb.go index fd4deb8a..0c97164b 100644 --- a/common/pkg/acl/treechangeproto/treechange.pb.go +++ b/common/pkg/acl/treechangeproto/treechange.pb.go @@ -332,11 +332,410 @@ func (m *RawTreeChangeWithId) GetId() string { return "" } +type TreeSyncMessage struct { + Content *TreeSyncContentValue `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` + RootChange *RawTreeChangeWithId `protobuf:"bytes,2,opt,name=rootChange,proto3" json:"rootChange,omitempty"` +} + +func (m *TreeSyncMessage) Reset() { *m = TreeSyncMessage{} } +func (m *TreeSyncMessage) String() string { return proto.CompactTextString(m) } +func (*TreeSyncMessage) ProtoMessage() {} +func (*TreeSyncMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_f177d8514fae978f, []int{4} +} +func (m *TreeSyncMessage) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TreeSyncMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TreeSyncMessage.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 *TreeSyncMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_TreeSyncMessage.Merge(m, src) +} +func (m *TreeSyncMessage) XXX_Size() int { + return m.Size() +} +func (m *TreeSyncMessage) XXX_DiscardUnknown() { + xxx_messageInfo_TreeSyncMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_TreeSyncMessage proto.InternalMessageInfo + +func (m *TreeSyncMessage) GetContent() *TreeSyncContentValue { + if m != nil { + return m.Content + } + return nil +} + +func (m *TreeSyncMessage) GetRootChange() *RawTreeChangeWithId { + if m != nil { + return m.RootChange + } + return nil +} + +// TreeSyncContentValue provides different types for tree sync +type TreeSyncContentValue struct { + // Types that are valid to be assigned to Value: + // + // *TreeSyncContentValue_HeadUpdate + // *TreeSyncContentValue_FullSyncRequest + // *TreeSyncContentValue_FullSyncResponse + // *TreeSyncContentValue_ErrorResponse + Value isTreeSyncContentValue_Value `protobuf_oneof:"value"` +} + +func (m *TreeSyncContentValue) Reset() { *m = TreeSyncContentValue{} } +func (m *TreeSyncContentValue) String() string { return proto.CompactTextString(m) } +func (*TreeSyncContentValue) ProtoMessage() {} +func (*TreeSyncContentValue) Descriptor() ([]byte, []int) { + return fileDescriptor_f177d8514fae978f, []int{5} +} +func (m *TreeSyncContentValue) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TreeSyncContentValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TreeSyncContentValue.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 *TreeSyncContentValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_TreeSyncContentValue.Merge(m, src) +} +func (m *TreeSyncContentValue) XXX_Size() int { + return m.Size() +} +func (m *TreeSyncContentValue) XXX_DiscardUnknown() { + xxx_messageInfo_TreeSyncContentValue.DiscardUnknown(m) +} + +var xxx_messageInfo_TreeSyncContentValue proto.InternalMessageInfo + +type isTreeSyncContentValue_Value interface { + isTreeSyncContentValue_Value() + MarshalTo([]byte) (int, error) + Size() int +} + +type TreeSyncContentValue_HeadUpdate struct { + HeadUpdate *TreeHeadUpdate `protobuf:"bytes,1,opt,name=headUpdate,proto3,oneof" json:"headUpdate,omitempty"` +} +type TreeSyncContentValue_FullSyncRequest struct { + FullSyncRequest *TreeFullSyncRequest `protobuf:"bytes,2,opt,name=fullSyncRequest,proto3,oneof" json:"fullSyncRequest,omitempty"` +} +type TreeSyncContentValue_FullSyncResponse struct { + FullSyncResponse *TreeFullSyncResponse `protobuf:"bytes,3,opt,name=fullSyncResponse,proto3,oneof" json:"fullSyncResponse,omitempty"` +} +type TreeSyncContentValue_ErrorResponse struct { + ErrorResponse *TreeErrorResponse `protobuf:"bytes,4,opt,name=errorResponse,proto3,oneof" json:"errorResponse,omitempty"` +} + +func (*TreeSyncContentValue_HeadUpdate) isTreeSyncContentValue_Value() {} +func (*TreeSyncContentValue_FullSyncRequest) isTreeSyncContentValue_Value() {} +func (*TreeSyncContentValue_FullSyncResponse) isTreeSyncContentValue_Value() {} +func (*TreeSyncContentValue_ErrorResponse) isTreeSyncContentValue_Value() {} + +func (m *TreeSyncContentValue) GetValue() isTreeSyncContentValue_Value { + if m != nil { + return m.Value + } + return nil +} + +func (m *TreeSyncContentValue) GetHeadUpdate() *TreeHeadUpdate { + if x, ok := m.GetValue().(*TreeSyncContentValue_HeadUpdate); ok { + return x.HeadUpdate + } + return nil +} + +func (m *TreeSyncContentValue) GetFullSyncRequest() *TreeFullSyncRequest { + if x, ok := m.GetValue().(*TreeSyncContentValue_FullSyncRequest); ok { + return x.FullSyncRequest + } + return nil +} + +func (m *TreeSyncContentValue) GetFullSyncResponse() *TreeFullSyncResponse { + if x, ok := m.GetValue().(*TreeSyncContentValue_FullSyncResponse); ok { + return x.FullSyncResponse + } + return nil +} + +func (m *TreeSyncContentValue) GetErrorResponse() *TreeErrorResponse { + if x, ok := m.GetValue().(*TreeSyncContentValue_ErrorResponse); ok { + return x.ErrorResponse + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*TreeSyncContentValue) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*TreeSyncContentValue_HeadUpdate)(nil), + (*TreeSyncContentValue_FullSyncRequest)(nil), + (*TreeSyncContentValue_FullSyncResponse)(nil), + (*TreeSyncContentValue_ErrorResponse)(nil), + } +} + +// TreeHeadUpdate is a message sent on document head update +type TreeHeadUpdate struct { + Heads []string `protobuf:"bytes,1,rep,name=heads,proto3" json:"heads,omitempty"` + Changes []*RawTreeChangeWithId `protobuf:"bytes,2,rep,name=changes,proto3" json:"changes,omitempty"` + SnapshotPath []string `protobuf:"bytes,3,rep,name=snapshotPath,proto3" json:"snapshotPath,omitempty"` +} + +func (m *TreeHeadUpdate) Reset() { *m = TreeHeadUpdate{} } +func (m *TreeHeadUpdate) String() string { return proto.CompactTextString(m) } +func (*TreeHeadUpdate) ProtoMessage() {} +func (*TreeHeadUpdate) Descriptor() ([]byte, []int) { + return fileDescriptor_f177d8514fae978f, []int{6} +} +func (m *TreeHeadUpdate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TreeHeadUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TreeHeadUpdate.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 *TreeHeadUpdate) XXX_Merge(src proto.Message) { + xxx_messageInfo_TreeHeadUpdate.Merge(m, src) +} +func (m *TreeHeadUpdate) XXX_Size() int { + return m.Size() +} +func (m *TreeHeadUpdate) XXX_DiscardUnknown() { + xxx_messageInfo_TreeHeadUpdate.DiscardUnknown(m) +} + +var xxx_messageInfo_TreeHeadUpdate proto.InternalMessageInfo + +func (m *TreeHeadUpdate) GetHeads() []string { + if m != nil { + return m.Heads + } + return nil +} + +func (m *TreeHeadUpdate) GetChanges() []*RawTreeChangeWithId { + if m != nil { + return m.Changes + } + return nil +} + +func (m *TreeHeadUpdate) GetSnapshotPath() []string { + if m != nil { + return m.SnapshotPath + } + return nil +} + +// TreeHeadUpdate is a message sent when document needs full sync +type TreeFullSyncRequest struct { + Heads []string `protobuf:"bytes,1,rep,name=heads,proto3" json:"heads,omitempty"` + Changes []*RawTreeChangeWithId `protobuf:"bytes,2,rep,name=changes,proto3" json:"changes,omitempty"` + SnapshotPath []string `protobuf:"bytes,3,rep,name=snapshotPath,proto3" json:"snapshotPath,omitempty"` +} + +func (m *TreeFullSyncRequest) Reset() { *m = TreeFullSyncRequest{} } +func (m *TreeFullSyncRequest) String() string { return proto.CompactTextString(m) } +func (*TreeFullSyncRequest) ProtoMessage() {} +func (*TreeFullSyncRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f177d8514fae978f, []int{7} +} +func (m *TreeFullSyncRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TreeFullSyncRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TreeFullSyncRequest.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 *TreeFullSyncRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TreeFullSyncRequest.Merge(m, src) +} +func (m *TreeFullSyncRequest) XXX_Size() int { + return m.Size() +} +func (m *TreeFullSyncRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TreeFullSyncRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_TreeFullSyncRequest proto.InternalMessageInfo + +func (m *TreeFullSyncRequest) GetHeads() []string { + if m != nil { + return m.Heads + } + return nil +} + +func (m *TreeFullSyncRequest) GetChanges() []*RawTreeChangeWithId { + if m != nil { + return m.Changes + } + return nil +} + +func (m *TreeFullSyncRequest) GetSnapshotPath() []string { + if m != nil { + return m.SnapshotPath + } + return nil +} + +// TreeFullSyncResponse is a message sent as a response for a specific full sync +type TreeFullSyncResponse struct { + Heads []string `protobuf:"bytes,1,rep,name=heads,proto3" json:"heads,omitempty"` + Changes []*RawTreeChangeWithId `protobuf:"bytes,2,rep,name=changes,proto3" json:"changes,omitempty"` + SnapshotPath []string `protobuf:"bytes,3,rep,name=snapshotPath,proto3" json:"snapshotPath,omitempty"` +} + +func (m *TreeFullSyncResponse) Reset() { *m = TreeFullSyncResponse{} } +func (m *TreeFullSyncResponse) String() string { return proto.CompactTextString(m) } +func (*TreeFullSyncResponse) ProtoMessage() {} +func (*TreeFullSyncResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f177d8514fae978f, []int{8} +} +func (m *TreeFullSyncResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TreeFullSyncResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TreeFullSyncResponse.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 *TreeFullSyncResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TreeFullSyncResponse.Merge(m, src) +} +func (m *TreeFullSyncResponse) XXX_Size() int { + return m.Size() +} +func (m *TreeFullSyncResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TreeFullSyncResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TreeFullSyncResponse proto.InternalMessageInfo + +func (m *TreeFullSyncResponse) GetHeads() []string { + if m != nil { + return m.Heads + } + return nil +} + +func (m *TreeFullSyncResponse) GetChanges() []*RawTreeChangeWithId { + if m != nil { + return m.Changes + } + return nil +} + +func (m *TreeFullSyncResponse) GetSnapshotPath() []string { + if m != nil { + return m.SnapshotPath + } + return nil +} + +// TreeErrorResponse is an error sent as a response for a full sync request +type TreeErrorResponse struct { + Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` +} + +func (m *TreeErrorResponse) Reset() { *m = TreeErrorResponse{} } +func (m *TreeErrorResponse) String() string { return proto.CompactTextString(m) } +func (*TreeErrorResponse) ProtoMessage() {} +func (*TreeErrorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f177d8514fae978f, []int{9} +} +func (m *TreeErrorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TreeErrorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TreeErrorResponse.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 *TreeErrorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TreeErrorResponse.Merge(m, src) +} +func (m *TreeErrorResponse) XXX_Size() int { + return m.Size() +} +func (m *TreeErrorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TreeErrorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TreeErrorResponse proto.InternalMessageInfo + +func (m *TreeErrorResponse) GetError() string { + if m != nil { + return m.Error + } + return "" +} + func init() { proto.RegisterType((*RootChange)(nil), "treechange.RootChange") proto.RegisterType((*TreeChange)(nil), "treechange.TreeChange") proto.RegisterType((*RawTreeChange)(nil), "treechange.RawTreeChange") proto.RegisterType((*RawTreeChangeWithId)(nil), "treechange.RawTreeChangeWithId") + proto.RegisterType((*TreeSyncMessage)(nil), "treechange.TreeSyncMessage") + proto.RegisterType((*TreeSyncContentValue)(nil), "treechange.TreeSyncContentValue") + proto.RegisterType((*TreeHeadUpdate)(nil), "treechange.TreeHeadUpdate") + proto.RegisterType((*TreeFullSyncRequest)(nil), "treechange.TreeFullSyncRequest") + proto.RegisterType((*TreeFullSyncResponse)(nil), "treechange.TreeFullSyncResponse") + proto.RegisterType((*TreeErrorResponse)(nil), "treechange.TreeErrorResponse") } func init() { @@ -344,32 +743,48 @@ func init() { } var fileDescriptor_f177d8514fae978f = []byte{ - // 393 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xcf, 0x0e, 0x93, 0x40, - 0x10, 0x87, 0xbb, 0xb4, 0xf6, 0xcf, 0x88, 0x3d, 0xac, 0x07, 0x37, 0xc6, 0x10, 0xc2, 0xc1, 0x70, - 0x2a, 0x31, 0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 0xf3, 0x18, 0xeb, 0x35, 0xcc, 0x75, 0x86, 0x85, - 0x4e, 0x73, 0xb3, 0x44, 0x5d, 0xa7, 0x6b, 0x02, 0x3c, 0xd0, 0xfa, 0x3b, 0x4d, 0x24, 0xfd, 0x0e, - 0x0d, 0xda, 0x18, 0xae, 0xec, 0x22, 0xbe, 0x00, 0x1e, 0x1f, 0xcb, 0x92, 0x32, 0x23, 0x09, 0x93, - 0x0f, 0x54, 0xad, 0x51, 0xa7, 0x36, 0xd6, 0x48, 0xfe, 0xa3, 0xd3, 0xd7, 0x32, 0x7e, 0xd4, 0xd2, - 0x55, 0x30, 0xe9, 0x2b, 0xa8, 0x85, 0x2b, 0xfd, 0xf1, 0xb6, 0x9f, 0x98, 0xfa, 0x2c, 0x9c, 0xca, - 0x0e, 0x09, 0xde, 0xc3, 0x33, 0x89, 0xa7, 0x8e, 0x24, 0x01, 0x93, 0x02, 0xab, 0x7d, 0x8e, 0xcd, - 0x7f, 0x75, 0xe5, 0xbd, 0xac, 0x97, 0xd0, 0x6a, 0x97, 0xa1, 0x39, 0x96, 0x64, 0xe5, 0xb8, 0xb2, - 0x05, 0xc1, 0x0a, 0x9e, 0xf7, 0x06, 0x7d, 0x52, 0x26, 0xdd, 0xd8, 0x97, 0x4a, 0x3c, 0x35, 0xe8, - 0x36, 0xb0, 0x05, 0x7c, 0x0e, 0x8e, 0xba, 0x8b, 0x76, 0x54, 0xb2, 0x7c, 0xf3, 0xf3, 0xe2, 0xb1, - 0xf3, 0xc5, 0x63, 0xbf, 0x2f, 0x1e, 0xfb, 0x76, 0xf5, 0x06, 0xe7, 0xab, 0x37, 0xf8, 0x75, 0xf5, - 0x06, 0x9f, 0x5f, 0xfc, 0xe7, 0xf0, 0x7e, 0x19, 0xdb, 0xdb, 0xdb, 0x3f, 0x01, 0x00, 0x00, 0xff, - 0xff, 0xa5, 0x78, 0xc6, 0x1e, 0xde, 0x02, 0x00, 0x00, + // 647 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0xc1, 0x6e, 0xd3, 0x40, + 0x10, 0xf5, 0x3a, 0x69, 0xd3, 0x4e, 0xd3, 0x16, 0xb6, 0x95, 0xb0, 0x2a, 0x30, 0x96, 0x0f, 0x28, + 0x5c, 0x1a, 0x51, 0x4e, 0x20, 0x24, 0xa4, 0x96, 0x16, 0x57, 0x15, 0x08, 0x6d, 0x0b, 0x48, 0xdc, + 0x16, 0x7b, 0x48, 0x2c, 0x52, 0xdb, 0x78, 0x37, 0x54, 0xf9, 0x00, 0x2e, 0x20, 0x21, 0x3e, 0x81, + 0x6f, 0xe0, 0x0f, 0xb8, 0x71, 0xec, 0x91, 0x23, 0x6a, 0x7e, 0x04, 0xed, 0x3a, 0x4e, 0xd6, 0x6e, + 0x90, 0xb8, 0xf5, 0x92, 0x78, 0xde, 0xce, 0xbc, 0x7d, 0xf3, 0x66, 0xd7, 0x86, 0x6e, 0xf6, 0xbe, + 0xd7, 0xe5, 0xe1, 0xa0, 0x2b, 0x73, 0xc4, 0xb0, 0xcf, 0x93, 0x1e, 0x66, 0x79, 0x2a, 0xd3, 0xae, + 0xfe, 0x15, 0x06, 0xbc, 0xad, 0x11, 0x0a, 0x33, 0xc4, 0xff, 0x41, 0x00, 0x58, 0x9a, 0xca, 0x3d, + 0x1d, 0xd2, 0x9b, 0xb0, 0xcc, 0xc3, 0x41, 0x80, 0x3c, 0x3a, 0x8c, 0x1c, 0xe2, 0x91, 0xce, 0x32, + 0x9b, 0x01, 0xd4, 0x81, 0x96, 0xc8, 0x78, 0x88, 0x87, 0x91, 0x63, 0xeb, 0xb5, 0x32, 0xa4, 0x2e, + 0x40, 0x41, 0x78, 0x32, 0xca, 0xd0, 0x69, 0xe8, 0x45, 0x03, 0x51, 0xbc, 0x32, 0x3e, 0x45, 0x21, + 0xf9, 0x69, 0xe6, 0x34, 0x3d, 0xd2, 0x69, 0xb0, 0x19, 0x40, 0x29, 0x34, 0x05, 0x62, 0xe4, 0x2c, + 0x78, 0xa4, 0xd3, 0x66, 0xfa, 0x99, 0x6e, 0xc1, 0x52, 0x1c, 0x61, 0x22, 0x63, 0x39, 0x72, 0x16, + 0x35, 0x3e, 0x8d, 0xfd, 0xef, 0x36, 0xc0, 0x49, 0x8e, 0x38, 0x11, 0xed, 0xc1, 0x8a, 0xea, 0xa8, + 0x10, 0x29, 0x1c, 0xe2, 0x35, 0x3a, 0xcb, 0xcc, 0x84, 0xaa, 0x6d, 0xd9, 0xf5, 0xb6, 0xee, 0xc0, + 0x9a, 0x48, 0x78, 0x26, 0xfa, 0xa9, 0xdc, 0xe5, 0x42, 0x75, 0x57, 0x34, 0x50, 0x43, 0xd5, 0x3e, + 0x45, 0x4b, 0xe2, 0x09, 0x97, 0x5c, 0xb7, 0xd1, 0x66, 0x26, 0x44, 0xb7, 0x81, 0x86, 0xc3, 0x3c, + 0xc7, 0x44, 0x32, 0xe4, 0xd1, 0x11, 0x8e, 0x02, 0x2e, 0xfa, 0xba, 0xad, 0x26, 0x9b, 0xb3, 0x52, + 0xb5, 0x65, 0xb1, 0x6e, 0x8b, 0x69, 0x41, 0xab, 0x6a, 0x81, 0x32, 0x3c, 0x16, 0xc7, 0x13, 0x7d, + 0xce, 0x92, 0x47, 0x3a, 0x4b, 0xcc, 0x40, 0xfc, 0xa7, 0xb0, 0xca, 0xf8, 0x99, 0x61, 0x92, 0x03, + 0xad, 0x8c, 0x8f, 0x06, 0x29, 0x2f, 0xe6, 0xda, 0x66, 0x65, 0xa8, 0x44, 0x88, 0xb8, 0x97, 0x70, + 0x39, 0xcc, 0x51, 0x9b, 0xd3, 0x66, 0x33, 0xc0, 0xdf, 0x83, 0x8d, 0x0a, 0xd1, 0xeb, 0x58, 0xf6, + 0x0f, 0x75, 0x51, 0xce, 0xcf, 0x0a, 0x68, 0x42, 0x38, 0x03, 0xe8, 0x1a, 0xd8, 0x71, 0x69, 0xb4, + 0x1d, 0x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ff, 0x33, 0xaa, 0x32, 0x9f, 0xfa, 0xd0, 0x2e, 0x2f, + 0xe1, 0x0b, 0x2e, 0xfb, 0x4e, 0x43, 0xf3, 0x56, 0x30, 0xff, 0x33, 0x81, 0x8d, 0x39, 0x96, 0x5e, + 0x8d, 0x98, 0x2f, 0xa4, 0x38, 0x58, 0xf5, 0x89, 0x5c, 0x8d, 0x9a, 0xbb, 0x70, 0xfd, 0xd2, 0x44, + 0x95, 0x12, 0x3d, 0xd1, 0xc9, 0xfb, 0xbd, 0x08, 0x76, 0xef, 0xfd, 0xba, 0x70, 0xc9, 0xf9, 0x85, + 0x4b, 0xfe, 0x5c, 0xb8, 0xe4, 0xdb, 0xd8, 0xb5, 0xce, 0xc7, 0xae, 0xf5, 0x7b, 0xec, 0x5a, 0x6f, + 0x6e, 0xfc, 0xe3, 0xfb, 0xf2, 0x76, 0x51, 0xff, 0xdd, 0xff, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xca, + 0xe3, 0xc1, 0xeb, 0x81, 0x06, 0x00, 0x00, } func (m *RootChange) Marshal() (dAtA []byte, err error) { @@ -589,6 +1004,364 @@ func (m *RawTreeChangeWithId) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *TreeSyncMessage) 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 *TreeSyncMessage) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TreeSyncMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.RootChange != nil { + { + size, err := m.RootChange.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTreechange(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Content != nil { + { + size, err := m.Content.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTreechange(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TreeSyncContentValue) 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 *TreeSyncContentValue) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TreeSyncContentValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Value != nil { + { + size := m.Value.Size() + i -= size + if _, err := m.Value.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *TreeSyncContentValue_HeadUpdate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TreeSyncContentValue_HeadUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.HeadUpdate != nil { + { + size, err := m.HeadUpdate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTreechange(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} +func (m *TreeSyncContentValue_FullSyncRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TreeSyncContentValue_FullSyncRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.FullSyncRequest != nil { + { + size, err := m.FullSyncRequest.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTreechange(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func (m *TreeSyncContentValue_FullSyncResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TreeSyncContentValue_FullSyncResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.FullSyncResponse != nil { + { + size, err := m.FullSyncResponse.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTreechange(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + return len(dAtA) - i, nil +} +func (m *TreeSyncContentValue_ErrorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TreeSyncContentValue_ErrorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.ErrorResponse != nil { + { + size, err := m.ErrorResponse.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTreechange(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + return len(dAtA) - i, nil +} +func (m *TreeHeadUpdate) 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 *TreeHeadUpdate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TreeHeadUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SnapshotPath) > 0 { + for iNdEx := len(m.SnapshotPath) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.SnapshotPath[iNdEx]) + copy(dAtA[i:], m.SnapshotPath[iNdEx]) + i = encodeVarintTreechange(dAtA, i, uint64(len(m.SnapshotPath[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(m.Changes) > 0 { + for iNdEx := len(m.Changes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Changes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTreechange(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Heads) > 0 { + for iNdEx := len(m.Heads) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Heads[iNdEx]) + copy(dAtA[i:], m.Heads[iNdEx]) + i = encodeVarintTreechange(dAtA, i, uint64(len(m.Heads[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *TreeFullSyncRequest) 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 *TreeFullSyncRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TreeFullSyncRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SnapshotPath) > 0 { + for iNdEx := len(m.SnapshotPath) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.SnapshotPath[iNdEx]) + copy(dAtA[i:], m.SnapshotPath[iNdEx]) + i = encodeVarintTreechange(dAtA, i, uint64(len(m.SnapshotPath[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(m.Changes) > 0 { + for iNdEx := len(m.Changes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Changes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTreechange(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Heads) > 0 { + for iNdEx := len(m.Heads) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Heads[iNdEx]) + copy(dAtA[i:], m.Heads[iNdEx]) + i = encodeVarintTreechange(dAtA, i, uint64(len(m.Heads[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *TreeFullSyncResponse) 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 *TreeFullSyncResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TreeFullSyncResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SnapshotPath) > 0 { + for iNdEx := len(m.SnapshotPath) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.SnapshotPath[iNdEx]) + copy(dAtA[i:], m.SnapshotPath[iNdEx]) + i = encodeVarintTreechange(dAtA, i, uint64(len(m.SnapshotPath[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(m.Changes) > 0 { + for iNdEx := len(m.Changes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Changes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTreechange(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Heads) > 0 { + for iNdEx := len(m.Heads) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Heads[iNdEx]) + copy(dAtA[i:], m.Heads[iNdEx]) + i = encodeVarintTreechange(dAtA, i, uint64(len(m.Heads[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *TreeErrorResponse) 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 *TreeErrorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TreeErrorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Error) > 0 { + i -= len(m.Error) + copy(dAtA[i:], m.Error) + i = encodeVarintTreechange(dAtA, i, uint64(len(m.Error))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintTreechange(dAtA []byte, offset int, v uint64) int { offset -= sovTreechange(v) base := offset @@ -706,6 +1479,177 @@ func (m *RawTreeChangeWithId) Size() (n int) { return n } +func (m *TreeSyncMessage) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Content != nil { + l = m.Content.Size() + n += 1 + l + sovTreechange(uint64(l)) + } + if m.RootChange != nil { + l = m.RootChange.Size() + n += 1 + l + sovTreechange(uint64(l)) + } + return n +} + +func (m *TreeSyncContentValue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Value != nil { + n += m.Value.Size() + } + return n +} + +func (m *TreeSyncContentValue_HeadUpdate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.HeadUpdate != nil { + l = m.HeadUpdate.Size() + n += 1 + l + sovTreechange(uint64(l)) + } + return n +} +func (m *TreeSyncContentValue_FullSyncRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.FullSyncRequest != nil { + l = m.FullSyncRequest.Size() + n += 1 + l + sovTreechange(uint64(l)) + } + return n +} +func (m *TreeSyncContentValue_FullSyncResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.FullSyncResponse != nil { + l = m.FullSyncResponse.Size() + n += 1 + l + sovTreechange(uint64(l)) + } + return n +} +func (m *TreeSyncContentValue_ErrorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ErrorResponse != nil { + l = m.ErrorResponse.Size() + n += 1 + l + sovTreechange(uint64(l)) + } + return n +} +func (m *TreeHeadUpdate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Heads) > 0 { + for _, s := range m.Heads { + l = len(s) + n += 1 + l + sovTreechange(uint64(l)) + } + } + if len(m.Changes) > 0 { + for _, e := range m.Changes { + l = e.Size() + n += 1 + l + sovTreechange(uint64(l)) + } + } + if len(m.SnapshotPath) > 0 { + for _, s := range m.SnapshotPath { + l = len(s) + n += 1 + l + sovTreechange(uint64(l)) + } + } + return n +} + +func (m *TreeFullSyncRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Heads) > 0 { + for _, s := range m.Heads { + l = len(s) + n += 1 + l + sovTreechange(uint64(l)) + } + } + if len(m.Changes) > 0 { + for _, e := range m.Changes { + l = e.Size() + n += 1 + l + sovTreechange(uint64(l)) + } + } + if len(m.SnapshotPath) > 0 { + for _, s := range m.SnapshotPath { + l = len(s) + n += 1 + l + sovTreechange(uint64(l)) + } + } + return n +} + +func (m *TreeFullSyncResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Heads) > 0 { + for _, s := range m.Heads { + l = len(s) + n += 1 + l + sovTreechange(uint64(l)) + } + } + if len(m.Changes) > 0 { + for _, e := range m.Changes { + l = e.Size() + n += 1 + l + sovTreechange(uint64(l)) + } + } + if len(m.SnapshotPath) > 0 { + for _, s := range m.SnapshotPath { + l = len(s) + n += 1 + l + sovTreechange(uint64(l)) + } + } + return n +} + +func (m *TreeErrorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Error) + if l > 0 { + n += 1 + l + sovTreechange(uint64(l)) + } + return n +} + func sovTreechange(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1451,6 +2395,844 @@ func (m *RawTreeChangeWithId) Unmarshal(dAtA []byte) error { } return nil } +func (m *TreeSyncMessage) 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 ErrIntOverflowTreechange + } + 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: TreeSyncMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TreeSyncMessage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTreechange + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTreechange + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTreechange + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Content == nil { + m.Content = &TreeSyncContentValue{} + } + if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RootChange", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTreechange + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTreechange + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTreechange + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RootChange == nil { + m.RootChange = &RawTreeChangeWithId{} + } + if err := m.RootChange.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTreechange(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTreechange + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TreeSyncContentValue) 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 ErrIntOverflowTreechange + } + 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: TreeSyncContentValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TreeSyncContentValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HeadUpdate", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTreechange + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTreechange + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTreechange + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &TreeHeadUpdate{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Value = &TreeSyncContentValue_HeadUpdate{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FullSyncRequest", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTreechange + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTreechange + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTreechange + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &TreeFullSyncRequest{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Value = &TreeSyncContentValue_FullSyncRequest{v} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FullSyncResponse", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTreechange + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTreechange + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTreechange + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &TreeFullSyncResponse{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Value = &TreeSyncContentValue_FullSyncResponse{v} + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ErrorResponse", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTreechange + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTreechange + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTreechange + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &TreeErrorResponse{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Value = &TreeSyncContentValue_ErrorResponse{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTreechange(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTreechange + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TreeHeadUpdate) 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 ErrIntOverflowTreechange + } + 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: TreeHeadUpdate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TreeHeadUpdate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Heads", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTreechange + } + 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 ErrInvalidLengthTreechange + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTreechange + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Heads = append(m.Heads, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Changes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTreechange + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTreechange + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTreechange + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Changes = append(m.Changes, &RawTreeChangeWithId{}) + if err := m.Changes[len(m.Changes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SnapshotPath", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTreechange + } + 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 ErrInvalidLengthTreechange + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTreechange + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SnapshotPath = append(m.SnapshotPath, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTreechange(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTreechange + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TreeFullSyncRequest) 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 ErrIntOverflowTreechange + } + 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: TreeFullSyncRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TreeFullSyncRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Heads", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTreechange + } + 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 ErrInvalidLengthTreechange + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTreechange + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Heads = append(m.Heads, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Changes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTreechange + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTreechange + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTreechange + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Changes = append(m.Changes, &RawTreeChangeWithId{}) + if err := m.Changes[len(m.Changes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SnapshotPath", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTreechange + } + 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 ErrInvalidLengthTreechange + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTreechange + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SnapshotPath = append(m.SnapshotPath, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTreechange(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTreechange + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TreeFullSyncResponse) 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 ErrIntOverflowTreechange + } + 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: TreeFullSyncResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TreeFullSyncResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Heads", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTreechange + } + 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 ErrInvalidLengthTreechange + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTreechange + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Heads = append(m.Heads, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Changes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTreechange + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTreechange + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTreechange + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Changes = append(m.Changes, &RawTreeChangeWithId{}) + if err := m.Changes[len(m.Changes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SnapshotPath", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTreechange + } + 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 ErrInvalidLengthTreechange + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTreechange + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SnapshotPath = append(m.SnapshotPath, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTreechange(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTreechange + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TreeErrorResponse) 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 ErrIntOverflowTreechange + } + 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: TreeErrorResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TreeErrorResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTreechange + } + 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 ErrInvalidLengthTreechange + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTreechange + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Error = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTreechange(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTreechange + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTreechange(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0