diff --git a/Makefile b/Makefile index f7c161d1..b004f35e 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ proto: $(GOGO_START) protoc --gogofaster_out=:. $(P_TEST_CHANGES_PATH_PB)/proto/*.proto $(eval PKGMAP := $$(P_ACL_CHANGES)) $(GOGO_START) protoc --gogofaster_out=$(PKGMAP):. $(P_SYNC_CHANGES_PATH_PB)/proto/*.proto - $(GOGO_START) protoc --gogofaster_out=$(PKGMAP):. service/space/spacesync/protos/*.proto + $(GOGO_START) protoc --gogofaster_out=$(PKGMAP):. common/commonspace/spacesyncproto/protos/*.proto build: @$(eval FLAGS := $$(shell govvv -flags -pkg github.com/anytypeio/go-anytype-infrastructure-experiments/app)) diff --git a/common/commonspace/spacesyncproto/protos/spacesync.proto b/common/commonspace/spacesyncproto/protos/spacesync.proto index 0a1e434d..16fbdd14 100644 --- a/common/commonspace/spacesyncproto/protos/spacesync.proto +++ b/common/commonspace/spacesyncproto/protos/spacesync.proto @@ -1,16 +1,17 @@ syntax = "proto3"; package anySpace; + option go_package = "common/commonspace/spacesyncproto"; +import "pkg/acl/aclchanges/aclpb/protos/aclchanges.proto"; enum ErrCodes { Unexpected = 0; } - service Space { // HeadSync compares all objects and their hashes in a space rpc HeadSync(HeadSyncRequest) returns (HeadSyncResponse); - rpc Stream( stream Msg) returns (stream Msg); + rpc Stream(stream ObjectSyncMessage) returns (stream ObjectSyncMessage); } // TODO: temporary mock message @@ -18,8 +19,6 @@ message Msg { string spaceId = 1; } - - // HeadSyncRange presenting a request for one range message HeadSyncRange { uint64 from = 1; @@ -50,3 +49,40 @@ message HeadSyncRequest { message HeadSyncResponse { repeated HeadSyncResult results = 1; } + +// ObjectSyncMessage is a message sent on object sync +message ObjectSyncMessage { + string spaceId = 1; + ObjectSyncContentValue content = 2; + acl.TreeHeader treeHeader = 3; + string treeId = 4; +} + +// ObjectSyncContentValue provides different types for object sync +message ObjectSyncContentValue { + oneof value { + ObjectHeadUpdate headUpdate = 1; + ObjectFullSyncRequest fullSyncRequest = 2; + ObjectFullSyncResponse fullSyncResponse = 3; + } +} + +// ObjectHeadUpdate is a message sent on document head update +message ObjectHeadUpdate { + repeated string heads = 1; + repeated acl.RawTreeChangeWithId changes = 2; + repeated string snapshotPath = 3; +} + +// ObjectHeadUpdate is a message sent when document needs full sync +message ObjectFullSyncRequest { + repeated string heads = 1; + repeated string snapshotPath = 2; +} + +// ObjectFullSyncResponse is a message sent as a response for a specific full sync +message ObjectFullSyncResponse { + repeated string heads = 1; + repeated acl.RawTreeChangeWithId changes = 2; + repeated string snapshotPath = 3; +} diff --git a/common/commonspace/spacesyncproto/spacesync.pb.go b/common/commonspace/spacesyncproto/spacesync.pb.go index 9db560cb..a3299fee 100644 --- a/common/commonspace/spacesyncproto/spacesync.pb.go +++ b/common/commonspace/spacesyncproto/spacesync.pb.go @@ -5,6 +5,7 @@ package spacesyncproto import ( fmt "fmt" + aclpb "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/aclchanges/aclpb" proto "github.com/gogo/protobuf/proto" io "io" math "math" @@ -362,6 +363,349 @@ func (m *HeadSyncResponse) GetResults() []*HeadSyncResult { return nil } +// 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"` + TreeHeader *aclpb.TreeHeader `protobuf:"bytes,3,opt,name=treeHeader,proto3" json:"treeHeader,omitempty"` + TreeId string `protobuf:"bytes,4,opt,name=treeId,proto3" json:"treeId,omitempty"` +} + +func (m *ObjectSyncMessage) Reset() { *m = ObjectSyncMessage{} } +func (m *ObjectSyncMessage) String() string { return proto.CompactTextString(m) } +func (*ObjectSyncMessage) ProtoMessage() {} +func (*ObjectSyncMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_5855f4ef9cf24cdb, []int{6} +} +func (m *ObjectSyncMessage) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ObjectSyncMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ObjectSyncMessage.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 *ObjectSyncMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_ObjectSyncMessage.Merge(m, src) +} +func (m *ObjectSyncMessage) XXX_Size() int { + return m.Size() +} +func (m *ObjectSyncMessage) XXX_DiscardUnknown() { + xxx_messageInfo_ObjectSyncMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_ObjectSyncMessage proto.InternalMessageInfo + +func (m *ObjectSyncMessage) GetSpaceId() string { + if m != nil { + return m.SpaceId + } + return "" +} + +func (m *ObjectSyncMessage) GetContent() *ObjectSyncContentValue { + if m != nil { + return m.Content + } + return nil +} + +func (m *ObjectSyncMessage) GetTreeHeader() *aclpb.TreeHeader { + if m != nil { + return m.TreeHeader + } + return nil +} + +func (m *ObjectSyncMessage) GetTreeId() string { + if m != nil { + return m.TreeId + } + return "" +} + +// 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 + 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_5855f4ef9cf24cdb, []int{7} +} +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"` +} + +func (*ObjectSyncContentValue_HeadUpdate) isObjectSyncContentValue_Value() {} +func (*ObjectSyncContentValue_FullSyncRequest) isObjectSyncContentValue_Value() {} +func (*ObjectSyncContentValue_FullSyncResponse) isObjectSyncContentValue_Value() {} + +func (m *ObjectSyncContentValue) GetValue() isObjectSyncContentValue_Value { + 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 +} + +// 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), + } +} + +// 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 []*aclpb.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_5855f4ef9cf24cdb, []int{8} +} +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() []*aclpb.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"` + SnapshotPath []string `protobuf:"bytes,2,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_5855f4ef9cf24cdb, []int{9} +} +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) 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 []*aclpb.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_5855f4ef9cf24cdb, []int{10} +} +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() []*aclpb.RawTreeChangeWithId { + if m != nil { + return m.Changes + } + return nil +} + +func (m *ObjectFullSyncResponse) GetSnapshotPath() []string { + if m != nil { + return m.SnapshotPath + } + return nil +} + func init() { proto.RegisterEnum("anySpace.ErrCodes", ErrCodes_name, ErrCodes_value) proto.RegisterType((*Msg)(nil), "anySpace.Msg") @@ -370,6 +714,11 @@ func init() { proto.RegisterType((*HeadSyncResultElement)(nil), "anySpace.HeadSyncResultElement") 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") } func init() { @@ -377,32 +726,50 @@ func init() { } var fileDescriptor_5855f4ef9cf24cdb = []byte{ - // 400 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x52, 0xcd, 0xce, 0xd2, 0x40, - 0x14, 0xed, 0x94, 0xbf, 0x72, 0x15, 0x24, 0x13, 0x8d, 0xb5, 0x8b, 0x82, 0x5d, 0x35, 0x2c, 0xa8, - 0xc1, 0x8d, 0x09, 0x2b, 0x35, 0x18, 0x59, 0xb0, 0x19, 0xe2, 0xc6, 0xb8, 0xa9, 0xed, 0x08, 0x4d, - 0xe8, 0x4c, 0xed, 0x0c, 0x2a, 0x6f, 0xe1, 0x63, 0xb9, 0x64, 0xe9, 0xd2, 0xc0, 0x8b, 0x98, 0xde, - 0x7e, 0x85, 0x8f, 0xa4, 0xe4, 0xdb, 0xcc, 0xfd, 0xe9, 0x39, 0xe7, 0x9e, 0x7b, 0x53, 0x78, 0x13, - 0xc9, 0x34, 0x95, 0x22, 0x28, 0x83, 0xca, 0xc2, 0x88, 0x07, 0xf8, 0xaa, 0xbd, 0x88, 0xb2, 0x5c, - 0x6a, 0x19, 0xe0, 0xab, 0x2e, 0xdd, 0x09, 0x36, 0xa8, 0x15, 0x8a, 0xfd, 0xaa, 0xe8, 0x79, 0x43, - 0x68, 0x2c, 0xd5, 0x9a, 0xda, 0xd0, 0x41, 0xcc, 0x22, 0xb6, 0xc9, 0x88, 0xf8, 0x5d, 0x56, 0x95, - 0xde, 0x02, 0x7a, 0x1f, 0x79, 0x18, 0xaf, 0xf6, 0x22, 0x62, 0xa1, 0x58, 0x73, 0x4a, 0xa1, 0xf9, - 0x2d, 0x97, 0x29, 0xe2, 0x9a, 0x0c, 0x73, 0xda, 0x07, 0x53, 0x4b, 0xdb, 0xc4, 0x8e, 0xa9, 0x25, - 0x7d, 0x0a, 0xad, 0x6d, 0x92, 0x26, 0xda, 0x6e, 0x8c, 0x88, 0xdf, 0x63, 0x65, 0xe1, 0xfd, 0x84, - 0xfe, 0x59, 0x8a, 0xab, 0xdd, 0x56, 0x17, 0x5a, 0x9b, 0x50, 0x6d, 0x50, 0xeb, 0x31, 0xc3, 0x9c, - 0xce, 0xc0, 0xe2, 0x5b, 0x9e, 0x72, 0xa1, 0x95, 0x6d, 0x8e, 0x1a, 0xfe, 0xa3, 0xe9, 0x70, 0x52, - 0xd9, 0x9d, 0x5c, 0xf3, 0xe7, 0x25, 0x8e, 0x9d, 0x09, 0xc5, 0xe0, 0x48, 0xee, 0xc4, 0x79, 0x30, - 0x16, 0xde, 0x0c, 0x9e, 0xd5, 0x12, 0x0b, 0xdf, 0x49, 0xb5, 0xb1, 0x99, 0xc4, 0xe8, 0x87, 0x87, - 0x31, 0x6e, 0xd2, 0x65, 0x98, 0x7b, 0x5f, 0xe0, 0xc9, 0x85, 0xfc, 0x7d, 0xc7, 0x95, 0xbe, 0x7d, - 0x2d, 0x1a, 0x40, 0x3b, 0x2f, 0xae, 0x54, 0x59, 0x7f, 0x5e, 0x63, 0xbd, 0xf8, 0xce, 0xee, 0x60, - 0xde, 0x07, 0x18, 0xdc, 0xb3, 0x96, 0x49, 0xa1, 0x38, 0x9d, 0x42, 0x27, 0x47, 0x9b, 0xca, 0x26, - 0xa8, 0x62, 0xdf, 0x3a, 0x00, 0xab, 0x80, 0x63, 0x07, 0xac, 0x79, 0x9e, 0xbf, 0x97, 0x31, 0x57, - 0xb4, 0x0f, 0xf0, 0x49, 0xf0, 0x5f, 0x19, 0x8f, 0x34, 0x8f, 0x07, 0xc6, 0xf4, 0x07, 0xb4, 0x90, - 0x4c, 0xdf, 0x82, 0x55, 0xf1, 0xe9, 0x8b, 0x3a, 0x4d, 0x5c, 0xcf, 0x71, 0x6a, 0xc7, 0x95, 0xde, - 0xc6, 0xd0, 0x5e, 0xe9, 0x9c, 0x87, 0x29, 0xed, 0x5d, 0x50, 0x4b, 0xb5, 0x76, 0xae, 0x4b, 0x9f, - 0xbc, 0x22, 0xef, 0x66, 0x7f, 0x8e, 0x2e, 0x39, 0x1c, 0x5d, 0xf2, 0xef, 0xe8, 0x92, 0xdf, 0x27, - 0xd7, 0x38, 0x9c, 0x5c, 0xe3, 0xef, 0xc9, 0x35, 0x3e, 0xbf, 0x7c, 0xf0, 0xcf, 0xfd, 0xda, 0xc6, - 0xf0, 0xfa, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5a, 0xf6, 0x94, 0x21, 0xe5, 0x02, 0x00, 0x00, + // 674 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0x4d, 0x6f, 0xd3, 0x40, + 0x10, 0xf5, 0x26, 0x6d, 0x92, 0x4e, 0xfa, 0x11, 0x56, 0xb4, 0x98, 0x20, 0xa5, 0xc1, 0xa7, 0x88, + 0x43, 0x52, 0x85, 0x0b, 0xa2, 0x5c, 0x68, 0xd5, 0x2a, 0x11, 0x2a, 0x1f, 0x5b, 0x0a, 0x12, 0xe2, + 0xb2, 0xb5, 0xb7, 0x49, 0xc0, 0xf1, 0x1a, 0xef, 0x86, 0xd2, 0x1b, 0x27, 0xce, 0x88, 0x9f, 0xc2, + 0xaf, 0xe0, 0xd8, 0x23, 0x47, 0xd4, 0xfe, 0x0d, 0x0e, 0x68, 0xc7, 0x76, 0x92, 0x06, 0xa7, 0xdc, + 0x38, 0xc4, 0xde, 0x99, 0x7d, 0xf3, 0xf6, 0xbd, 0x59, 0x8f, 0x02, 0x0f, 0x5c, 0x39, 0x1c, 0xca, + 0xa0, 0x15, 0xbf, 0x54, 0xc8, 0x5d, 0xd1, 0xc2, 0xa7, 0x3a, 0x0b, 0xdc, 0x30, 0x92, 0x5a, 0xb6, + 0xf0, 0xa9, 0x26, 0xd9, 0x26, 0x26, 0x68, 0x89, 0x07, 0x67, 0x87, 0x26, 0x57, 0xdd, 0x0a, 0xdf, + 0xf7, 0x5a, 0xdc, 0xf5, 0xcd, 0xcf, 0xed, 0xf3, 0xa0, 0x27, 0x94, 0x59, 0x86, 0xc7, 0x69, 0xe9, + 0x24, 0x1f, 0xd7, 0x3a, 0x9b, 0x90, 0x3f, 0x50, 0x3d, 0x6a, 0x43, 0x11, 0x59, 0xbb, 0x9e, 0x4d, + 0xea, 0xa4, 0xb1, 0xc4, 0xd2, 0xd0, 0xe9, 0xc2, 0x4a, 0x47, 0x70, 0xef, 0xf0, 0x2c, 0x70, 0x99, + 0x29, 0xa4, 0x14, 0x16, 0x4e, 0x22, 0x39, 0x44, 0xdc, 0x02, 0xc3, 0x35, 0x5d, 0x85, 0x9c, 0x96, + 0x76, 0x0e, 0x33, 0x39, 0x2d, 0xe9, 0x4d, 0x58, 0xf4, 0x07, 0xc3, 0x81, 0xb6, 0xf3, 0x75, 0xd2, + 0x58, 0x61, 0x71, 0xe0, 0x9c, 0xc2, 0xea, 0x98, 0x4a, 0xa8, 0x91, 0xaf, 0x0d, 0x57, 0x9f, 0xab, + 0x3e, 0x72, 0x2d, 0x33, 0x5c, 0xd3, 0x6d, 0x28, 0x09, 0x5f, 0x0c, 0x45, 0xa0, 0x95, 0x9d, 0xab, + 0xe7, 0x1b, 0xe5, 0xf6, 0x66, 0x33, 0x35, 0xd8, 0xbc, 0x5a, 0xbf, 0x17, 0xe3, 0xd8, 0xb8, 0xc0, + 0x1c, 0xec, 0xca, 0x51, 0x30, 0x3e, 0x18, 0x03, 0x67, 0x1b, 0xd6, 0x33, 0x0b, 0x8d, 0xee, 0x41, + 0xea, 0x38, 0x37, 0xf0, 0x50, 0x8f, 0xe0, 0x1e, 0x3a, 0x59, 0x62, 0xb8, 0x76, 0xde, 0xc2, 0xda, + 0xa4, 0xf8, 0xc3, 0x48, 0x28, 0x3d, 0xbf, 0x5b, 0xb4, 0x05, 0x85, 0x08, 0xdb, 0x9b, 0x48, 0xbf, + 0x95, 0x21, 0xdd, 0xec, 0xb3, 0x04, 0xe6, 0xec, 0x43, 0x65, 0x4a, 0x5a, 0x28, 0x03, 0x25, 0x68, + 0x1b, 0x8a, 0x11, 0xca, 0x54, 0x36, 0x41, 0x16, 0x7b, 0x5e, 0x03, 0x58, 0x0a, 0x74, 0xbe, 0x13, + 0xb8, 0xf1, 0xec, 0xf8, 0x9d, 0x70, 0xb5, 0xd9, 0x3d, 0x10, 0x4a, 0xf1, 0x9e, 0xb8, 0x46, 0xe8, + 0x43, 0x28, 0xba, 0x32, 0xd0, 0x22, 0xd0, 0x68, 0xb6, 0xdc, 0xae, 0x4f, 0xce, 0x98, 0xf0, 0xec, + 0xc6, 0x90, 0x57, 0xdc, 0x1f, 0x09, 0x96, 0x16, 0xd0, 0x16, 0x80, 0x8e, 0x84, 0x30, 0x52, 0x44, + 0x84, 0x9d, 0x2e, 0xb7, 0xd7, 0x9a, 0xdc, 0xf5, 0x9b, 0x2f, 0xc7, 0x69, 0x36, 0x05, 0xa1, 0x1b, + 0x50, 0x30, 0x51, 0xd7, 0xb3, 0x17, 0x50, 0x45, 0x12, 0x39, 0xbf, 0x09, 0x6c, 0x64, 0x1f, 0x46, + 0x1f, 0x01, 0x98, 0xee, 0x1f, 0x85, 0x1e, 0xd7, 0x02, 0xc5, 0x97, 0xdb, 0xd5, 0x59, 0x89, 0x9d, + 0x31, 0xa2, 0x63, 0xb1, 0x29, 0x3c, 0x7d, 0x02, 0x6b, 0x27, 0x23, 0xdf, 0x9f, 0xba, 0xb3, 0xc4, + 0xe5, 0xe6, 0x2c, 0xc5, 0xfe, 0x55, 0x58, 0xc7, 0x62, 0xb3, 0x95, 0xf4, 0x29, 0x54, 0x26, 0xa9, + 0xf8, 0x8a, 0x12, 0xd3, 0xf5, 0xf9, 0x6c, 0x31, 0xae, 0x63, 0xb1, 0xbf, 0x6a, 0x77, 0x8a, 0xb0, + 0xf8, 0xd1, 0x78, 0x74, 0x3e, 0x13, 0xa8, 0xcc, 0x1a, 0x31, 0x5f, 0xb0, 0x31, 0x12, 0x5f, 0xfd, + 0x12, 0x8b, 0x03, 0xf3, 0x49, 0x24, 0x73, 0x9b, 0x7c, 0x58, 0x36, 0xf6, 0x9b, 0xf1, 0x53, 0xd3, + 0xf2, 0x5d, 0xdc, 0x7a, 0x3d, 0xd0, 0xfd, 0xae, 0xc7, 0x52, 0x20, 0x75, 0x60, 0x59, 0x05, 0x3c, + 0x54, 0x7d, 0xa9, 0x9f, 0x73, 0xdd, 0xb7, 0xf3, 0x48, 0x78, 0x25, 0xe7, 0xbc, 0x80, 0xf5, 0xcc, + 0x3e, 0xcc, 0x91, 0x31, 0x4b, 0x99, 0xcb, 0xa0, 0xfc, 0x32, 0xbe, 0xd4, 0xd9, 0x6e, 0xfc, 0x5f, + 0x6f, 0xf7, 0xaa, 0x50, 0xda, 0x8b, 0xa2, 0x5d, 0xe9, 0x09, 0x45, 0x57, 0x01, 0x8e, 0x02, 0xf1, + 0x29, 0x14, 0xae, 0x16, 0x5e, 0xc5, 0x6a, 0x7f, 0x23, 0xb0, 0x88, 0x17, 0x47, 0x1f, 0x43, 0x29, + 0x9d, 0x29, 0x7a, 0x3b, 0x6b, 0xce, 0xb0, 0x1f, 0xd5, 0x6a, 0xe6, 0x08, 0xc6, 0xb6, 0xf6, 0xa1, + 0x70, 0xa8, 0x23, 0xc1, 0x87, 0xf4, 0x4e, 0xd6, 0x10, 0x25, 0xc3, 0x58, 0xbd, 0x6e, 0xb3, 0x41, + 0xb6, 0xc8, 0xce, 0xf6, 0x8f, 0x8b, 0x1a, 0x39, 0xbf, 0xa8, 0x91, 0x5f, 0x17, 0x35, 0xf2, 0xf5, + 0xb2, 0x66, 0x9d, 0x5f, 0xd6, 0xac, 0x9f, 0x97, 0x35, 0xeb, 0xcd, 0xdd, 0x7f, 0xfe, 0x37, 0x1c, + 0x17, 0xf0, 0x75, 0xff, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd7, 0x51, 0x60, 0x63, 0x47, 0x06, + 0x00, 0x00, } func (m *Msg) Marshal() (dAtA []byte, err error) { @@ -640,6 +1007,313 @@ func (m *HeadSyncResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ObjectSyncMessage) 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 *ObjectSyncMessage) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ObjectSyncMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TreeId) > 0 { + i -= len(m.TreeId) + copy(dAtA[i:], m.TreeId) + i = encodeVarintSpacesync(dAtA, i, uint64(len(m.TreeId))) + i-- + dAtA[i] = 0x22 + } + if m.TreeHeader != nil { + { + size, err := m.TreeHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSpacesync(dAtA, i, uint64(size)) + } + 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)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.SpaceId) > 0 { + i -= len(m.SpaceId) + copy(dAtA[i:], m.SpaceId) + i = encodeVarintSpacesync(dAtA, i, uint64(len(m.SpaceId))) + i-- + dAtA[i] = 0xa + } + 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 *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] = 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 encodeVarintSpacesync(dAtA []byte, offset int, v uint64) int { offset -= sovSpacesync(v) base := offset @@ -755,6 +1429,154 @@ func (m *HeadSyncResponse) Size() (n int) { return n } +func (m *ObjectSyncMessage) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SpaceId) + 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.TreeHeader != nil { + l = m.TreeHeader.Size() + n += 1 + l + sovSpacesync(uint64(l)) + } + l = len(m.TreeId) + 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 *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.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 sovSpacesync(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1401,6 +2223,757 @@ func (m *HeadSyncResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *ObjectSyncMessage) 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: ObjectSyncMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ObjectSyncMessage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SpaceId", 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.SpaceId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 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 + } + if m.Content == nil { + m.Content = &ObjectSyncContentValue{} + } + if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TreeHeader", 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 + } + if m.TreeHeader == nil { + m.TreeHeader = &aclpb.TreeHeader{} + } + if err := m.TreeHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TreeId", 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.TreeId = 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 + 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, &aclpb.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 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, &aclpb.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 skipSpacesync(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/pkg/acl/account/accountdata.go b/pkg/acl/account/accountdata.go index 07530083..bc775854 100644 --- a/pkg/acl/account/accountdata.go +++ b/pkg/acl/account/accountdata.go @@ -7,7 +7,7 @@ import ( ) type AccountData struct { // TODO: create a convenient constructor for this - Identity string // TODO: this is essentially the same as sign key + Identity []byte // TODO: this is essentially the same as sign key SignKey signingkey.PrivKey EncKey encryptionkey.PrivKey Decoder keys.Decoder diff --git a/pkg/acl/aclchanges/aclpb/aclchanges.pb.go b/pkg/acl/aclchanges/aclpb/aclchanges.pb.go index c026319c..ecd124b1 100644 --- a/pkg/acl/aclchanges/aclpb/aclchanges.pb.go +++ b/pkg/acl/aclchanges/aclpb/aclchanges.pb.go @@ -22,140 +22,80 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type ACLChangeUserPermissions int32 +type ACLUserPermissions int32 const ( - ACLChange_Admin ACLChangeUserPermissions = 0 - ACLChange_Writer ACLChangeUserPermissions = 1 - ACLChange_Reader ACLChangeUserPermissions = 2 - ACLChange_Removed ACLChangeUserPermissions = 3 + ACLUserPermissions_Admin ACLUserPermissions = 0 + ACLUserPermissions_Writer ACLUserPermissions = 1 + ACLUserPermissions_Reader ACLUserPermissions = 2 + ACLUserPermissions_Removed ACLUserPermissions = 3 ) -var ACLChangeUserPermissions_name = map[int32]string{ +var ACLUserPermissions_name = map[int32]string{ 0: "Admin", 1: "Writer", 2: "Reader", 3: "Removed", } -var ACLChangeUserPermissions_value = map[string]int32{ +var ACLUserPermissions_value = map[string]int32{ "Admin": 0, "Writer": 1, "Reader": 2, "Removed": 3, } -func (x ACLChangeUserPermissions) String() string { - return proto.EnumName(ACLChangeUserPermissions_name, int32(x)) +func (x ACLUserPermissions) String() string { + return proto.EnumName(ACLUserPermissions_name, int32(x)) } -func (ACLChangeUserPermissions) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{2, 0} -} - -type HeaderDocType int32 - -const ( - Header_ACL HeaderDocType = 0 - Header_DocTree HeaderDocType = 1 -) - -var HeaderDocType_name = map[int32]string{ - 0: "ACL", - 1: "DocTree", -} - -var HeaderDocType_value = map[string]int32{ - "ACL": 0, - "DocTree": 1, -} - -func (x HeaderDocType) String() string { - return proto.EnumName(HeaderDocType_name, int32(x)) -} - -func (HeaderDocType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{5, 0} -} - -type RawChange struct { - Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` - Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` - Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"` -} - -func (m *RawChange) Reset() { *m = RawChange{} } -func (m *RawChange) String() string { return proto.CompactTextString(m) } -func (*RawChange) ProtoMessage() {} -func (*RawChange) Descriptor() ([]byte, []int) { +func (ACLUserPermissions) EnumDescriptor() ([]byte, []int) { return fileDescriptor_37a022c841a51877, []int{0} } -func (m *RawChange) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RawChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RawChange.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 *RawChange) XXX_Merge(src proto.Message) { - xxx_messageInfo_RawChange.Merge(m, src) -} -func (m *RawChange) XXX_Size() int { - return m.Size() -} -func (m *RawChange) XXX_DiscardUnknown() { - xxx_messageInfo_RawChange.DiscardUnknown(m) + +type TreeHeaderType int32 + +const ( + TreeHeaderType_Object TreeHeaderType = 0 + TreeHeaderType_Space TreeHeaderType = 1 +) + +var TreeHeaderType_name = map[int32]string{ + 0: "Object", + 1: "Space", } -var xxx_messageInfo_RawChange proto.InternalMessageInfo - -func (m *RawChange) GetPayload() []byte { - if m != nil { - return m.Payload - } - return nil +var TreeHeaderType_value = map[string]int32{ + "Object": 0, + "Space": 1, } -func (m *RawChange) GetSignature() []byte { - if m != nil { - return m.Signature - } - return nil +func (x TreeHeaderType) String() string { + return proto.EnumName(TreeHeaderType_name, int32(x)) } -func (m *RawChange) GetId() string { - if m != nil { - return m.Id - } - return "" +func (TreeHeaderType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_37a022c841a51877, []int{1} } -type RawRecord struct { +type RawACLRecord struct { Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"` } -func (m *RawRecord) Reset() { *m = RawRecord{} } -func (m *RawRecord) String() string { return proto.CompactTextString(m) } -func (*RawRecord) ProtoMessage() {} -func (*RawRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{1} +func (m *RawACLRecord) Reset() { *m = RawACLRecord{} } +func (m *RawACLRecord) String() string { return proto.CompactTextString(m) } +func (*RawACLRecord) ProtoMessage() {} +func (*RawACLRecord) Descriptor() ([]byte, []int) { + return fileDescriptor_37a022c841a51877, []int{0} } -func (m *RawRecord) XXX_Unmarshal(b []byte) error { +func (m *RawACLRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *RawRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *RawACLRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_RawRecord.Marshal(b, m, deterministic) + return xxx_messageInfo_RawACLRecord.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -165,164 +105,62 @@ func (m *RawRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *RawRecord) XXX_Merge(src proto.Message) { - xxx_messageInfo_RawRecord.Merge(m, src) +func (m *RawACLRecord) XXX_Merge(src proto.Message) { + xxx_messageInfo_RawACLRecord.Merge(m, src) } -func (m *RawRecord) XXX_Size() int { +func (m *RawACLRecord) XXX_Size() int { return m.Size() } -func (m *RawRecord) XXX_DiscardUnknown() { - xxx_messageInfo_RawRecord.DiscardUnknown(m) +func (m *RawACLRecord) XXX_DiscardUnknown() { + xxx_messageInfo_RawACLRecord.DiscardUnknown(m) } -var xxx_messageInfo_RawRecord proto.InternalMessageInfo +var xxx_messageInfo_RawACLRecord proto.InternalMessageInfo -func (m *RawRecord) GetPayload() []byte { +func (m *RawACLRecord) GetPayload() []byte { if m != nil { return m.Payload } return nil } -func (m *RawRecord) GetSignature() []byte { +func (m *RawACLRecord) GetSignature() []byte { if m != nil { return m.Signature } return nil } -func (m *RawRecord) GetId() string { +func (m *RawACLRecord) GetId() string { if m != nil { return m.Id } return "" } -// the element of change tree used to store and internal apply smartBlock history -type ACLChange struct { - TreeHeadIds []string `protobuf:"bytes,1,rep,name=treeHeadIds,proto3" json:"treeHeadIds,omitempty"` - AclHeadIds []string `protobuf:"bytes,2,rep,name=aclHeadIds,proto3" json:"aclHeadIds,omitempty"` - SnapshotBaseId string `protobuf:"bytes,3,opt,name=snapshotBaseId,proto3" json:"snapshotBaseId,omitempty"` - AclData *ACLChangeACLData `protobuf:"bytes,4,opt,name=aclData,proto3" json:"aclData,omitempty"` - // the data is encoded with read key and should be read in ChangesData format - ChangesData []byte `protobuf:"bytes,5,opt,name=changesData,proto3" json:"changesData,omitempty"` - CurrentReadKeyHash uint64 `protobuf:"varint,6,opt,name=currentReadKeyHash,proto3" json:"currentReadKeyHash,omitempty"` - Timestamp int64 `protobuf:"varint,7,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - Identity string `protobuf:"bytes,8,opt,name=identity,proto3" json:"identity,omitempty"` -} - -func (m *ACLChange) Reset() { *m = ACLChange{} } -func (m *ACLChange) String() string { return proto.CompactTextString(m) } -func (*ACLChange) ProtoMessage() {} -func (*ACLChange) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{2} -} -func (m *ACLChange) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ACLChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ACLChange.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 *ACLChange) XXX_Merge(src proto.Message) { - xxx_messageInfo_ACLChange.Merge(m, src) -} -func (m *ACLChange) XXX_Size() int { - return m.Size() -} -func (m *ACLChange) XXX_DiscardUnknown() { - xxx_messageInfo_ACLChange.DiscardUnknown(m) -} - -var xxx_messageInfo_ACLChange proto.InternalMessageInfo - -func (m *ACLChange) GetTreeHeadIds() []string { - if m != nil { - return m.TreeHeadIds - } - return nil -} - -func (m *ACLChange) GetAclHeadIds() []string { - if m != nil { - return m.AclHeadIds - } - return nil -} - -func (m *ACLChange) GetSnapshotBaseId() string { - if m != nil { - return m.SnapshotBaseId - } - return "" -} - -func (m *ACLChange) GetAclData() *ACLChangeACLData { - if m != nil { - return m.AclData - } - return nil -} - -func (m *ACLChange) GetChangesData() []byte { - if m != nil { - return m.ChangesData - } - return nil -} - -func (m *ACLChange) GetCurrentReadKeyHash() uint64 { - if m != nil { - return m.CurrentReadKeyHash - } - return 0 -} - -func (m *ACLChange) GetTimestamp() int64 { - if m != nil { - return m.Timestamp - } - return 0 -} - -func (m *ACLChange) GetIdentity() string { - if m != nil { - return m.Identity - } - return "" -} - -type ACLChangeACLContentValue struct { +type ACLContentValue struct { // Types that are valid to be assigned to Value: - // *ACLChangeACLContentValueValueOfUserAdd - // *ACLChangeACLContentValueValueOfUserRemove - // *ACLChangeACLContentValueValueOfUserPermissionChange - // *ACLChangeACLContentValueValueOfUserInvite - // *ACLChangeACLContentValueValueOfUserJoin - // *ACLChangeACLContentValueValueOfUserConfirm - Value IsACLChangeACLContentValueValue `protobuf_oneof:"value"` + // *ACLContentValue_UserAdd + // *ACLContentValue_UserRemove + // *ACLContentValue_UserPermissionChange + // *ACLContentValue_UserInvite + // *ACLContentValue_UserJoin + // *ACLContentValue_UserConfirm + Value isACLContentValue_Value `protobuf_oneof:"value"` } -func (m *ACLChangeACLContentValue) Reset() { *m = ACLChangeACLContentValue{} } -func (m *ACLChangeACLContentValue) String() string { return proto.CompactTextString(m) } -func (*ACLChangeACLContentValue) ProtoMessage() {} -func (*ACLChangeACLContentValue) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{2, 0} +func (m *ACLContentValue) Reset() { *m = ACLContentValue{} } +func (m *ACLContentValue) String() string { return proto.CompactTextString(m) } +func (*ACLContentValue) ProtoMessage() {} +func (*ACLContentValue) Descriptor() ([]byte, []int) { + return fileDescriptor_37a022c841a51877, []int{1} } -func (m *ACLChangeACLContentValue) XXX_Unmarshal(b []byte) error { +func (m *ACLContentValue) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ACLChangeACLContentValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ACLContentValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ACLChangeACLContentValue.Marshal(b, m, deterministic) + return xxx_messageInfo_ACLContentValue.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -332,128 +170,127 @@ func (m *ACLChangeACLContentValue) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } -func (m *ACLChangeACLContentValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_ACLChangeACLContentValue.Merge(m, src) +func (m *ACLContentValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_ACLContentValue.Merge(m, src) } -func (m *ACLChangeACLContentValue) XXX_Size() int { +func (m *ACLContentValue) XXX_Size() int { return m.Size() } -func (m *ACLChangeACLContentValue) XXX_DiscardUnknown() { - xxx_messageInfo_ACLChangeACLContentValue.DiscardUnknown(m) +func (m *ACLContentValue) XXX_DiscardUnknown() { + xxx_messageInfo_ACLContentValue.DiscardUnknown(m) } -var xxx_messageInfo_ACLChangeACLContentValue proto.InternalMessageInfo +var xxx_messageInfo_ACLContentValue proto.InternalMessageInfo -type IsACLChangeACLContentValueValue interface { - IsACLChangeACLContentValueValue() +type isACLContentValue_Value interface { + isACLContentValue_Value() MarshalTo([]byte) (int, error) Size() int } -type ACLChangeACLContentValueValueOfUserAdd struct { - UserAdd *ACLChangeUserAdd `protobuf:"bytes,1,opt,name=userAdd,proto3,oneof" json:"userAdd,omitempty"` +type ACLContentValue_UserAdd struct { + UserAdd *ACLUserAdd `protobuf:"bytes,1,opt,name=userAdd,proto3,oneof" json:"userAdd,omitempty"` } -type ACLChangeACLContentValueValueOfUserRemove struct { - UserRemove *ACLChangeUserRemove `protobuf:"bytes,2,opt,name=userRemove,proto3,oneof" json:"userRemove,omitempty"` +type ACLContentValue_UserRemove struct { + UserRemove *ACLUserRemove `protobuf:"bytes,2,opt,name=userRemove,proto3,oneof" json:"userRemove,omitempty"` } -type ACLChangeACLContentValueValueOfUserPermissionChange struct { - UserPermissionChange *ACLChangeUserPermissionChange `protobuf:"bytes,3,opt,name=userPermissionChange,proto3,oneof" json:"userPermissionChange,omitempty"` +type ACLContentValue_UserPermissionChange struct { + UserPermissionChange *ACLUserPermissionChange `protobuf:"bytes,3,opt,name=userPermissionChange,proto3,oneof" json:"userPermissionChange,omitempty"` } -type ACLChangeACLContentValueValueOfUserInvite struct { - UserInvite *ACLChangeUserInvite `protobuf:"bytes,4,opt,name=userInvite,proto3,oneof" json:"userInvite,omitempty"` +type ACLContentValue_UserInvite struct { + UserInvite *ACLUserInvite `protobuf:"bytes,4,opt,name=userInvite,proto3,oneof" json:"userInvite,omitempty"` } -type ACLChangeACLContentValueValueOfUserJoin struct { - UserJoin *ACLChangeUserJoin `protobuf:"bytes,5,opt,name=userJoin,proto3,oneof" json:"userJoin,omitempty"` +type ACLContentValue_UserJoin struct { + UserJoin *ACLUserJoin `protobuf:"bytes,5,opt,name=userJoin,proto3,oneof" json:"userJoin,omitempty"` } -type ACLChangeACLContentValueValueOfUserConfirm struct { - UserConfirm *ACLChangeUserConfirm `protobuf:"bytes,6,opt,name=userConfirm,proto3,oneof" json:"userConfirm,omitempty"` +type ACLContentValue_UserConfirm struct { + UserConfirm *ACLUserConfirm `protobuf:"bytes,6,opt,name=userConfirm,proto3,oneof" json:"userConfirm,omitempty"` } -func (*ACLChangeACLContentValueValueOfUserAdd) IsACLChangeACLContentValueValue() {} -func (*ACLChangeACLContentValueValueOfUserRemove) IsACLChangeACLContentValueValue() {} -func (*ACLChangeACLContentValueValueOfUserPermissionChange) IsACLChangeACLContentValueValue() {} -func (*ACLChangeACLContentValueValueOfUserInvite) IsACLChangeACLContentValueValue() {} -func (*ACLChangeACLContentValueValueOfUserJoin) IsACLChangeACLContentValueValue() {} -func (*ACLChangeACLContentValueValueOfUserConfirm) IsACLChangeACLContentValueValue() {} +func (*ACLContentValue_UserAdd) isACLContentValue_Value() {} +func (*ACLContentValue_UserRemove) isACLContentValue_Value() {} +func (*ACLContentValue_UserPermissionChange) isACLContentValue_Value() {} +func (*ACLContentValue_UserInvite) isACLContentValue_Value() {} +func (*ACLContentValue_UserJoin) isACLContentValue_Value() {} +func (*ACLContentValue_UserConfirm) isACLContentValue_Value() {} -func (m *ACLChangeACLContentValue) GetValue() IsACLChangeACLContentValueValue { +func (m *ACLContentValue) GetValue() isACLContentValue_Value { if m != nil { return m.Value } return nil } -func (m *ACLChangeACLContentValue) GetUserAdd() *ACLChangeUserAdd { - if x, ok := m.GetValue().(*ACLChangeACLContentValueValueOfUserAdd); ok { +func (m *ACLContentValue) GetUserAdd() *ACLUserAdd { + if x, ok := m.GetValue().(*ACLContentValue_UserAdd); ok { return x.UserAdd } return nil } -func (m *ACLChangeACLContentValue) GetUserRemove() *ACLChangeUserRemove { - if x, ok := m.GetValue().(*ACLChangeACLContentValueValueOfUserRemove); ok { +func (m *ACLContentValue) GetUserRemove() *ACLUserRemove { + if x, ok := m.GetValue().(*ACLContentValue_UserRemove); ok { return x.UserRemove } return nil } -func (m *ACLChangeACLContentValue) GetUserPermissionChange() *ACLChangeUserPermissionChange { - if x, ok := m.GetValue().(*ACLChangeACLContentValueValueOfUserPermissionChange); ok { +func (m *ACLContentValue) GetUserPermissionChange() *ACLUserPermissionChange { + if x, ok := m.GetValue().(*ACLContentValue_UserPermissionChange); ok { return x.UserPermissionChange } return nil } -func (m *ACLChangeACLContentValue) GetUserInvite() *ACLChangeUserInvite { - if x, ok := m.GetValue().(*ACLChangeACLContentValueValueOfUserInvite); ok { +func (m *ACLContentValue) GetUserInvite() *ACLUserInvite { + if x, ok := m.GetValue().(*ACLContentValue_UserInvite); ok { return x.UserInvite } return nil } -func (m *ACLChangeACLContentValue) GetUserJoin() *ACLChangeUserJoin { - if x, ok := m.GetValue().(*ACLChangeACLContentValueValueOfUserJoin); ok { +func (m *ACLContentValue) GetUserJoin() *ACLUserJoin { + if x, ok := m.GetValue().(*ACLContentValue_UserJoin); ok { return x.UserJoin } return nil } -func (m *ACLChangeACLContentValue) GetUserConfirm() *ACLChangeUserConfirm { - if x, ok := m.GetValue().(*ACLChangeACLContentValueValueOfUserConfirm); ok { +func (m *ACLContentValue) GetUserConfirm() *ACLUserConfirm { + if x, ok := m.GetValue().(*ACLContentValue_UserConfirm); ok { return x.UserConfirm } return nil } // XXX_OneofWrappers is for the internal use of the proto package. -func (*ACLChangeACLContentValue) XXX_OneofWrappers() []interface{} { +func (*ACLContentValue) XXX_OneofWrappers() []interface{} { return []interface{}{ - (*ACLChangeACLContentValueValueOfUserAdd)(nil), - (*ACLChangeACLContentValueValueOfUserRemove)(nil), - (*ACLChangeACLContentValueValueOfUserPermissionChange)(nil), - (*ACLChangeACLContentValueValueOfUserInvite)(nil), - (*ACLChangeACLContentValueValueOfUserJoin)(nil), - (*ACLChangeACLContentValueValueOfUserConfirm)(nil), + (*ACLContentValue_UserAdd)(nil), + (*ACLContentValue_UserRemove)(nil), + (*ACLContentValue_UserPermissionChange)(nil), + (*ACLContentValue_UserInvite)(nil), + (*ACLContentValue_UserJoin)(nil), + (*ACLContentValue_UserConfirm)(nil), } } -type ACLChangeACLData struct { - AclSnapshot *ACLChangeACLSnapshot `protobuf:"bytes,1,opt,name=aclSnapshot,proto3" json:"aclSnapshot,omitempty"` - AclContent []*ACLChangeACLContentValue `protobuf:"bytes,2,rep,name=aclContent,proto3" json:"aclContent,omitempty"` +type ACLData struct { + AclContent []*ACLContentValue `protobuf:"bytes,1,rep,name=aclContent,proto3" json:"aclContent,omitempty"` } -func (m *ACLChangeACLData) Reset() { *m = ACLChangeACLData{} } -func (m *ACLChangeACLData) String() string { return proto.CompactTextString(m) } -func (*ACLChangeACLData) ProtoMessage() {} -func (*ACLChangeACLData) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{2, 1} +func (m *ACLData) Reset() { *m = ACLData{} } +func (m *ACLData) String() string { return proto.CompactTextString(m) } +func (*ACLData) ProtoMessage() {} +func (*ACLData) Descriptor() ([]byte, []int) { + return fileDescriptor_37a022c841a51877, []int{2} } -func (m *ACLChangeACLData) XXX_Unmarshal(b []byte) error { +func (m *ACLData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ACLChangeACLData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ACLData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ACLChangeACLData.Marshal(b, m, deterministic) + return xxx_messageInfo_ACLData.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -463,49 +300,43 @@ func (m *ACLChangeACLData) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } -func (m *ACLChangeACLData) XXX_Merge(src proto.Message) { - xxx_messageInfo_ACLChangeACLData.Merge(m, src) +func (m *ACLData) XXX_Merge(src proto.Message) { + xxx_messageInfo_ACLData.Merge(m, src) } -func (m *ACLChangeACLData) XXX_Size() int { +func (m *ACLData) XXX_Size() int { return m.Size() } -func (m *ACLChangeACLData) XXX_DiscardUnknown() { - xxx_messageInfo_ACLChangeACLData.DiscardUnknown(m) +func (m *ACLData) XXX_DiscardUnknown() { + xxx_messageInfo_ACLData.DiscardUnknown(m) } -var xxx_messageInfo_ACLChangeACLData proto.InternalMessageInfo +var xxx_messageInfo_ACLData proto.InternalMessageInfo -func (m *ACLChangeACLData) GetAclSnapshot() *ACLChangeACLSnapshot { - if m != nil { - return m.AclSnapshot - } - return nil -} - -func (m *ACLChangeACLData) GetAclContent() []*ACLChangeACLContentValue { +func (m *ACLData) GetAclContent() []*ACLContentValue { if m != nil { return m.AclContent } return nil } -type ACLChangeACLSnapshot struct { - // We don't need ACLState as a separate message now, because we simplified the snapshot model - AclState *ACLChangeACLState `protobuf:"bytes,1,opt,name=aclState,proto3" json:"aclState,omitempty"` +type ACLState struct { + ReadKeyHashes []uint64 `protobuf:"varint,1,rep,packed,name=readKeyHashes,proto3" json:"readKeyHashes,omitempty"` + UserStates []*ACLUserState `protobuf:"bytes,2,rep,name=userStates,proto3" json:"userStates,omitempty"` + Invites map[string]*ACLUserInvite `protobuf:"bytes,3,rep,name=invites,proto3" json:"invites,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } -func (m *ACLChangeACLSnapshot) Reset() { *m = ACLChangeACLSnapshot{} } -func (m *ACLChangeACLSnapshot) String() string { return proto.CompactTextString(m) } -func (*ACLChangeACLSnapshot) ProtoMessage() {} -func (*ACLChangeACLSnapshot) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{2, 2} +func (m *ACLState) Reset() { *m = ACLState{} } +func (m *ACLState) String() string { return proto.CompactTextString(m) } +func (*ACLState) ProtoMessage() {} +func (*ACLState) Descriptor() ([]byte, []int) { + return fileDescriptor_37a022c841a51877, []int{3} } -func (m *ACLChangeACLSnapshot) XXX_Unmarshal(b []byte) error { +func (m *ACLState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ACLChangeACLSnapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ACLState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ACLChangeACLSnapshot.Marshal(b, m, deterministic) + return xxx_messageInfo_ACLState.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -515,105 +346,59 @@ func (m *ACLChangeACLSnapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } -func (m *ACLChangeACLSnapshot) XXX_Merge(src proto.Message) { - xxx_messageInfo_ACLChangeACLSnapshot.Merge(m, src) +func (m *ACLState) XXX_Merge(src proto.Message) { + xxx_messageInfo_ACLState.Merge(m, src) } -func (m *ACLChangeACLSnapshot) XXX_Size() int { +func (m *ACLState) XXX_Size() int { return m.Size() } -func (m *ACLChangeACLSnapshot) XXX_DiscardUnknown() { - xxx_messageInfo_ACLChangeACLSnapshot.DiscardUnknown(m) +func (m *ACLState) XXX_DiscardUnknown() { + xxx_messageInfo_ACLState.DiscardUnknown(m) } -var xxx_messageInfo_ACLChangeACLSnapshot proto.InternalMessageInfo +var xxx_messageInfo_ACLState proto.InternalMessageInfo -func (m *ACLChangeACLSnapshot) GetAclState() *ACLChangeACLState { - if m != nil { - return m.AclState - } - return nil -} - -type ACLChangeACLState struct { - ReadKeyHashes []uint64 `protobuf:"varint,1,rep,packed,name=readKeyHashes,proto3" json:"readKeyHashes,omitempty"` - UserStates []*ACLChangeUserState `protobuf:"bytes,2,rep,name=userStates,proto3" json:"userStates,omitempty"` - Invites map[string]*ACLChangeUserInvite `protobuf:"bytes,3,rep,name=invites,proto3" json:"invites,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (m *ACLChangeACLState) Reset() { *m = ACLChangeACLState{} } -func (m *ACLChangeACLState) String() string { return proto.CompactTextString(m) } -func (*ACLChangeACLState) ProtoMessage() {} -func (*ACLChangeACLState) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{2, 3} -} -func (m *ACLChangeACLState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ACLChangeACLState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ACLChangeACLState.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 *ACLChangeACLState) XXX_Merge(src proto.Message) { - xxx_messageInfo_ACLChangeACLState.Merge(m, src) -} -func (m *ACLChangeACLState) XXX_Size() int { - return m.Size() -} -func (m *ACLChangeACLState) XXX_DiscardUnknown() { - xxx_messageInfo_ACLChangeACLState.DiscardUnknown(m) -} - -var xxx_messageInfo_ACLChangeACLState proto.InternalMessageInfo - -func (m *ACLChangeACLState) GetReadKeyHashes() []uint64 { +func (m *ACLState) GetReadKeyHashes() []uint64 { if m != nil { return m.ReadKeyHashes } return nil } -func (m *ACLChangeACLState) GetUserStates() []*ACLChangeUserState { +func (m *ACLState) GetUserStates() []*ACLUserState { if m != nil { return m.UserStates } return nil } -func (m *ACLChangeACLState) GetInvites() map[string]*ACLChangeUserInvite { +func (m *ACLState) GetInvites() map[string]*ACLUserInvite { if m != nil { return m.Invites } return nil } -type ACLChangeUserState struct { - Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` - EncryptionKey []byte `protobuf:"bytes,2,opt,name=encryptionKey,proto3" json:"encryptionKey,omitempty"` - EncryptedReadKeys [][]byte `protobuf:"bytes,3,rep,name=encryptedReadKeys,proto3" json:"encryptedReadKeys,omitempty"` - Permissions ACLChangeUserPermissions `protobuf:"varint,4,opt,name=permissions,proto3,enum=acl.ACLChangeUserPermissions" json:"permissions,omitempty"` - IsConfirmed bool `protobuf:"varint,5,opt,name=IsConfirmed,proto3" json:"IsConfirmed,omitempty"` +type ACLUserState struct { + Identity []byte `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` + EncryptionKey []byte `protobuf:"bytes,2,opt,name=encryptionKey,proto3" json:"encryptionKey,omitempty"` + EncryptedReadKeys [][]byte `protobuf:"bytes,3,rep,name=encryptedReadKeys,proto3" json:"encryptedReadKeys,omitempty"` + Permissions ACLUserPermissions `protobuf:"varint,4,opt,name=permissions,proto3,enum=acl.ACLUserPermissions" json:"permissions,omitempty"` + IsConfirmed bool `protobuf:"varint,5,opt,name=isConfirmed,proto3" json:"isConfirmed,omitempty"` } -func (m *ACLChangeUserState) Reset() { *m = ACLChangeUserState{} } -func (m *ACLChangeUserState) String() string { return proto.CompactTextString(m) } -func (*ACLChangeUserState) ProtoMessage() {} -func (*ACLChangeUserState) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{2, 4} +func (m *ACLUserState) Reset() { *m = ACLUserState{} } +func (m *ACLUserState) String() string { return proto.CompactTextString(m) } +func (*ACLUserState) ProtoMessage() {} +func (*ACLUserState) Descriptor() ([]byte, []int) { + return fileDescriptor_37a022c841a51877, []int{4} } -func (m *ACLChangeUserState) XXX_Unmarshal(b []byte) error { +func (m *ACLUserState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ACLChangeUserState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ACLUserState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ACLChangeUserState.Marshal(b, m, deterministic) + return xxx_messageInfo_ACLUserState.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -623,47 +408,47 @@ func (m *ACLChangeUserState) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *ACLChangeUserState) XXX_Merge(src proto.Message) { - xxx_messageInfo_ACLChangeUserState.Merge(m, src) +func (m *ACLUserState) XXX_Merge(src proto.Message) { + xxx_messageInfo_ACLUserState.Merge(m, src) } -func (m *ACLChangeUserState) XXX_Size() int { +func (m *ACLUserState) XXX_Size() int { return m.Size() } -func (m *ACLChangeUserState) XXX_DiscardUnknown() { - xxx_messageInfo_ACLChangeUserState.DiscardUnknown(m) +func (m *ACLUserState) XXX_DiscardUnknown() { + xxx_messageInfo_ACLUserState.DiscardUnknown(m) } -var xxx_messageInfo_ACLChangeUserState proto.InternalMessageInfo +var xxx_messageInfo_ACLUserState proto.InternalMessageInfo -func (m *ACLChangeUserState) GetIdentity() string { +func (m *ACLUserState) GetIdentity() []byte { if m != nil { return m.Identity } - return "" + return nil } -func (m *ACLChangeUserState) GetEncryptionKey() []byte { +func (m *ACLUserState) GetEncryptionKey() []byte { if m != nil { return m.EncryptionKey } return nil } -func (m *ACLChangeUserState) GetEncryptedReadKeys() [][]byte { +func (m *ACLUserState) GetEncryptedReadKeys() [][]byte { if m != nil { return m.EncryptedReadKeys } return nil } -func (m *ACLChangeUserState) GetPermissions() ACLChangeUserPermissions { +func (m *ACLUserState) GetPermissions() ACLUserPermissions { if m != nil { return m.Permissions } - return ACLChange_Admin + return ACLUserPermissions_Admin } -func (m *ACLChangeUserState) GetIsConfirmed() bool { +func (m *ACLUserState) GetIsConfirmed() bool { if m != nil { return m.IsConfirmed } @@ -671,25 +456,25 @@ func (m *ACLChangeUserState) GetIsConfirmed() bool { } // we already know identity and encryptionKey -type ACLChangeUserAdd struct { - Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` - EncryptionKey []byte `protobuf:"bytes,2,opt,name=encryptionKey,proto3" json:"encryptionKey,omitempty"` - EncryptedReadKeys [][]byte `protobuf:"bytes,3,rep,name=encryptedReadKeys,proto3" json:"encryptedReadKeys,omitempty"` - Permissions ACLChangeUserPermissions `protobuf:"varint,4,opt,name=permissions,proto3,enum=acl.ACLChangeUserPermissions" json:"permissions,omitempty"` +type ACLUserAdd struct { + Identity []byte `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` + EncryptionKey []byte `protobuf:"bytes,2,opt,name=encryptionKey,proto3" json:"encryptionKey,omitempty"` + EncryptedReadKeys [][]byte `protobuf:"bytes,3,rep,name=encryptedReadKeys,proto3" json:"encryptedReadKeys,omitempty"` + Permissions ACLUserPermissions `protobuf:"varint,4,opt,name=permissions,proto3,enum=acl.ACLUserPermissions" json:"permissions,omitempty"` } -func (m *ACLChangeUserAdd) Reset() { *m = ACLChangeUserAdd{} } -func (m *ACLChangeUserAdd) String() string { return proto.CompactTextString(m) } -func (*ACLChangeUserAdd) ProtoMessage() {} -func (*ACLChangeUserAdd) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{2, 5} +func (m *ACLUserAdd) Reset() { *m = ACLUserAdd{} } +func (m *ACLUserAdd) String() string { return proto.CompactTextString(m) } +func (*ACLUserAdd) ProtoMessage() {} +func (*ACLUserAdd) Descriptor() ([]byte, []int) { + return fileDescriptor_37a022c841a51877, []int{5} } -func (m *ACLChangeUserAdd) XXX_Unmarshal(b []byte) error { +func (m *ACLUserAdd) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ACLChangeUserAdd) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ACLUserAdd) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ACLChangeUserAdd.Marshal(b, m, deterministic) + return xxx_messageInfo_ACLUserAdd.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -699,64 +484,64 @@ func (m *ACLChangeUserAdd) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } -func (m *ACLChangeUserAdd) XXX_Merge(src proto.Message) { - xxx_messageInfo_ACLChangeUserAdd.Merge(m, src) +func (m *ACLUserAdd) XXX_Merge(src proto.Message) { + xxx_messageInfo_ACLUserAdd.Merge(m, src) } -func (m *ACLChangeUserAdd) XXX_Size() int { +func (m *ACLUserAdd) XXX_Size() int { return m.Size() } -func (m *ACLChangeUserAdd) XXX_DiscardUnknown() { - xxx_messageInfo_ACLChangeUserAdd.DiscardUnknown(m) +func (m *ACLUserAdd) XXX_DiscardUnknown() { + xxx_messageInfo_ACLUserAdd.DiscardUnknown(m) } -var xxx_messageInfo_ACLChangeUserAdd proto.InternalMessageInfo +var xxx_messageInfo_ACLUserAdd proto.InternalMessageInfo -func (m *ACLChangeUserAdd) GetIdentity() string { +func (m *ACLUserAdd) GetIdentity() []byte { if m != nil { return m.Identity } - return "" + return nil } -func (m *ACLChangeUserAdd) GetEncryptionKey() []byte { +func (m *ACLUserAdd) GetEncryptionKey() []byte { if m != nil { return m.EncryptionKey } return nil } -func (m *ACLChangeUserAdd) GetEncryptedReadKeys() [][]byte { +func (m *ACLUserAdd) GetEncryptedReadKeys() [][]byte { if m != nil { return m.EncryptedReadKeys } return nil } -func (m *ACLChangeUserAdd) GetPermissions() ACLChangeUserPermissions { +func (m *ACLUserAdd) GetPermissions() ACLUserPermissions { if m != nil { return m.Permissions } - return ACLChange_Admin + return ACLUserPermissions_Admin } // TODO: this is not used as of now -type ACLChangeUserConfirm struct { - Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` +type ACLUserConfirm struct { + Identity []byte `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` UserAddId string `protobuf:"bytes,2,opt,name=userAddId,proto3" json:"userAddId,omitempty"` } -func (m *ACLChangeUserConfirm) Reset() { *m = ACLChangeUserConfirm{} } -func (m *ACLChangeUserConfirm) String() string { return proto.CompactTextString(m) } -func (*ACLChangeUserConfirm) ProtoMessage() {} -func (*ACLChangeUserConfirm) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{2, 6} +func (m *ACLUserConfirm) Reset() { *m = ACLUserConfirm{} } +func (m *ACLUserConfirm) String() string { return proto.CompactTextString(m) } +func (*ACLUserConfirm) ProtoMessage() {} +func (*ACLUserConfirm) Descriptor() ([]byte, []int) { + return fileDescriptor_37a022c841a51877, []int{6} } -func (m *ACLChangeUserConfirm) XXX_Unmarshal(b []byte) error { +func (m *ACLUserConfirm) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ACLChangeUserConfirm) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ACLUserConfirm) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ACLChangeUserConfirm.Marshal(b, m, deterministic) + return xxx_messageInfo_ACLUserConfirm.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -766,52 +551,52 @@ func (m *ACLChangeUserConfirm) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } -func (m *ACLChangeUserConfirm) XXX_Merge(src proto.Message) { - xxx_messageInfo_ACLChangeUserConfirm.Merge(m, src) +func (m *ACLUserConfirm) XXX_Merge(src proto.Message) { + xxx_messageInfo_ACLUserConfirm.Merge(m, src) } -func (m *ACLChangeUserConfirm) XXX_Size() int { +func (m *ACLUserConfirm) XXX_Size() int { return m.Size() } -func (m *ACLChangeUserConfirm) XXX_DiscardUnknown() { - xxx_messageInfo_ACLChangeUserConfirm.DiscardUnknown(m) +func (m *ACLUserConfirm) XXX_DiscardUnknown() { + xxx_messageInfo_ACLUserConfirm.DiscardUnknown(m) } -var xxx_messageInfo_ACLChangeUserConfirm proto.InternalMessageInfo +var xxx_messageInfo_ACLUserConfirm proto.InternalMessageInfo -func (m *ACLChangeUserConfirm) GetIdentity() string { +func (m *ACLUserConfirm) GetIdentity() []byte { if m != nil { return m.Identity } - return "" + return nil } -func (m *ACLChangeUserConfirm) GetUserAddId() string { +func (m *ACLUserConfirm) GetUserAddId() string { if m != nil { return m.UserAddId } return "" } -type ACLChangeUserInvite struct { - AcceptPublicKey []byte `protobuf:"bytes,1,opt,name=acceptPublicKey,proto3" json:"acceptPublicKey,omitempty"` - EncryptPublicKey []byte `protobuf:"bytes,2,opt,name=encryptPublicKey,proto3" json:"encryptPublicKey,omitempty"` - EncryptedReadKeys [][]byte `protobuf:"bytes,3,rep,name=encryptedReadKeys,proto3" json:"encryptedReadKeys,omitempty"` - Permissions ACLChangeUserPermissions `protobuf:"varint,4,opt,name=permissions,proto3,enum=acl.ACLChangeUserPermissions" json:"permissions,omitempty"` - InviteId string `protobuf:"bytes,5,opt,name=InviteId,proto3" json:"InviteId,omitempty"` +type ACLUserInvite struct { + AcceptPublicKey []byte `protobuf:"bytes,1,opt,name=acceptPublicKey,proto3" json:"acceptPublicKey,omitempty"` + EncryptPublicKey []byte `protobuf:"bytes,2,opt,name=encryptPublicKey,proto3" json:"encryptPublicKey,omitempty"` + EncryptedReadKeys [][]byte `protobuf:"bytes,3,rep,name=encryptedReadKeys,proto3" json:"encryptedReadKeys,omitempty"` + Permissions ACLUserPermissions `protobuf:"varint,4,opt,name=permissions,proto3,enum=acl.ACLUserPermissions" json:"permissions,omitempty"` + InviteId string `protobuf:"bytes,5,opt,name=inviteId,proto3" json:"inviteId,omitempty"` } -func (m *ACLChangeUserInvite) Reset() { *m = ACLChangeUserInvite{} } -func (m *ACLChangeUserInvite) String() string { return proto.CompactTextString(m) } -func (*ACLChangeUserInvite) ProtoMessage() {} -func (*ACLChangeUserInvite) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{2, 7} +func (m *ACLUserInvite) Reset() { *m = ACLUserInvite{} } +func (m *ACLUserInvite) String() string { return proto.CompactTextString(m) } +func (*ACLUserInvite) ProtoMessage() {} +func (*ACLUserInvite) Descriptor() ([]byte, []int) { + return fileDescriptor_37a022c841a51877, []int{7} } -func (m *ACLChangeUserInvite) XXX_Unmarshal(b []byte) error { +func (m *ACLUserInvite) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ACLChangeUserInvite) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ACLUserInvite) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ACLChangeUserInvite.Marshal(b, m, deterministic) + return xxx_messageInfo_ACLUserInvite.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -821,73 +606,73 @@ func (m *ACLChangeUserInvite) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *ACLChangeUserInvite) XXX_Merge(src proto.Message) { - xxx_messageInfo_ACLChangeUserInvite.Merge(m, src) +func (m *ACLUserInvite) XXX_Merge(src proto.Message) { + xxx_messageInfo_ACLUserInvite.Merge(m, src) } -func (m *ACLChangeUserInvite) XXX_Size() int { +func (m *ACLUserInvite) XXX_Size() int { return m.Size() } -func (m *ACLChangeUserInvite) XXX_DiscardUnknown() { - xxx_messageInfo_ACLChangeUserInvite.DiscardUnknown(m) +func (m *ACLUserInvite) XXX_DiscardUnknown() { + xxx_messageInfo_ACLUserInvite.DiscardUnknown(m) } -var xxx_messageInfo_ACLChangeUserInvite proto.InternalMessageInfo +var xxx_messageInfo_ACLUserInvite proto.InternalMessageInfo -func (m *ACLChangeUserInvite) GetAcceptPublicKey() []byte { +func (m *ACLUserInvite) GetAcceptPublicKey() []byte { if m != nil { return m.AcceptPublicKey } return nil } -func (m *ACLChangeUserInvite) GetEncryptPublicKey() []byte { +func (m *ACLUserInvite) GetEncryptPublicKey() []byte { if m != nil { return m.EncryptPublicKey } return nil } -func (m *ACLChangeUserInvite) GetEncryptedReadKeys() [][]byte { +func (m *ACLUserInvite) GetEncryptedReadKeys() [][]byte { if m != nil { return m.EncryptedReadKeys } return nil } -func (m *ACLChangeUserInvite) GetPermissions() ACLChangeUserPermissions { +func (m *ACLUserInvite) GetPermissions() ACLUserPermissions { if m != nil { return m.Permissions } - return ACLChange_Admin + return ACLUserPermissions_Admin } -func (m *ACLChangeUserInvite) GetInviteId() string { +func (m *ACLUserInvite) GetInviteId() string { if m != nil { return m.InviteId } return "" } -type ACLChangeUserJoin struct { - Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` +type ACLUserJoin struct { + Identity []byte `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` EncryptionKey []byte `protobuf:"bytes,2,opt,name=encryptionKey,proto3" json:"encryptionKey,omitempty"` AcceptSignature []byte `protobuf:"bytes,3,opt,name=acceptSignature,proto3" json:"acceptSignature,omitempty"` UserInviteId string `protobuf:"bytes,4,opt,name=userInviteId,proto3" json:"userInviteId,omitempty"` EncryptedReadKeys [][]byte `protobuf:"bytes,5,rep,name=encryptedReadKeys,proto3" json:"encryptedReadKeys,omitempty"` } -func (m *ACLChangeUserJoin) Reset() { *m = ACLChangeUserJoin{} } -func (m *ACLChangeUserJoin) String() string { return proto.CompactTextString(m) } -func (*ACLChangeUserJoin) ProtoMessage() {} -func (*ACLChangeUserJoin) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{2, 8} +func (m *ACLUserJoin) Reset() { *m = ACLUserJoin{} } +func (m *ACLUserJoin) String() string { return proto.CompactTextString(m) } +func (*ACLUserJoin) ProtoMessage() {} +func (*ACLUserJoin) Descriptor() ([]byte, []int) { + return fileDescriptor_37a022c841a51877, []int{8} } -func (m *ACLChangeUserJoin) XXX_Unmarshal(b []byte) error { +func (m *ACLUserJoin) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ACLChangeUserJoin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ACLUserJoin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ACLChangeUserJoin.Marshal(b, m, deterministic) + return xxx_messageInfo_ACLUserJoin.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -897,70 +682,70 @@ func (m *ACLChangeUserJoin) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } -func (m *ACLChangeUserJoin) XXX_Merge(src proto.Message) { - xxx_messageInfo_ACLChangeUserJoin.Merge(m, src) +func (m *ACLUserJoin) XXX_Merge(src proto.Message) { + xxx_messageInfo_ACLUserJoin.Merge(m, src) } -func (m *ACLChangeUserJoin) XXX_Size() int { +func (m *ACLUserJoin) XXX_Size() int { return m.Size() } -func (m *ACLChangeUserJoin) XXX_DiscardUnknown() { - xxx_messageInfo_ACLChangeUserJoin.DiscardUnknown(m) +func (m *ACLUserJoin) XXX_DiscardUnknown() { + xxx_messageInfo_ACLUserJoin.DiscardUnknown(m) } -var xxx_messageInfo_ACLChangeUserJoin proto.InternalMessageInfo +var xxx_messageInfo_ACLUserJoin proto.InternalMessageInfo -func (m *ACLChangeUserJoin) GetIdentity() string { +func (m *ACLUserJoin) GetIdentity() []byte { if m != nil { return m.Identity } - return "" + return nil } -func (m *ACLChangeUserJoin) GetEncryptionKey() []byte { +func (m *ACLUserJoin) GetEncryptionKey() []byte { if m != nil { return m.EncryptionKey } return nil } -func (m *ACLChangeUserJoin) GetAcceptSignature() []byte { +func (m *ACLUserJoin) GetAcceptSignature() []byte { if m != nil { return m.AcceptSignature } return nil } -func (m *ACLChangeUserJoin) GetUserInviteId() string { +func (m *ACLUserJoin) GetUserInviteId() string { if m != nil { return m.UserInviteId } return "" } -func (m *ACLChangeUserJoin) GetEncryptedReadKeys() [][]byte { +func (m *ACLUserJoin) GetEncryptedReadKeys() [][]byte { if m != nil { return m.EncryptedReadKeys } return nil } -type ACLChangeUserRemove struct { - Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` - ReadKeyReplaces []*ACLChangeReadKeyReplace `protobuf:"bytes,3,rep,name=readKeyReplaces,proto3" json:"readKeyReplaces,omitempty"` +type ACLUserRemove struct { + Identity []byte `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` + ReadKeyReplaces []*ACLReadKeyReplace `protobuf:"bytes,3,rep,name=readKeyReplaces,proto3" json:"readKeyReplaces,omitempty"` } -func (m *ACLChangeUserRemove) Reset() { *m = ACLChangeUserRemove{} } -func (m *ACLChangeUserRemove) String() string { return proto.CompactTextString(m) } -func (*ACLChangeUserRemove) ProtoMessage() {} -func (*ACLChangeUserRemove) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{2, 9} +func (m *ACLUserRemove) Reset() { *m = ACLUserRemove{} } +func (m *ACLUserRemove) String() string { return proto.CompactTextString(m) } +func (*ACLUserRemove) ProtoMessage() {} +func (*ACLUserRemove) Descriptor() ([]byte, []int) { + return fileDescriptor_37a022c841a51877, []int{9} } -func (m *ACLChangeUserRemove) XXX_Unmarshal(b []byte) error { +func (m *ACLUserRemove) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ACLChangeUserRemove) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ACLUserRemove) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ACLChangeUserRemove.Marshal(b, m, deterministic) + return xxx_messageInfo_ACLUserRemove.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -970,50 +755,50 @@ func (m *ACLChangeUserRemove) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *ACLChangeUserRemove) XXX_Merge(src proto.Message) { - xxx_messageInfo_ACLChangeUserRemove.Merge(m, src) +func (m *ACLUserRemove) XXX_Merge(src proto.Message) { + xxx_messageInfo_ACLUserRemove.Merge(m, src) } -func (m *ACLChangeUserRemove) XXX_Size() int { +func (m *ACLUserRemove) XXX_Size() int { return m.Size() } -func (m *ACLChangeUserRemove) XXX_DiscardUnknown() { - xxx_messageInfo_ACLChangeUserRemove.DiscardUnknown(m) +func (m *ACLUserRemove) XXX_DiscardUnknown() { + xxx_messageInfo_ACLUserRemove.DiscardUnknown(m) } -var xxx_messageInfo_ACLChangeUserRemove proto.InternalMessageInfo +var xxx_messageInfo_ACLUserRemove proto.InternalMessageInfo -func (m *ACLChangeUserRemove) GetIdentity() string { +func (m *ACLUserRemove) GetIdentity() []byte { if m != nil { return m.Identity } - return "" + return nil } -func (m *ACLChangeUserRemove) GetReadKeyReplaces() []*ACLChangeReadKeyReplace { +func (m *ACLUserRemove) GetReadKeyReplaces() []*ACLReadKeyReplace { if m != nil { return m.ReadKeyReplaces } return nil } -type ACLChangeReadKeyReplace struct { - Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` +type ACLReadKeyReplace struct { + Identity []byte `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` EncryptionKey []byte `protobuf:"bytes,2,opt,name=encryptionKey,proto3" json:"encryptionKey,omitempty"` EncryptedReadKey []byte `protobuf:"bytes,3,opt,name=encryptedReadKey,proto3" json:"encryptedReadKey,omitempty"` } -func (m *ACLChangeReadKeyReplace) Reset() { *m = ACLChangeReadKeyReplace{} } -func (m *ACLChangeReadKeyReplace) String() string { return proto.CompactTextString(m) } -func (*ACLChangeReadKeyReplace) ProtoMessage() {} -func (*ACLChangeReadKeyReplace) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{2, 10} +func (m *ACLReadKeyReplace) Reset() { *m = ACLReadKeyReplace{} } +func (m *ACLReadKeyReplace) String() string { return proto.CompactTextString(m) } +func (*ACLReadKeyReplace) ProtoMessage() {} +func (*ACLReadKeyReplace) Descriptor() ([]byte, []int) { + return fileDescriptor_37a022c841a51877, []int{10} } -func (m *ACLChangeReadKeyReplace) XXX_Unmarshal(b []byte) error { +func (m *ACLReadKeyReplace) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ACLChangeReadKeyReplace) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ACLReadKeyReplace) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ACLChangeReadKeyReplace.Marshal(b, m, deterministic) + return xxx_messageInfo_ACLReadKeyReplace.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1023,56 +808,56 @@ func (m *ACLChangeReadKeyReplace) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } -func (m *ACLChangeReadKeyReplace) XXX_Merge(src proto.Message) { - xxx_messageInfo_ACLChangeReadKeyReplace.Merge(m, src) +func (m *ACLReadKeyReplace) XXX_Merge(src proto.Message) { + xxx_messageInfo_ACLReadKeyReplace.Merge(m, src) } -func (m *ACLChangeReadKeyReplace) XXX_Size() int { +func (m *ACLReadKeyReplace) XXX_Size() int { return m.Size() } -func (m *ACLChangeReadKeyReplace) XXX_DiscardUnknown() { - xxx_messageInfo_ACLChangeReadKeyReplace.DiscardUnknown(m) +func (m *ACLReadKeyReplace) XXX_DiscardUnknown() { + xxx_messageInfo_ACLReadKeyReplace.DiscardUnknown(m) } -var xxx_messageInfo_ACLChangeReadKeyReplace proto.InternalMessageInfo +var xxx_messageInfo_ACLReadKeyReplace proto.InternalMessageInfo -func (m *ACLChangeReadKeyReplace) GetIdentity() string { +func (m *ACLReadKeyReplace) GetIdentity() []byte { if m != nil { return m.Identity } - return "" + return nil } -func (m *ACLChangeReadKeyReplace) GetEncryptionKey() []byte { +func (m *ACLReadKeyReplace) GetEncryptionKey() []byte { if m != nil { return m.EncryptionKey } return nil } -func (m *ACLChangeReadKeyReplace) GetEncryptedReadKey() []byte { +func (m *ACLReadKeyReplace) GetEncryptedReadKey() []byte { if m != nil { return m.EncryptedReadKey } return nil } -type ACLChangeUserPermissionChange struct { - Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` - Permissions ACLChangeUserPermissions `protobuf:"varint,2,opt,name=permissions,proto3,enum=acl.ACLChangeUserPermissions" json:"permissions,omitempty"` +type ACLUserPermissionChange struct { + Identity []byte `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` + Permissions ACLUserPermissions `protobuf:"varint,2,opt,name=permissions,proto3,enum=acl.ACLUserPermissions" json:"permissions,omitempty"` } -func (m *ACLChangeUserPermissionChange) Reset() { *m = ACLChangeUserPermissionChange{} } -func (m *ACLChangeUserPermissionChange) String() string { return proto.CompactTextString(m) } -func (*ACLChangeUserPermissionChange) ProtoMessage() {} -func (*ACLChangeUserPermissionChange) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{2, 11} +func (m *ACLUserPermissionChange) Reset() { *m = ACLUserPermissionChange{} } +func (m *ACLUserPermissionChange) String() string { return proto.CompactTextString(m) } +func (*ACLUserPermissionChange) ProtoMessage() {} +func (*ACLUserPermissionChange) Descriptor() ([]byte, []int) { + return fileDescriptor_37a022c841a51877, []int{11} } -func (m *ACLChangeUserPermissionChange) XXX_Unmarshal(b []byte) error { +func (m *ACLUserPermissionChange) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ACLChangeUserPermissionChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ACLUserPermissionChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ACLChangeUserPermissionChange.Marshal(b, m, deterministic) + return xxx_messageInfo_ACLUserPermissionChange.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1082,152 +867,52 @@ func (m *ACLChangeUserPermissionChange) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } -func (m *ACLChangeUserPermissionChange) XXX_Merge(src proto.Message) { - xxx_messageInfo_ACLChangeUserPermissionChange.Merge(m, src) +func (m *ACLUserPermissionChange) XXX_Merge(src proto.Message) { + xxx_messageInfo_ACLUserPermissionChange.Merge(m, src) } -func (m *ACLChangeUserPermissionChange) XXX_Size() int { +func (m *ACLUserPermissionChange) XXX_Size() int { return m.Size() } -func (m *ACLChangeUserPermissionChange) XXX_DiscardUnknown() { - xxx_messageInfo_ACLChangeUserPermissionChange.DiscardUnknown(m) +func (m *ACLUserPermissionChange) XXX_DiscardUnknown() { + xxx_messageInfo_ACLUserPermissionChange.DiscardUnknown(m) } -var xxx_messageInfo_ACLChangeUserPermissionChange proto.InternalMessageInfo +var xxx_messageInfo_ACLUserPermissionChange proto.InternalMessageInfo -func (m *ACLChangeUserPermissionChange) GetIdentity() string { +func (m *ACLUserPermissionChange) GetIdentity() []byte { if m != nil { return m.Identity } - return "" + return nil } -func (m *ACLChangeUserPermissionChange) GetPermissions() ACLChangeUserPermissions { +func (m *ACLUserPermissionChange) GetPermissions() ACLUserPermissions { if m != nil { return m.Permissions } - return ACLChange_Admin + return ACLUserPermissions_Admin } -type Change struct { - TreeHeadIds []string `protobuf:"bytes,1,rep,name=treeHeadIds,proto3" json:"treeHeadIds,omitempty"` - AclHeadId string `protobuf:"bytes,2,opt,name=aclHeadId,proto3" json:"aclHeadId,omitempty"` - SnapshotBaseId string `protobuf:"bytes,3,opt,name=snapshotBaseId,proto3" json:"snapshotBaseId,omitempty"` - ChangesData []byte `protobuf:"bytes,4,opt,name=changesData,proto3" json:"changesData,omitempty"` - CurrentReadKeyHash uint64 `protobuf:"varint,5,opt,name=currentReadKeyHash,proto3" json:"currentReadKeyHash,omitempty"` - Timestamp int64 `protobuf:"varint,6,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - Identity string `protobuf:"bytes,7,opt,name=identity,proto3" json:"identity,omitempty"` - IsSnapshot bool `protobuf:"varint,8,opt,name=isSnapshot,proto3" json:"isSnapshot,omitempty"` -} - -func (m *Change) Reset() { *m = Change{} } -func (m *Change) String() string { return proto.CompactTextString(m) } -func (*Change) ProtoMessage() {} -func (*Change) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{3} -} -func (m *Change) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Change) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Change.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 *Change) XXX_Merge(src proto.Message) { - xxx_messageInfo_Change.Merge(m, src) -} -func (m *Change) XXX_Size() int { - return m.Size() -} -func (m *Change) XXX_DiscardUnknown() { - xxx_messageInfo_Change.DiscardUnknown(m) -} - -var xxx_messageInfo_Change proto.InternalMessageInfo - -func (m *Change) GetTreeHeadIds() []string { - if m != nil { - return m.TreeHeadIds - } - return nil -} - -func (m *Change) GetAclHeadId() string { - if m != nil { - return m.AclHeadId - } - return "" -} - -func (m *Change) GetSnapshotBaseId() string { - if m != nil { - return m.SnapshotBaseId - } - return "" -} - -func (m *Change) GetChangesData() []byte { - if m != nil { - return m.ChangesData - } - return nil -} - -func (m *Change) GetCurrentReadKeyHash() uint64 { - if m != nil { - return m.CurrentReadKeyHash - } - return 0 -} - -func (m *Change) GetTimestamp() int64 { - if m != nil { - return m.Timestamp - } - return 0 -} - -func (m *Change) GetIdentity() string { - if m != nil { - return m.Identity - } - return "" -} - -func (m *Change) GetIsSnapshot() bool { - if m != nil { - return m.IsSnapshot - } - return false -} - -type Record struct { +type ACLRecord struct { PrevId string `protobuf:"bytes,1,opt,name=prevId,proto3" json:"prevId,omitempty"` - Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` + Identity []byte `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` CurrentReadKeyHash uint64 `protobuf:"varint,4,opt,name=currentReadKeyHash,proto3" json:"currentReadKeyHash,omitempty"` Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"` } -func (m *Record) Reset() { *m = Record{} } -func (m *Record) String() string { return proto.CompactTextString(m) } -func (*Record) ProtoMessage() {} -func (*Record) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{4} +func (m *ACLRecord) Reset() { *m = ACLRecord{} } +func (m *ACLRecord) String() string { return proto.CompactTextString(m) } +func (*ACLRecord) ProtoMessage() {} +func (*ACLRecord) Descriptor() ([]byte, []int) { + return fileDescriptor_37a022c841a51877, []int{12} } -func (m *Record) XXX_Unmarshal(b []byte) error { +func (m *ACLRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *Record) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ACLRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_Record.Marshal(b, m, deterministic) + return xxx_messageInfo_ACLRecord.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1237,72 +922,70 @@ func (m *Record) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *Record) XXX_Merge(src proto.Message) { - xxx_messageInfo_Record.Merge(m, src) +func (m *ACLRecord) XXX_Merge(src proto.Message) { + xxx_messageInfo_ACLRecord.Merge(m, src) } -func (m *Record) XXX_Size() int { +func (m *ACLRecord) XXX_Size() int { return m.Size() } -func (m *Record) XXX_DiscardUnknown() { - xxx_messageInfo_Record.DiscardUnknown(m) +func (m *ACLRecord) XXX_DiscardUnknown() { + xxx_messageInfo_ACLRecord.DiscardUnknown(m) } -var xxx_messageInfo_Record proto.InternalMessageInfo +var xxx_messageInfo_ACLRecord proto.InternalMessageInfo -func (m *Record) GetPrevId() string { +func (m *ACLRecord) GetPrevId() string { if m != nil { return m.PrevId } return "" } -func (m *Record) GetIdentity() string { +func (m *ACLRecord) GetIdentity() []byte { if m != nil { return m.Identity } - return "" + return nil } -func (m *Record) GetData() []byte { +func (m *ACLRecord) GetData() []byte { if m != nil { return m.Data } return nil } -func (m *Record) GetCurrentReadKeyHash() uint64 { +func (m *ACLRecord) GetCurrentReadKeyHash() uint64 { if m != nil { return m.CurrentReadKeyHash } return 0 } -func (m *Record) GetTimestamp() int64 { +func (m *ACLRecord) GetTimestamp() int64 { if m != nil { return m.Timestamp } return 0 } -type Header struct { - FirstId string `protobuf:"bytes,1,opt,name=firstId,proto3" json:"firstId,omitempty"` - AclListId string `protobuf:"bytes,2,opt,name=aclListId,proto3" json:"aclListId,omitempty"` - WorkspaceId string `protobuf:"bytes,3,opt,name=workspaceId,proto3" json:"workspaceId,omitempty"` - DocType HeaderDocType `protobuf:"varint,4,opt,name=docType,proto3,enum=acl.HeaderDocType" json:"docType,omitempty"` +type ACLHeader struct { + FirstId string `protobuf:"bytes,1,opt,name=firstId,proto3" json:"firstId,omitempty"` + Identity []byte `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` } -func (m *Header) Reset() { *m = Header{} } -func (m *Header) String() string { return proto.CompactTextString(m) } -func (*Header) ProtoMessage() {} -func (*Header) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{5} +func (m *ACLHeader) Reset() { *m = ACLHeader{} } +func (m *ACLHeader) String() string { return proto.CompactTextString(m) } +func (*ACLHeader) ProtoMessage() {} +func (*ACLHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_37a022c841a51877, []int{13} } -func (m *Header) XXX_Unmarshal(b []byte) error { +func (m *ACLHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ACLHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_Header.Marshal(b, m, deterministic) + return xxx_messageInfo_ACLHeader.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1312,68 +995,334 @@ func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *Header) XXX_Merge(src proto.Message) { - xxx_messageInfo_Header.Merge(m, src) +func (m *ACLHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_ACLHeader.Merge(m, src) } -func (m *Header) XXX_Size() int { +func (m *ACLHeader) XXX_Size() int { return m.Size() } -func (m *Header) XXX_DiscardUnknown() { - xxx_messageInfo_Header.DiscardUnknown(m) +func (m *ACLHeader) XXX_DiscardUnknown() { + xxx_messageInfo_ACLHeader.DiscardUnknown(m) } -var xxx_messageInfo_Header proto.InternalMessageInfo +var xxx_messageInfo_ACLHeader proto.InternalMessageInfo -func (m *Header) GetFirstId() string { +func (m *ACLHeader) GetFirstId() string { if m != nil { return m.FirstId } return "" } -func (m *Header) GetAclListId() string { +func (m *ACLHeader) GetIdentity() []byte { if m != nil { - return m.AclListId + return m.Identity + } + return nil +} + +type RawTreeChange struct { + Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (m *RawTreeChange) Reset() { *m = RawTreeChange{} } +func (m *RawTreeChange) String() string { return proto.CompactTextString(m) } +func (*RawTreeChange) ProtoMessage() {} +func (*RawTreeChange) Descriptor() ([]byte, []int) { + return fileDescriptor_37a022c841a51877, []int{14} +} +func (m *RawTreeChange) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RawTreeChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RawTreeChange.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 *RawTreeChange) XXX_Merge(src proto.Message) { + xxx_messageInfo_RawTreeChange.Merge(m, src) +} +func (m *RawTreeChange) XXX_Size() int { + return m.Size() +} +func (m *RawTreeChange) XXX_DiscardUnknown() { + xxx_messageInfo_RawTreeChange.DiscardUnknown(m) +} + +var xxx_messageInfo_RawTreeChange proto.InternalMessageInfo + +func (m *RawTreeChange) GetPayload() []byte { + if m != nil { + return m.Payload + } + return nil +} + +func (m *RawTreeChange) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +type RawTreeChangeWithId struct { + RawChange []byte `protobuf:"bytes,1,opt,name=rawChange,proto3" json:"rawChange,omitempty"` + Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` +} + +func (m *RawTreeChangeWithId) Reset() { *m = RawTreeChangeWithId{} } +func (m *RawTreeChangeWithId) String() string { return proto.CompactTextString(m) } +func (*RawTreeChangeWithId) ProtoMessage() {} +func (*RawTreeChangeWithId) Descriptor() ([]byte, []int) { + return fileDescriptor_37a022c841a51877, []int{15} +} +func (m *RawTreeChangeWithId) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RawTreeChangeWithId) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RawTreeChangeWithId.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 *RawTreeChangeWithId) XXX_Merge(src proto.Message) { + xxx_messageInfo_RawTreeChangeWithId.Merge(m, src) +} +func (m *RawTreeChangeWithId) XXX_Size() int { + return m.Size() +} +func (m *RawTreeChangeWithId) XXX_DiscardUnknown() { + xxx_messageInfo_RawTreeChangeWithId.DiscardUnknown(m) +} + +var xxx_messageInfo_RawTreeChangeWithId proto.InternalMessageInfo + +func (m *RawTreeChangeWithId) GetRawChange() []byte { + if m != nil { + return m.RawChange + } + return nil +} + +func (m *RawTreeChangeWithId) GetId() string { + if m != nil { + return m.Id } return "" } -func (m *Header) GetWorkspaceId() string { +type TreeChange struct { + TreeHeadIds []string `protobuf:"bytes,1,rep,name=treeHeadIds,proto3" json:"treeHeadIds,omitempty"` + AclHeadId string `protobuf:"bytes,2,opt,name=aclHeadId,proto3" json:"aclHeadId,omitempty"` + SnapshotBaseId string `protobuf:"bytes,3,opt,name=snapshotBaseId,proto3" json:"snapshotBaseId,omitempty"` + ChangesData []byte `protobuf:"bytes,4,opt,name=changesData,proto3" json:"changesData,omitempty"` + CurrentReadKeyHash uint64 `protobuf:"varint,5,opt,name=currentReadKeyHash,proto3" json:"currentReadKeyHash,omitempty"` + Timestamp int64 `protobuf:"varint,6,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Identity []byte `protobuf:"bytes,7,opt,name=identity,proto3" json:"identity,omitempty"` + IsSnapshot bool `protobuf:"varint,8,opt,name=isSnapshot,proto3" json:"isSnapshot,omitempty"` +} + +func (m *TreeChange) Reset() { *m = TreeChange{} } +func (m *TreeChange) String() string { return proto.CompactTextString(m) } +func (*TreeChange) ProtoMessage() {} +func (*TreeChange) Descriptor() ([]byte, []int) { + return fileDescriptor_37a022c841a51877, []int{16} +} +func (m *TreeChange) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TreeChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TreeChange.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 *TreeChange) XXX_Merge(src proto.Message) { + xxx_messageInfo_TreeChange.Merge(m, src) +} +func (m *TreeChange) XXX_Size() int { + return m.Size() +} +func (m *TreeChange) XXX_DiscardUnknown() { + xxx_messageInfo_TreeChange.DiscardUnknown(m) +} + +var xxx_messageInfo_TreeChange proto.InternalMessageInfo + +func (m *TreeChange) GetTreeHeadIds() []string { if m != nil { - return m.WorkspaceId + return m.TreeHeadIds + } + return nil +} + +func (m *TreeChange) GetAclHeadId() string { + if m != nil { + return m.AclHeadId } return "" } -func (m *Header) GetDocType() HeaderDocType { +func (m *TreeChange) GetSnapshotBaseId() string { if m != nil { - return m.DocType + return m.SnapshotBaseId } - return Header_ACL + return "" +} + +func (m *TreeChange) GetChangesData() []byte { + if m != nil { + return m.ChangesData + } + return nil +} + +func (m *TreeChange) GetCurrentReadKeyHash() uint64 { + if m != nil { + return m.CurrentReadKeyHash + } + return 0 +} + +func (m *TreeChange) GetTimestamp() int64 { + if m != nil { + return m.Timestamp + } + return 0 +} + +func (m *TreeChange) GetIdentity() []byte { + if m != nil { + return m.Identity + } + return nil +} + +func (m *TreeChange) GetIsSnapshot() bool { + if m != nil { + return m.IsSnapshot + } + return false +} + +type TreeHeader struct { + FirstId string `protobuf:"bytes,1,opt,name=firstId,proto3" json:"firstId,omitempty"` + AclId string `protobuf:"bytes,2,opt,name=aclId,proto3" json:"aclId,omitempty"` + TreeHeaderType TreeHeaderType `protobuf:"varint,3,opt,name=treeHeaderType,proto3,enum=acl.TreeHeaderType" json:"treeHeaderType,omitempty"` + Identity []byte `protobuf:"bytes,4,opt,name=identity,proto3" json:"identity,omitempty"` + Data []byte `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` +} + +func (m *TreeHeader) Reset() { *m = TreeHeader{} } +func (m *TreeHeader) String() string { return proto.CompactTextString(m) } +func (*TreeHeader) ProtoMessage() {} +func (*TreeHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_37a022c841a51877, []int{17} +} +func (m *TreeHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TreeHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TreeHeader.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 *TreeHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_TreeHeader.Merge(m, src) +} +func (m *TreeHeader) XXX_Size() int { + return m.Size() +} +func (m *TreeHeader) XXX_DiscardUnknown() { + xxx_messageInfo_TreeHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_TreeHeader proto.InternalMessageInfo + +func (m *TreeHeader) GetFirstId() string { + if m != nil { + return m.FirstId + } + return "" +} + +func (m *TreeHeader) GetAclId() string { + if m != nil { + return m.AclId + } + return "" +} + +func (m *TreeHeader) GetTreeHeaderType() TreeHeaderType { + if m != nil { + return m.TreeHeaderType + } + return TreeHeaderType_Object +} + +func (m *TreeHeader) GetIdentity() []byte { + if m != nil { + return m.Identity + } + return nil +} + +func (m *TreeHeader) GetData() []byte { + if m != nil { + return m.Data + } + return nil } func init() { - proto.RegisterEnum("acl.ACLChangeUserPermissions", ACLChangeUserPermissions_name, ACLChangeUserPermissions_value) - proto.RegisterEnum("acl.HeaderDocType", HeaderDocType_name, HeaderDocType_value) - proto.RegisterType((*RawChange)(nil), "acl.RawChange") - proto.RegisterType((*RawRecord)(nil), "acl.RawRecord") - proto.RegisterType((*ACLChange)(nil), "acl.ACLChange") - proto.RegisterType((*ACLChangeACLContentValue)(nil), "acl.ACLChange.ACLContentValue") - proto.RegisterType((*ACLChangeACLData)(nil), "acl.ACLChange.ACLData") - proto.RegisterType((*ACLChangeACLSnapshot)(nil), "acl.ACLChange.ACLSnapshot") - proto.RegisterType((*ACLChangeACLState)(nil), "acl.ACLChange.ACLState") - proto.RegisterMapType((map[string]*ACLChangeUserInvite)(nil), "acl.ACLChange.ACLState.InvitesEntry") - proto.RegisterType((*ACLChangeUserState)(nil), "acl.ACLChange.UserState") - proto.RegisterType((*ACLChangeUserAdd)(nil), "acl.ACLChange.UserAdd") - proto.RegisterType((*ACLChangeUserConfirm)(nil), "acl.ACLChange.UserConfirm") - proto.RegisterType((*ACLChangeUserInvite)(nil), "acl.ACLChange.UserInvite") - proto.RegisterType((*ACLChangeUserJoin)(nil), "acl.ACLChange.UserJoin") - proto.RegisterType((*ACLChangeUserRemove)(nil), "acl.ACLChange.UserRemove") - proto.RegisterType((*ACLChangeReadKeyReplace)(nil), "acl.ACLChange.ReadKeyReplace") - proto.RegisterType((*ACLChangeUserPermissionChange)(nil), "acl.ACLChange.UserPermissionChange") - proto.RegisterType((*Change)(nil), "acl.Change") - proto.RegisterType((*Record)(nil), "acl.Record") - proto.RegisterType((*Header)(nil), "acl.Header") + proto.RegisterEnum("acl.ACLUserPermissions", ACLUserPermissions_name, ACLUserPermissions_value) + proto.RegisterEnum("acl.TreeHeaderType", TreeHeaderType_name, TreeHeaderType_value) + proto.RegisterType((*RawACLRecord)(nil), "acl.RawACLRecord") + proto.RegisterType((*ACLContentValue)(nil), "acl.ACLContentValue") + proto.RegisterType((*ACLData)(nil), "acl.ACLData") + proto.RegisterType((*ACLState)(nil), "acl.ACLState") + proto.RegisterMapType((map[string]*ACLUserInvite)(nil), "acl.ACLState.InvitesEntry") + proto.RegisterType((*ACLUserState)(nil), "acl.ACLUserState") + proto.RegisterType((*ACLUserAdd)(nil), "acl.ACLUserAdd") + proto.RegisterType((*ACLUserConfirm)(nil), "acl.ACLUserConfirm") + proto.RegisterType((*ACLUserInvite)(nil), "acl.ACLUserInvite") + proto.RegisterType((*ACLUserJoin)(nil), "acl.ACLUserJoin") + proto.RegisterType((*ACLUserRemove)(nil), "acl.ACLUserRemove") + proto.RegisterType((*ACLReadKeyReplace)(nil), "acl.ACLReadKeyReplace") + proto.RegisterType((*ACLUserPermissionChange)(nil), "acl.ACLUserPermissionChange") + proto.RegisterType((*ACLRecord)(nil), "acl.ACLRecord") + proto.RegisterType((*ACLHeader)(nil), "acl.ACLHeader") + proto.RegisterType((*RawTreeChange)(nil), "acl.RawTreeChange") + proto.RegisterType((*RawTreeChangeWithId)(nil), "acl.RawTreeChangeWithId") + proto.RegisterType((*TreeChange)(nil), "acl.TreeChange") + proto.RegisterType((*TreeHeader)(nil), "acl.TreeHeader") } func init() { @@ -1381,81 +1330,78 @@ func init() { } var fileDescriptor_37a022c841a51877 = []byte{ - // 1131 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x57, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xf7, 0xf8, 0xdf, 0x7a, 0xdf, 0x86, 0xc4, 0x4c, 0xab, 0xd6, 0xac, 0x8a, 0x6b, 0x99, 0x0a, - 0x59, 0x08, 0x9c, 0xca, 0x15, 0x52, 0x05, 0x28, 0x22, 0x49, 0x51, 0x6d, 0x92, 0x43, 0x35, 0xa1, - 0x20, 0xb8, 0x4d, 0x76, 0xa7, 0xc9, 0x2a, 0xf6, 0xee, 0xb2, 0x33, 0x49, 0xe5, 0x0b, 0x12, 0x27, - 0xae, 0x9c, 0x11, 0xe2, 0x43, 0x70, 0xe5, 0x0b, 0xf4, 0xd8, 0x23, 0x37, 0x50, 0x72, 0xe7, 0xc2, - 0x17, 0x40, 0xf3, 0x67, 0xd7, 0xeb, 0xf5, 0x26, 0x0a, 0x52, 0x84, 0xc4, 0x21, 0xd2, 0xcc, 0xef, - 0xfd, 0xde, 0xf8, 0xbd, 0xf7, 0x7b, 0xf3, 0x32, 0x0b, 0x0f, 0xe3, 0x93, 0xa3, 0x4d, 0xea, 0x4d, - 0xe5, 0x9f, 0x77, 0x4c, 0xc3, 0x23, 0xc6, 0xe5, 0x32, 0x3e, 0xdc, 0x8c, 0x93, 0x48, 0x44, 0x3c, - 0x87, 0x0f, 0x15, 0x82, 0x6b, 0xd4, 0x9b, 0xf6, 0x0f, 0xc0, 0x26, 0xf4, 0xe5, 0xae, 0x32, 0xe0, - 0x0e, 0x58, 0x31, 0x9d, 0x4f, 0x23, 0xea, 0x77, 0x50, 0x0f, 0x0d, 0xd6, 0x48, 0xba, 0xc5, 0xf7, - 0xc0, 0xe6, 0xc1, 0x51, 0x48, 0xc5, 0x69, 0xc2, 0x3a, 0x55, 0x65, 0x5b, 0x00, 0x78, 0x1d, 0xaa, - 0x81, 0xdf, 0xa9, 0xf5, 0xd0, 0xc0, 0x26, 0xd5, 0xc0, 0x37, 0x87, 0x12, 0xe6, 0x45, 0x89, 0x7f, - 0x63, 0x87, 0xfe, 0x7d, 0x0b, 0xec, 0xed, 0xdd, 0x7d, 0x13, 0x6a, 0x0f, 0x1c, 0x91, 0x30, 0x36, - 0x66, 0xd4, 0x9f, 0xf8, 0xbc, 0x83, 0x7a, 0xb5, 0x81, 0x4d, 0xf2, 0x10, 0xee, 0x02, 0x50, 0x6f, - 0x9a, 0x12, 0xaa, 0x8a, 0x90, 0x43, 0xf0, 0xbb, 0xb0, 0xce, 0x43, 0x1a, 0xf3, 0xe3, 0x48, 0xec, - 0x50, 0xce, 0x26, 0xe9, 0x6f, 0x15, 0x50, 0xfc, 0x10, 0x2c, 0xea, 0x4d, 0x9f, 0x50, 0x41, 0x3b, - 0xf5, 0x1e, 0x1a, 0x38, 0xa3, 0x3b, 0x43, 0xea, 0x4d, 0x87, 0x59, 0x28, 0x72, 0x25, 0xad, 0x24, - 0xa5, 0xc9, 0xd8, 0x4c, 0xa5, 0x95, 0x57, 0x43, 0x65, 0x96, 0x87, 0xf0, 0x10, 0xb0, 0x77, 0x9a, - 0x24, 0x2c, 0x14, 0x84, 0x51, 0x7f, 0x8f, 0xcd, 0xc7, 0x94, 0x1f, 0x77, 0x9a, 0x3d, 0x34, 0xa8, - 0x93, 0x12, 0x8b, 0xac, 0x94, 0x08, 0x66, 0x8c, 0x0b, 0x3a, 0x8b, 0x3b, 0x56, 0x0f, 0x0d, 0x6a, - 0x64, 0x01, 0x60, 0x17, 0x5a, 0x81, 0xcf, 0x42, 0x11, 0x88, 0x79, 0xa7, 0xa5, 0x72, 0xc8, 0xf6, - 0xee, 0x4f, 0x35, 0xd8, 0x90, 0xa1, 0x46, 0xa1, 0x60, 0xa1, 0xf8, 0x92, 0x4e, 0x4f, 0x19, 0x1e, - 0x81, 0x75, 0xca, 0x59, 0xb2, 0xed, 0x6b, 0x45, 0x56, 0x33, 0x7a, 0xae, 0xad, 0xe3, 0x0a, 0x49, - 0x89, 0xf8, 0x63, 0x00, 0xb9, 0x24, 0x6c, 0x16, 0x9d, 0x69, 0xb1, 0x9c, 0xd1, 0x5b, 0x25, 0x6e, - 0x9a, 0x30, 0xae, 0x90, 0x1c, 0x1d, 0x7f, 0x0d, 0xb7, 0xe5, 0xee, 0x19, 0x4b, 0x66, 0x01, 0xe7, - 0x41, 0x14, 0x6a, 0x07, 0x55, 0x70, 0x67, 0xf4, 0x4e, 0xc9, 0x31, 0x45, 0xea, 0xb8, 0x42, 0x4a, - 0x8f, 0x48, 0xe3, 0x9a, 0x84, 0x67, 0x81, 0x60, 0x46, 0xa0, 0xb2, 0xb8, 0x34, 0x21, 0x8d, 0x4b, - 0xef, 0xf0, 0x87, 0xd0, 0x92, 0xbb, 0xcf, 0xa3, 0x20, 0x54, 0x2a, 0x39, 0xa3, 0xbb, 0x25, 0xae, - 0xd2, 0x3c, 0xae, 0x90, 0x8c, 0x8a, 0xb7, 0xc0, 0x91, 0xeb, 0xdd, 0x28, 0x7c, 0x11, 0x24, 0x33, - 0x25, 0x9b, 0x33, 0x72, 0x4b, 0x3c, 0x0d, 0x63, 0x5c, 0x21, 0x79, 0x87, 0x1d, 0x0b, 0x1a, 0x67, - 0x52, 0x08, 0xf7, 0x07, 0x04, 0x96, 0xe9, 0x1e, 0xfc, 0x09, 0x38, 0xd4, 0x9b, 0x1e, 0x98, 0xde, - 0x33, 0xc2, 0xb8, 0xab, 0xad, 0x96, 0x32, 0x48, 0x9e, 0x8e, 0xb7, 0x54, 0xb3, 0x1b, 0x95, 0x55, - 0xb3, 0x3b, 0xa3, 0xee, 0xaa, 0x73, 0xbe, 0x0d, 0x48, 0xce, 0xc3, 0xdd, 0x01, 0x27, 0x77, 0x36, - 0x7e, 0x04, 0x2d, 0x79, 0xba, 0xa0, 0x82, 0x99, 0x48, 0xee, 0x96, 0x44, 0x22, 0xcd, 0x24, 0x23, - 0xba, 0xdf, 0x57, 0xa1, 0x95, 0xc2, 0xf8, 0x01, 0xbc, 0x91, 0x2c, 0x1a, 0x98, 0xe9, 0x1b, 0x5a, - 0x27, 0xcb, 0x20, 0x7e, 0xac, 0xd5, 0x53, 0x2e, 0xdc, 0x84, 0xdd, 0x29, 0x29, 0xa4, 0xfe, 0xa9, - 0x1c, 0x17, 0x6f, 0x81, 0x15, 0x28, 0x11, 0x79, 0xa7, 0xa6, 0xdc, 0x1e, 0x5c, 0x12, 0xe0, 0x50, - 0x6b, 0xcd, 0x3f, 0x0b, 0x45, 0x32, 0x27, 0xa9, 0x93, 0xfb, 0x1c, 0xd6, 0xf2, 0x06, 0xdc, 0x86, - 0xda, 0x09, 0x9b, 0xab, 0x64, 0x6d, 0x22, 0x97, 0x78, 0xd3, 0xa8, 0x74, 0x45, 0xb3, 0xeb, 0x13, - 0x88, 0xe6, 0x7d, 0x54, 0x7d, 0x8c, 0xdc, 0x3f, 0x10, 0xd8, 0x59, 0xc0, 0x4b, 0x17, 0x13, 0x2d, - 0x5f, 0x4c, 0x59, 0x20, 0x16, 0x7a, 0xc9, 0x3c, 0x16, 0x41, 0x14, 0xee, 0xb1, 0xb9, 0x19, 0x80, - 0xcb, 0x20, 0x7e, 0x1f, 0xde, 0x34, 0x00, 0xf3, 0xcd, 0x40, 0xd0, 0x09, 0xaf, 0x91, 0x55, 0x03, - 0xfe, 0x14, 0x9c, 0x38, 0xbb, 0x20, 0x5c, 0xdd, 0x86, 0xf5, 0x95, 0x36, 0x58, 0xbe, 0x5e, 0x9c, - 0xe4, 0x5d, 0xe4, 0xe8, 0x9a, 0x70, 0xd3, 0xa7, 0xcc, 0x57, 0x97, 0xa2, 0x45, 0xf2, 0x90, 0xfb, - 0x1b, 0x02, 0xcb, 0xcc, 0x87, 0xff, 0x5f, 0x7e, 0xee, 0x53, 0x70, 0x72, 0x17, 0xf3, 0xca, 0x04, - 0xee, 0x81, 0x6d, 0x86, 0xdf, 0xc4, 0x57, 0xc1, 0xdb, 0x64, 0x01, 0xb8, 0x7f, 0x21, 0x80, 0x45, - 0x0b, 0xe0, 0x01, 0x6c, 0x50, 0xcf, 0x63, 0xb1, 0x78, 0x76, 0x7a, 0x38, 0x0d, 0xbc, 0x3d, 0xd3, - 0x4a, 0x6b, 0xa4, 0x08, 0xe3, 0xf7, 0xa0, 0x6d, 0x12, 0x5b, 0x50, 0x75, 0x69, 0x56, 0xf0, 0xff, - 0x5c, 0x7d, 0x17, 0x5a, 0x3a, 0x9f, 0x89, 0x96, 0xde, 0x26, 0xd9, 0xde, 0x7d, 0x85, 0xa0, 0x95, - 0x4e, 0xc3, 0x1b, 0x10, 0x3e, 0x2b, 0xd8, 0x41, 0xf6, 0x02, 0xa8, 0xe5, 0x0b, 0x96, 0xc1, 0xb8, - 0x0f, 0x6b, 0x8b, 0x91, 0x3d, 0xf1, 0x55, 0x5e, 0x36, 0x59, 0xc2, 0xca, 0x0b, 0xd5, 0xb8, 0xa4, - 0x50, 0xee, 0xb7, 0x5a, 0x3a, 0xf3, 0xcf, 0xe9, 0xaa, 0x5c, 0x9e, 0xc2, 0x86, 0x19, 0x58, 0x84, - 0xc5, 0x53, 0xea, 0x65, 0xd3, 0xe6, 0xed, 0x42, 0x59, 0xc9, 0x12, 0x8b, 0x14, 0xbd, 0xdc, 0xef, - 0x60, 0x7d, 0x99, 0x72, 0x03, 0x25, 0x5c, 0x74, 0x52, 0x96, 0x9b, 0xa9, 0xe1, 0x0a, 0xee, 0x0a, - 0xb8, 0x5d, 0xf6, 0x6f, 0xf5, 0xca, 0x28, 0x0a, 0xfd, 0x54, 0xfd, 0xd7, 0xfd, 0xd4, 0xdf, 0x86, - 0x8d, 0x82, 0x1d, 0xdb, 0xd0, 0xd8, 0xf6, 0x67, 0x41, 0xd8, 0xae, 0x60, 0x80, 0xe6, 0x57, 0x49, - 0x20, 0x58, 0xd2, 0x46, 0x72, 0x2d, 0x43, 0x65, 0x49, 0xbb, 0x8a, 0x1d, 0xb0, 0xb4, 0x34, 0x7e, - 0xbb, 0xd6, 0xff, 0xb9, 0x0a, 0xcd, 0x6b, 0x3f, 0xf9, 0xee, 0x81, 0x9d, 0x3d, 0xf0, 0xd2, 0x2b, - 0x9b, 0x01, 0xd7, 0x7e, 0xf0, 0x15, 0x9e, 0x6f, 0xf5, 0xeb, 0x3e, 0xdf, 0x1a, 0xd7, 0x7b, 0xbe, - 0x35, 0xaf, 0x7a, 0xbe, 0x59, 0x05, 0x0d, 0xba, 0x00, 0x01, 0xcf, 0x1e, 0x05, 0x2d, 0x35, 0x8e, - 0x73, 0x48, 0xff, 0x17, 0x24, 0x0b, 0xa7, 0xde, 0xd9, 0x77, 0xa0, 0x19, 0x27, 0xec, 0x6c, 0xe2, - 0x1b, 0x21, 0xcd, 0x6e, 0xe9, 0xf8, 0x6a, 0xe1, 0x78, 0x0c, 0x75, 0x5f, 0xe6, 0xa8, 0xdb, 0x46, - 0xad, 0x2f, 0x49, 0xae, 0x7e, 0xbd, 0xe4, 0x1a, 0x85, 0xe4, 0xfa, 0xbf, 0x22, 0x68, 0x8e, 0x95, - 0xb2, 0xf2, 0x43, 0xe0, 0x45, 0x90, 0x70, 0x91, 0x45, 0x98, 0x6e, 0x8d, 0x6e, 0xfb, 0x81, 0xb2, - 0x2d, 0x74, 0xd3, 0x80, 0xd4, 0xe3, 0x65, 0x94, 0x9c, 0xf0, 0x98, 0x7a, 0x0b, 0xd1, 0xf2, 0x10, - 0xfe, 0x00, 0x2c, 0x3f, 0xf2, 0xbe, 0x98, 0xc7, 0xcc, 0x4c, 0xbd, 0x5b, 0xaa, 0x4b, 0xf5, 0xef, - 0x0e, 0x9f, 0x68, 0x13, 0x49, 0x39, 0xfd, 0xfb, 0x60, 0x19, 0x0c, 0x5b, 0x50, 0xdb, 0xde, 0xdd, - 0x6f, 0x57, 0x64, 0xd3, 0x49, 0x2c, 0x61, 0xac, 0x8d, 0x76, 0xee, 0xbf, 0x3a, 0xef, 0xa2, 0xd7, - 0xe7, 0x5d, 0xf4, 0xe7, 0x79, 0x17, 0xfd, 0x78, 0xd1, 0xad, 0xbc, 0xbe, 0xe8, 0x56, 0x7e, 0xbf, - 0xe8, 0x56, 0xbe, 0x69, 0xa8, 0x4f, 0xaa, 0xc3, 0xa6, 0xfa, 0x82, 0x7a, 0xf4, 0x4f, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x14, 0x6d, 0xee, 0xf8, 0x75, 0x0d, 0x00, 0x00, + // 1078 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0xcd, 0x6e, 0x23, 0x45, + 0x10, 0xf6, 0x8c, 0xe3, 0x38, 0x2e, 0x3b, 0x8e, 0xd3, 0x1b, 0xed, 0x8e, 0xa2, 0xc8, 0x44, 0x23, + 0x04, 0x51, 0x40, 0x5e, 0x08, 0x2b, 0xf1, 0x77, 0x00, 0xc7, 0x8b, 0xb0, 0x37, 0x11, 0xac, 0x3a, + 0x61, 0x57, 0xe2, 0xd6, 0x99, 0xe9, 0x4d, 0x9a, 0xb5, 0x67, 0x46, 0xd3, 0x9d, 0x44, 0x3e, 0xf2, + 0x06, 0x3c, 0x02, 0x1c, 0x79, 0x02, 0x5e, 0x01, 0x89, 0xcb, 0x1e, 0x91, 0xb8, 0xa0, 0xe4, 0x04, + 0x27, 0x1e, 0x01, 0xf5, 0xcf, 0xcc, 0xf4, 0xd8, 0x4e, 0xf8, 0xd1, 0x0a, 0x89, 0xc3, 0x48, 0xdd, + 0x5f, 0x55, 0x75, 0x57, 0x7d, 0x55, 0x53, 0x5d, 0xf0, 0x56, 0xf2, 0xfc, 0xf4, 0x3e, 0x09, 0xc6, + 0xf2, 0x0b, 0xce, 0x48, 0x74, 0x4a, 0xb9, 0x5c, 0x26, 0x27, 0xf7, 0x93, 0x34, 0x16, 0x31, 0xb7, + 0xf0, 0x9e, 0x42, 0x50, 0x95, 0x04, 0x63, 0xff, 0x09, 0xb4, 0x30, 0xb9, 0xec, 0x0f, 0x0e, 0x31, + 0x0d, 0xe2, 0x34, 0x44, 0x1e, 0xd4, 0x13, 0x32, 0x1d, 0xc7, 0x24, 0xf4, 0x9c, 0x6d, 0x67, 0xa7, + 0x85, 0xb3, 0x2d, 0xda, 0x82, 0x06, 0x67, 0xa7, 0x11, 0x11, 0xe7, 0x29, 0xf5, 0x5c, 0x25, 0x2b, + 0x00, 0xd4, 0x06, 0x97, 0x85, 0x5e, 0x75, 0xdb, 0xd9, 0x69, 0x60, 0x97, 0x85, 0xfe, 0x1f, 0x2e, + 0xac, 0xf5, 0x07, 0x87, 0x83, 0x38, 0x12, 0x34, 0x12, 0x4f, 0xc8, 0xf8, 0x9c, 0xa2, 0x37, 0xa0, + 0x7e, 0xce, 0x69, 0xda, 0x0f, 0xf5, 0xd9, 0xcd, 0xbd, 0xb5, 0x1e, 0x09, 0xc6, 0xbd, 0xfe, 0xe0, + 0xf0, 0x0b, 0x0d, 0x0f, 0x2b, 0x38, 0xd3, 0x40, 0x0f, 0x00, 0xe4, 0x12, 0xd3, 0x49, 0x7c, 0xa1, + 0xef, 0x6b, 0xee, 0x21, 0x5b, 0x5f, 0x4b, 0x86, 0x15, 0x6c, 0xe9, 0x21, 0x0c, 0x1b, 0x72, 0xf7, + 0x98, 0xa6, 0x13, 0xc6, 0x39, 0x8b, 0xa3, 0x81, 0x0a, 0x59, 0x39, 0xd6, 0xdc, 0xdb, 0xb2, 0xed, + 0x67, 0x75, 0x86, 0x15, 0xbc, 0xd0, 0x36, 0xf3, 0x64, 0x14, 0x5d, 0x30, 0x41, 0xbd, 0xa5, 0x79, + 0x4f, 0xb4, 0x24, 0xf3, 0x44, 0xef, 0x50, 0x0f, 0x56, 0xe4, 0xee, 0x51, 0xcc, 0x22, 0xaf, 0xa6, + 0x6c, 0x3a, 0xb6, 0x8d, 0xc4, 0x87, 0x15, 0x9c, 0xeb, 0xa0, 0x77, 0xa1, 0x29, 0xd7, 0x83, 0x38, + 0x7a, 0xc6, 0xd2, 0x89, 0xb7, 0xac, 0x4c, 0xee, 0xd8, 0x26, 0x46, 0x34, 0xac, 0x60, 0x5b, 0x73, + 0xbf, 0x0e, 0xb5, 0x0b, 0x49, 0xaf, 0xff, 0x11, 0xd4, 0xfb, 0x83, 0xc3, 0x87, 0x44, 0x10, 0xe9, + 0x32, 0x09, 0xc6, 0x86, 0x7c, 0xcf, 0xd9, 0xae, 0xee, 0x34, 0xf7, 0x36, 0xb2, 0xb3, 0xec, 0x9c, + 0x60, 0x4b, 0xcf, 0xff, 0xcd, 0x81, 0x95, 0xfe, 0xe0, 0xf0, 0x48, 0x10, 0x41, 0xd1, 0xab, 0xb0, + 0x9a, 0x52, 0x12, 0x1e, 0xd0, 0xe9, 0x90, 0xf0, 0x33, 0xca, 0xd5, 0x29, 0x4b, 0xb8, 0x0c, 0xa2, + 0xb7, 0x35, 0x37, 0xca, 0x84, 0x7b, 0xae, 0xba, 0x68, 0xdd, 0x76, 0x5a, 0x49, 0xb0, 0xa5, 0x84, + 0x1e, 0x40, 0x9d, 0x29, 0x8a, 0xb8, 0x57, 0x55, 0xfa, 0x9b, 0x99, 0xbe, 0x52, 0xe8, 0x69, 0xfe, + 0xf8, 0x27, 0x91, 0x48, 0xa7, 0x38, 0x53, 0xdd, 0xfc, 0x0c, 0x5a, 0xb6, 0x00, 0x75, 0xa0, 0xfa, + 0x9c, 0x4e, 0x55, 0x1d, 0x35, 0xb0, 0x5c, 0xa2, 0x1d, 0xc3, 0xc3, 0xa2, 0x5a, 0xd1, 0xa6, 0x58, + 0x2b, 0x7c, 0xe0, 0xbe, 0xe7, 0xf8, 0xbf, 0x38, 0xd0, 0xb2, 0x5d, 0x44, 0x9b, 0xb0, 0xc2, 0x42, + 0x1a, 0x09, 0x26, 0xa6, 0xa6, 0xf2, 0xf3, 0xbd, 0xe4, 0x82, 0x46, 0x41, 0x3a, 0x4d, 0x04, 0x8b, + 0xa3, 0x03, 0x3a, 0x35, 0xe5, 0x5f, 0x06, 0xd1, 0x9b, 0xb0, 0x6e, 0x00, 0x1a, 0x62, 0xcd, 0x92, + 0x0e, 0xb1, 0x85, 0xe7, 0x05, 0xe8, 0x7d, 0x68, 0x26, 0x79, 0xa5, 0x71, 0x55, 0x56, 0xed, 0xbd, + 0x7b, 0x8b, 0x0b, 0x94, 0x63, 0x5b, 0x17, 0x6d, 0x43, 0x93, 0x71, 0x93, 0x7e, 0x1a, 0xaa, 0xea, + 0x5a, 0xc1, 0x36, 0xe4, 0xff, 0xe0, 0x00, 0x14, 0xbf, 0xd5, 0xff, 0x28, 0x36, 0xff, 0x11, 0xb4, + 0xcb, 0xe5, 0x7e, 0xab, 0xf3, 0x5b, 0xd0, 0x30, 0xfd, 0x62, 0x14, 0x2a, 0xc7, 0x1b, 0xb8, 0x00, + 0xfc, 0xdf, 0x1d, 0x58, 0x2d, 0x15, 0x00, 0xda, 0x81, 0x35, 0x12, 0x04, 0x34, 0x11, 0x8f, 0xcf, + 0x4f, 0xc6, 0x2c, 0x38, 0xa0, 0xd9, 0x91, 0xb3, 0x30, 0xda, 0x85, 0x8e, 0x89, 0xab, 0x50, 0xd5, + 0xcc, 0xcc, 0xe1, 0xff, 0x5d, 0xe2, 0x25, 0x15, 0x2a, 0x90, 0x91, 0xce, 0x7a, 0x03, 0xe7, 0x7b, + 0xff, 0x27, 0x07, 0x9a, 0x56, 0x6f, 0x79, 0x09, 0x39, 0xcf, 0xc9, 0x3a, 0xca, 0xdb, 0x7e, 0xd5, + 0x26, 0x2b, 0x87, 0x91, 0x0f, 0xad, 0xa2, 0xf3, 0x8d, 0x42, 0x15, 0x53, 0x03, 0x97, 0xb0, 0xc5, + 0x24, 0xd5, 0x6e, 0x20, 0xc9, 0x9f, 0xe4, 0x99, 0x33, 0x8d, 0xfd, 0xb6, 0x70, 0x3e, 0x86, 0x35, + 0xd3, 0x95, 0x30, 0x4d, 0xc6, 0x24, 0xc8, 0x3b, 0xcb, 0xdd, 0x8c, 0x55, 0x5c, 0x12, 0xe3, 0x59, + 0x75, 0xff, 0x6b, 0x07, 0xd6, 0xe7, 0xd4, 0x5e, 0x02, 0x85, 0x45, 0x15, 0xe5, 0xb1, 0x19, 0x0e, + 0xe7, 0x70, 0x3f, 0x81, 0x7b, 0x37, 0xbc, 0x4c, 0xb7, 0x3a, 0x32, 0x53, 0x4e, 0xee, 0x3f, 0xf8, + 0xd7, 0xbe, 0x73, 0xa0, 0x51, 0xbc, 0xfc, 0x77, 0x61, 0x39, 0x49, 0xe9, 0xc5, 0x28, 0x34, 0x4d, + 0xd5, 0xec, 0x4a, 0x97, 0xbb, 0x33, 0x97, 0x23, 0x58, 0x0a, 0x89, 0x20, 0x26, 0x26, 0xb5, 0x46, + 0x3d, 0x40, 0xc1, 0x79, 0x9a, 0xd2, 0x48, 0xe0, 0xe2, 0xa9, 0x50, 0x25, 0xb1, 0x84, 0x17, 0x48, + 0xe4, 0x3f, 0x2c, 0xd8, 0x84, 0x72, 0x41, 0x26, 0x89, 0xaa, 0xea, 0x2a, 0x2e, 0x00, 0xbf, 0xaf, + 0x5c, 0x1c, 0x52, 0x12, 0xd2, 0x54, 0x0e, 0x27, 0xcf, 0x58, 0xca, 0x45, 0xee, 0x63, 0xb6, 0xbd, + 0xcd, 0x49, 0xff, 0x53, 0x58, 0xc5, 0xe4, 0xf2, 0x38, 0xa5, 0xd4, 0xd0, 0xf9, 0x2f, 0x67, 0x1c, + 0x7f, 0x00, 0x77, 0x4a, 0x07, 0x3d, 0x65, 0xe2, 0x6c, 0xa4, 0x8c, 0x52, 0x72, 0x69, 0x06, 0x0d, + 0x7d, 0x60, 0x01, 0x98, 0xc1, 0xc8, 0xcd, 0x07, 0xa3, 0x6f, 0x5d, 0x00, 0xcb, 0x97, 0x6d, 0x68, + 0x8a, 0x94, 0x52, 0x19, 0xe0, 0x28, 0xd4, 0x8f, 0x6c, 0x03, 0xdb, 0x90, 0x3c, 0x9e, 0x04, 0x63, + 0xbd, 0xcb, 0x7a, 0x5c, 0x0e, 0xa0, 0xd7, 0xa0, 0xcd, 0x23, 0x92, 0xf0, 0xb3, 0x58, 0xec, 0x13, + 0x2e, 0x7f, 0x3e, 0x3d, 0x83, 0xcd, 0xa0, 0xf2, 0x1e, 0x33, 0xfd, 0xc9, 0x01, 0x41, 0xa5, 0xa3, + 0x85, 0x6d, 0xe8, 0x86, 0xbc, 0xd5, 0xfe, 0x5e, 0xde, 0x96, 0x67, 0xf2, 0x56, 0x4a, 0x48, 0x7d, + 0xa6, 0x6a, 0xba, 0x00, 0x8c, 0x1f, 0x19, 0xff, 0xbc, 0x15, 0xf5, 0x7c, 0x59, 0x88, 0xff, 0xbd, + 0xa3, 0x29, 0xfa, 0xcb, 0xac, 0x6f, 0x40, 0x8d, 0x04, 0xe3, 0x9c, 0x16, 0xbd, 0x41, 0x1f, 0x42, + 0x5b, 0xe4, 0xd6, 0xc7, 0xd3, 0x44, 0xb7, 0xad, 0xb6, 0x19, 0xa6, 0x8e, 0x4b, 0x22, 0x3c, 0xa3, + 0x5a, 0xf2, 0x7b, 0xe9, 0x86, 0x6a, 0xaf, 0x15, 0xd5, 0xbe, 0xfb, 0x10, 0xd0, 0xfc, 0x6f, 0x86, + 0x1a, 0x50, 0xeb, 0x87, 0x13, 0x16, 0x75, 0x2a, 0x08, 0x60, 0xf9, 0x69, 0xca, 0x04, 0x4d, 0x3b, + 0x8e, 0x5c, 0x63, 0x75, 0x55, 0xc7, 0x45, 0x4d, 0xa8, 0xeb, 0xd6, 0x16, 0x76, 0xaa, 0xbb, 0xaf, + 0x43, 0xbb, 0xec, 0x97, 0x54, 0xfd, 0xfc, 0xe4, 0x2b, 0x1a, 0x88, 0x4e, 0x45, 0x9e, 0x76, 0x94, + 0x90, 0x80, 0x76, 0x9c, 0xfd, 0x57, 0x7e, 0xbc, 0xea, 0x3a, 0x2f, 0xae, 0xba, 0xce, 0xaf, 0x57, + 0x5d, 0xe7, 0x9b, 0xeb, 0x6e, 0xe5, 0xc5, 0x75, 0xb7, 0xf2, 0xf3, 0x75, 0xb7, 0xf2, 0x65, 0x4d, + 0x0d, 0xfb, 0x27, 0xcb, 0x6a, 0xb6, 0x7f, 0xe7, 0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8c, 0x25, + 0x31, 0x18, 0x0f, 0x0c, 0x00, 0x00, } -func (m *RawChange) Marshal() (dAtA []byte, err error) { +func (m *RawACLRecord) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1465,12 +1411,12 @@ func (m *RawChange) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *RawChange) MarshalTo(dAtA []byte) (int, error) { +func (m *RawACLRecord) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *RawChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *RawACLRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1499,7 +1445,7 @@ func (m *RawChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *RawRecord) Marshal() (dAtA []byte, err error) { +func (m *ACLContentValue) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1509,140 +1455,12 @@ func (m *RawRecord) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *RawRecord) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLContentValue) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *RawRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintAclchanges(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0x1a - } - if len(m.Signature) > 0 { - i -= len(m.Signature) - copy(dAtA[i:], m.Signature) - i = encodeVarintAclchanges(dAtA, i, uint64(len(m.Signature))) - i-- - dAtA[i] = 0x12 - } - if len(m.Payload) > 0 { - i -= len(m.Payload) - copy(dAtA[i:], m.Payload) - i = encodeVarintAclchanges(dAtA, i, uint64(len(m.Payload))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ACLChange) 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 *ACLChange) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ACLChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Identity) > 0 { - i -= len(m.Identity) - copy(dAtA[i:], m.Identity) - i = encodeVarintAclchanges(dAtA, i, uint64(len(m.Identity))) - i-- - dAtA[i] = 0x42 - } - if m.Timestamp != 0 { - i = encodeVarintAclchanges(dAtA, i, uint64(m.Timestamp)) - i-- - dAtA[i] = 0x38 - } - if m.CurrentReadKeyHash != 0 { - i = encodeVarintAclchanges(dAtA, i, uint64(m.CurrentReadKeyHash)) - i-- - dAtA[i] = 0x30 - } - if len(m.ChangesData) > 0 { - i -= len(m.ChangesData) - copy(dAtA[i:], m.ChangesData) - i = encodeVarintAclchanges(dAtA, i, uint64(len(m.ChangesData))) - i-- - dAtA[i] = 0x2a - } - if m.AclData != nil { - { - size, err := m.AclData.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAclchanges(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if len(m.SnapshotBaseId) > 0 { - i -= len(m.SnapshotBaseId) - copy(dAtA[i:], m.SnapshotBaseId) - i = encodeVarintAclchanges(dAtA, i, uint64(len(m.SnapshotBaseId))) - i-- - dAtA[i] = 0x1a - } - if len(m.AclHeadIds) > 0 { - for iNdEx := len(m.AclHeadIds) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.AclHeadIds[iNdEx]) - copy(dAtA[i:], m.AclHeadIds[iNdEx]) - i = encodeVarintAclchanges(dAtA, i, uint64(len(m.AclHeadIds[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.TreeHeadIds) > 0 { - for iNdEx := len(m.TreeHeadIds) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.TreeHeadIds[iNdEx]) - copy(dAtA[i:], m.TreeHeadIds[iNdEx]) - i = encodeVarintAclchanges(dAtA, i, uint64(len(m.TreeHeadIds[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *ACLChangeACLContentValue) 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 *ACLChangeACLContentValue) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ACLChangeACLContentValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLContentValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1659,12 +1477,12 @@ func (m *ACLChangeACLContentValue) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *ACLChangeACLContentValueValueOfUserAdd) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLContentValue_UserAdd) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChangeACLContentValueValueOfUserAdd) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLContentValue_UserAdd) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) if m.UserAdd != nil { { @@ -1680,12 +1498,12 @@ func (m *ACLChangeACLContentValueValueOfUserAdd) MarshalToSizedBuffer(dAtA []byt } return len(dAtA) - i, nil } -func (m *ACLChangeACLContentValueValueOfUserRemove) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLContentValue_UserRemove) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChangeACLContentValueValueOfUserRemove) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLContentValue_UserRemove) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) if m.UserRemove != nil { { @@ -1701,12 +1519,12 @@ func (m *ACLChangeACLContentValueValueOfUserRemove) MarshalToSizedBuffer(dAtA [] } return len(dAtA) - i, nil } -func (m *ACLChangeACLContentValueValueOfUserPermissionChange) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLContentValue_UserPermissionChange) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChangeACLContentValueValueOfUserPermissionChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLContentValue_UserPermissionChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) if m.UserPermissionChange != nil { { @@ -1722,12 +1540,12 @@ func (m *ACLChangeACLContentValueValueOfUserPermissionChange) MarshalToSizedBuff } return len(dAtA) - i, nil } -func (m *ACLChangeACLContentValueValueOfUserInvite) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLContentValue_UserInvite) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChangeACLContentValueValueOfUserInvite) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLContentValue_UserInvite) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) if m.UserInvite != nil { { @@ -1743,12 +1561,12 @@ func (m *ACLChangeACLContentValueValueOfUserInvite) MarshalToSizedBuffer(dAtA [] } return len(dAtA) - i, nil } -func (m *ACLChangeACLContentValueValueOfUserJoin) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLContentValue_UserJoin) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChangeACLContentValueValueOfUserJoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLContentValue_UserJoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) if m.UserJoin != nil { { @@ -1764,12 +1582,12 @@ func (m *ACLChangeACLContentValueValueOfUserJoin) MarshalToSizedBuffer(dAtA []by } return len(dAtA) - i, nil } -func (m *ACLChangeACLContentValueValueOfUserConfirm) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLContentValue_UserConfirm) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChangeACLContentValueValueOfUserConfirm) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLContentValue_UserConfirm) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) if m.UserConfirm != nil { { @@ -1785,7 +1603,7 @@ func (m *ACLChangeACLContentValueValueOfUserConfirm) MarshalToSizedBuffer(dAtA [ } return len(dAtA) - i, nil } -func (m *ACLChangeACLData) Marshal() (dAtA []byte, err error) { +func (m *ACLData) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1795,12 +1613,12 @@ func (m *ACLChangeACLData) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ACLChangeACLData) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLData) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChangeACLData) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLData) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1816,25 +1634,13 @@ func (m *ACLChangeACLData) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintAclchanges(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 + dAtA[i] = 0xa } } - if m.AclSnapshot != nil { - { - size, err := m.AclSnapshot.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAclchanges(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } return len(dAtA) - i, nil } -func (m *ACLChangeACLSnapshot) Marshal() (dAtA []byte, err error) { +func (m *ACLState) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1844,47 +1650,12 @@ func (m *ACLChangeACLSnapshot) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ACLChangeACLSnapshot) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLState) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChangeACLSnapshot) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.AclState != nil { - { - size, err := m.AclState.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAclchanges(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ACLChangeACLState) 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 *ACLChangeACLState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ACLChangeACLState) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1930,27 +1701,27 @@ func (m *ACLChangeACLState) MarshalToSizedBuffer(dAtA []byte) (int, error) { } } if len(m.ReadKeyHashes) > 0 { - dAtA12 := make([]byte, len(m.ReadKeyHashes)*10) - var j11 int + dAtA9 := make([]byte, len(m.ReadKeyHashes)*10) + var j8 int for _, num := range m.ReadKeyHashes { for num >= 1<<7 { - dAtA12[j11] = uint8(uint64(num)&0x7f | 0x80) + dAtA9[j8] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j11++ + j8++ } - dAtA12[j11] = uint8(num) - j11++ + dAtA9[j8] = uint8(num) + j8++ } - i -= j11 - copy(dAtA[i:], dAtA12[:j11]) - i = encodeVarintAclchanges(dAtA, i, uint64(j11)) + i -= j8 + copy(dAtA[i:], dAtA9[:j8]) + i = encodeVarintAclchanges(dAtA, i, uint64(j8)) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *ACLChangeUserState) Marshal() (dAtA []byte, err error) { +func (m *ACLUserState) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1960,12 +1731,12 @@ func (m *ACLChangeUserState) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ACLChangeUserState) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLUserState) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChangeUserState) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLUserState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2011,7 +1782,7 @@ func (m *ACLChangeUserState) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ACLChangeUserAdd) Marshal() (dAtA []byte, err error) { +func (m *ACLUserAdd) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2021,12 +1792,12 @@ func (m *ACLChangeUserAdd) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ACLChangeUserAdd) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLUserAdd) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChangeUserAdd) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLUserAdd) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2062,7 +1833,7 @@ func (m *ACLChangeUserAdd) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ACLChangeUserConfirm) Marshal() (dAtA []byte, err error) { +func (m *ACLUserConfirm) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2072,12 +1843,12 @@ func (m *ACLChangeUserConfirm) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ACLChangeUserConfirm) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLUserConfirm) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChangeUserConfirm) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLUserConfirm) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2099,7 +1870,7 @@ func (m *ACLChangeUserConfirm) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ACLChangeUserInvite) Marshal() (dAtA []byte, err error) { +func (m *ACLUserInvite) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2109,12 +1880,12 @@ func (m *ACLChangeUserInvite) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ACLChangeUserInvite) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLUserInvite) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChangeUserInvite) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLUserInvite) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2157,7 +1928,7 @@ func (m *ACLChangeUserInvite) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ACLChangeUserJoin) Marshal() (dAtA []byte, err error) { +func (m *ACLUserJoin) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2167,12 +1938,12 @@ func (m *ACLChangeUserJoin) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ACLChangeUserJoin) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLUserJoin) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChangeUserJoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLUserJoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2217,7 +1988,7 @@ func (m *ACLChangeUserJoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ACLChangeUserRemove) Marshal() (dAtA []byte, err error) { +func (m *ACLUserRemove) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2227,12 +1998,12 @@ func (m *ACLChangeUserRemove) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ACLChangeUserRemove) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLUserRemove) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChangeUserRemove) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLUserRemove) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2261,7 +2032,7 @@ func (m *ACLChangeUserRemove) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ACLChangeReadKeyReplace) Marshal() (dAtA []byte, err error) { +func (m *ACLReadKeyReplace) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2271,12 +2042,12 @@ func (m *ACLChangeReadKeyReplace) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ACLChangeReadKeyReplace) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLReadKeyReplace) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChangeReadKeyReplace) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLReadKeyReplace) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2305,7 +2076,7 @@ func (m *ACLChangeReadKeyReplace) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *ACLChangeUserPermissionChange) Marshal() (dAtA []byte, err error) { +func (m *ACLUserPermissionChange) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2315,12 +2086,12 @@ func (m *ACLChangeUserPermissionChange) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ACLChangeUserPermissionChange) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLUserPermissionChange) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChangeUserPermissionChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLUserPermissionChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2340,7 +2111,7 @@ func (m *ACLChangeUserPermissionChange) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *Change) Marshal() (dAtA []byte, err error) { +func (m *ACLRecord) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2350,12 +2121,177 @@ func (m *Change) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Change) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLRecord) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Change) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Timestamp != 0 { + i = encodeVarintAclchanges(dAtA, i, uint64(m.Timestamp)) + i-- + dAtA[i] = 0x28 + } + if m.CurrentReadKeyHash != 0 { + i = encodeVarintAclchanges(dAtA, i, uint64(m.CurrentReadKeyHash)) + i-- + dAtA[i] = 0x20 + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintAclchanges(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x1a + } + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintAclchanges(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0x12 + } + if len(m.PrevId) > 0 { + i -= len(m.PrevId) + copy(dAtA[i:], m.PrevId) + i = encodeVarintAclchanges(dAtA, i, uint64(len(m.PrevId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ACLHeader) 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 *ACLHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ACLHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintAclchanges(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0x12 + } + if len(m.FirstId) > 0 { + i -= len(m.FirstId) + copy(dAtA[i:], m.FirstId) + i = encodeVarintAclchanges(dAtA, i, uint64(len(m.FirstId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *RawTreeChange) 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 *RawTreeChange) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RawTreeChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintAclchanges(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x12 + } + if len(m.Payload) > 0 { + i -= len(m.Payload) + copy(dAtA[i:], m.Payload) + i = encodeVarintAclchanges(dAtA, i, uint64(len(m.Payload))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *RawTreeChangeWithId) 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 *RawTreeChangeWithId) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RawTreeChangeWithId) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintAclchanges(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0x12 + } + if len(m.RawChange) > 0 { + i -= len(m.RawChange) + copy(dAtA[i:], m.RawChange) + i = encodeVarintAclchanges(dAtA, i, uint64(len(m.RawChange))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TreeChange) 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 *TreeChange) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TreeChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2420,7 +2356,7 @@ func (m *Change) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Record) Marshal() (dAtA []byte, err error) { +func (m *TreeHeader) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2430,86 +2366,39 @@ func (m *Record) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Record) MarshalTo(dAtA []byte) (int, error) { +func (m *TreeHeader) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Record) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *TreeHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Timestamp != 0 { - i = encodeVarintAclchanges(dAtA, i, uint64(m.Timestamp)) - i-- - dAtA[i] = 0x28 - } - if m.CurrentReadKeyHash != 0 { - i = encodeVarintAclchanges(dAtA, i, uint64(m.CurrentReadKeyHash)) - i-- - dAtA[i] = 0x20 - } if len(m.Data) > 0 { i -= len(m.Data) copy(dAtA[i:], m.Data) i = encodeVarintAclchanges(dAtA, i, uint64(len(m.Data))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x2a } if len(m.Identity) > 0 { i -= len(m.Identity) copy(dAtA[i:], m.Identity) i = encodeVarintAclchanges(dAtA, i, uint64(len(m.Identity))) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x22 } - if len(m.PrevId) > 0 { - i -= len(m.PrevId) - copy(dAtA[i:], m.PrevId) - i = encodeVarintAclchanges(dAtA, i, uint64(len(m.PrevId))) + if m.TreeHeaderType != 0 { + i = encodeVarintAclchanges(dAtA, i, uint64(m.TreeHeaderType)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x18 } - return len(dAtA) - i, nil -} - -func (m *Header) 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 *Header) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.DocType != 0 { - i = encodeVarintAclchanges(dAtA, i, uint64(m.DocType)) - i-- - dAtA[i] = 0x20 - } - if len(m.WorkspaceId) > 0 { - i -= len(m.WorkspaceId) - copy(dAtA[i:], m.WorkspaceId) - i = encodeVarintAclchanges(dAtA, i, uint64(len(m.WorkspaceId))) - i-- - dAtA[i] = 0x1a - } - if len(m.AclListId) > 0 { - i -= len(m.AclListId) - copy(dAtA[i:], m.AclListId) - i = encodeVarintAclchanges(dAtA, i, uint64(len(m.AclListId))) + if len(m.AclId) > 0 { + i -= len(m.AclId) + copy(dAtA[i:], m.AclId) + i = encodeVarintAclchanges(dAtA, i, uint64(len(m.AclId))) i-- dAtA[i] = 0x12 } @@ -2534,7 +2423,7 @@ func encodeVarintAclchanges(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *RawChange) Size() (n int) { +func (m *RawACLRecord) Size() (n int) { if m == nil { return 0 } @@ -2555,71 +2444,7 @@ func (m *RawChange) Size() (n int) { return n } -func (m *RawRecord) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Payload) - if l > 0 { - n += 1 + l + sovAclchanges(uint64(l)) - } - l = len(m.Signature) - if l > 0 { - n += 1 + l + sovAclchanges(uint64(l)) - } - l = len(m.Id) - if l > 0 { - n += 1 + l + sovAclchanges(uint64(l)) - } - return n -} - -func (m *ACLChange) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.TreeHeadIds) > 0 { - for _, s := range m.TreeHeadIds { - l = len(s) - n += 1 + l + sovAclchanges(uint64(l)) - } - } - if len(m.AclHeadIds) > 0 { - for _, s := range m.AclHeadIds { - l = len(s) - n += 1 + l + sovAclchanges(uint64(l)) - } - } - l = len(m.SnapshotBaseId) - if l > 0 { - n += 1 + l + sovAclchanges(uint64(l)) - } - if m.AclData != nil { - l = m.AclData.Size() - n += 1 + l + sovAclchanges(uint64(l)) - } - l = len(m.ChangesData) - if l > 0 { - n += 1 + l + sovAclchanges(uint64(l)) - } - if m.CurrentReadKeyHash != 0 { - n += 1 + sovAclchanges(uint64(m.CurrentReadKeyHash)) - } - if m.Timestamp != 0 { - n += 1 + sovAclchanges(uint64(m.Timestamp)) - } - l = len(m.Identity) - if l > 0 { - n += 1 + l + sovAclchanges(uint64(l)) - } - return n -} - -func (m *ACLChangeACLContentValue) Size() (n int) { +func (m *ACLContentValue) Size() (n int) { if m == nil { return 0 } @@ -2631,7 +2456,7 @@ func (m *ACLChangeACLContentValue) Size() (n int) { return n } -func (m *ACLChangeACLContentValueValueOfUserAdd) Size() (n int) { +func (m *ACLContentValue_UserAdd) Size() (n int) { if m == nil { return 0 } @@ -2643,7 +2468,7 @@ func (m *ACLChangeACLContentValueValueOfUserAdd) Size() (n int) { } return n } -func (m *ACLChangeACLContentValueValueOfUserRemove) Size() (n int) { +func (m *ACLContentValue_UserRemove) Size() (n int) { if m == nil { return 0 } @@ -2655,7 +2480,7 @@ func (m *ACLChangeACLContentValueValueOfUserRemove) Size() (n int) { } return n } -func (m *ACLChangeACLContentValueValueOfUserPermissionChange) Size() (n int) { +func (m *ACLContentValue_UserPermissionChange) Size() (n int) { if m == nil { return 0 } @@ -2667,7 +2492,7 @@ func (m *ACLChangeACLContentValueValueOfUserPermissionChange) Size() (n int) { } return n } -func (m *ACLChangeACLContentValueValueOfUserInvite) Size() (n int) { +func (m *ACLContentValue_UserInvite) Size() (n int) { if m == nil { return 0 } @@ -2679,7 +2504,7 @@ func (m *ACLChangeACLContentValueValueOfUserInvite) Size() (n int) { } return n } -func (m *ACLChangeACLContentValueValueOfUserJoin) Size() (n int) { +func (m *ACLContentValue_UserJoin) Size() (n int) { if m == nil { return 0 } @@ -2691,7 +2516,7 @@ func (m *ACLChangeACLContentValueValueOfUserJoin) Size() (n int) { } return n } -func (m *ACLChangeACLContentValueValueOfUserConfirm) Size() (n int) { +func (m *ACLContentValue_UserConfirm) Size() (n int) { if m == nil { return 0 } @@ -2703,16 +2528,12 @@ func (m *ACLChangeACLContentValueValueOfUserConfirm) Size() (n int) { } return n } -func (m *ACLChangeACLData) Size() (n int) { +func (m *ACLData) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.AclSnapshot != nil { - l = m.AclSnapshot.Size() - n += 1 + l + sovAclchanges(uint64(l)) - } if len(m.AclContent) > 0 { for _, e := range m.AclContent { l = e.Size() @@ -2722,20 +2543,7 @@ func (m *ACLChangeACLData) Size() (n int) { return n } -func (m *ACLChangeACLSnapshot) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.AclState != nil { - l = m.AclState.Size() - n += 1 + l + sovAclchanges(uint64(l)) - } - return n -} - -func (m *ACLChangeACLState) Size() (n int) { +func (m *ACLState) Size() (n int) { if m == nil { return 0 } @@ -2770,7 +2578,7 @@ func (m *ACLChangeACLState) Size() (n int) { return n } -func (m *ACLChangeUserState) Size() (n int) { +func (m *ACLUserState) Size() (n int) { if m == nil { return 0 } @@ -2799,7 +2607,7 @@ func (m *ACLChangeUserState) Size() (n int) { return n } -func (m *ACLChangeUserAdd) Size() (n int) { +func (m *ACLUserAdd) Size() (n int) { if m == nil { return 0 } @@ -2825,7 +2633,7 @@ func (m *ACLChangeUserAdd) Size() (n int) { return n } -func (m *ACLChangeUserConfirm) Size() (n int) { +func (m *ACLUserConfirm) Size() (n int) { if m == nil { return 0 } @@ -2842,7 +2650,7 @@ func (m *ACLChangeUserConfirm) Size() (n int) { return n } -func (m *ACLChangeUserInvite) Size() (n int) { +func (m *ACLUserInvite) Size() (n int) { if m == nil { return 0 } @@ -2872,7 +2680,7 @@ func (m *ACLChangeUserInvite) Size() (n int) { return n } -func (m *ACLChangeUserJoin) Size() (n int) { +func (m *ACLUserJoin) Size() (n int) { if m == nil { return 0 } @@ -2903,7 +2711,7 @@ func (m *ACLChangeUserJoin) Size() (n int) { return n } -func (m *ACLChangeUserRemove) Size() (n int) { +func (m *ACLUserRemove) Size() (n int) { if m == nil { return 0 } @@ -2922,7 +2730,7 @@ func (m *ACLChangeUserRemove) Size() (n int) { return n } -func (m *ACLChangeReadKeyReplace) Size() (n int) { +func (m *ACLReadKeyReplace) Size() (n int) { if m == nil { return 0 } @@ -2943,7 +2751,7 @@ func (m *ACLChangeReadKeyReplace) Size() (n int) { return n } -func (m *ACLChangeUserPermissionChange) Size() (n int) { +func (m *ACLUserPermissionChange) Size() (n int) { if m == nil { return 0 } @@ -2959,7 +2767,85 @@ func (m *ACLChangeUserPermissionChange) Size() (n int) { return n } -func (m *Change) Size() (n int) { +func (m *ACLRecord) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PrevId) + if l > 0 { + n += 1 + l + sovAclchanges(uint64(l)) + } + l = len(m.Identity) + if l > 0 { + n += 1 + l + sovAclchanges(uint64(l)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovAclchanges(uint64(l)) + } + if m.CurrentReadKeyHash != 0 { + n += 1 + sovAclchanges(uint64(m.CurrentReadKeyHash)) + } + if m.Timestamp != 0 { + n += 1 + sovAclchanges(uint64(m.Timestamp)) + } + return n +} + +func (m *ACLHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FirstId) + if l > 0 { + n += 1 + l + sovAclchanges(uint64(l)) + } + l = len(m.Identity) + if l > 0 { + n += 1 + l + sovAclchanges(uint64(l)) + } + return n +} + +func (m *RawTreeChange) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Payload) + if l > 0 { + n += 1 + l + sovAclchanges(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovAclchanges(uint64(l)) + } + return n +} + +func (m *RawTreeChangeWithId) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RawChange) + if l > 0 { + n += 1 + l + sovAclchanges(uint64(l)) + } + l = len(m.Id) + if l > 0 { + n += 1 + l + sovAclchanges(uint64(l)) + } + return n +} + +func (m *TreeChange) Size() (n int) { if m == nil { return 0 } @@ -2999,34 +2885,7 @@ func (m *Change) Size() (n int) { return n } -func (m *Record) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.PrevId) - if l > 0 { - n += 1 + l + sovAclchanges(uint64(l)) - } - l = len(m.Identity) - if l > 0 { - n += 1 + l + sovAclchanges(uint64(l)) - } - l = len(m.Data) - if l > 0 { - n += 1 + l + sovAclchanges(uint64(l)) - } - if m.CurrentReadKeyHash != 0 { - n += 1 + sovAclchanges(uint64(m.CurrentReadKeyHash)) - } - if m.Timestamp != 0 { - n += 1 + sovAclchanges(uint64(m.Timestamp)) - } - return n -} - -func (m *Header) Size() (n int) { +func (m *TreeHeader) Size() (n int) { if m == nil { return 0 } @@ -3036,16 +2895,20 @@ func (m *Header) Size() (n int) { if l > 0 { n += 1 + l + sovAclchanges(uint64(l)) } - l = len(m.AclListId) + l = len(m.AclId) if l > 0 { n += 1 + l + sovAclchanges(uint64(l)) } - l = len(m.WorkspaceId) + if m.TreeHeaderType != 0 { + n += 1 + sovAclchanges(uint64(m.TreeHeaderType)) + } + l = len(m.Identity) if l > 0 { n += 1 + l + sovAclchanges(uint64(l)) } - if m.DocType != 0 { - n += 1 + sovAclchanges(uint64(m.DocType)) + l = len(m.Data) + if l > 0 { + n += 1 + l + sovAclchanges(uint64(l)) } return n } @@ -3056,7 +2919,7 @@ func sovAclchanges(x uint64) (n int) { func sozAclchanges(x uint64) (n int) { return sovAclchanges(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *RawChange) Unmarshal(dAtA []byte) error { +func (m *RawACLRecord) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3079,10 +2942,10 @@ func (m *RawChange) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: RawChange: wiretype end group for non-group") + return fmt.Errorf("proto: RawACLRecord: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: RawChange: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: RawACLRecord: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3206,443 +3069,7 @@ func (m *RawChange) Unmarshal(dAtA []byte) error { } return nil } -func (m *RawRecord) 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 ErrIntOverflowAclchanges - } - 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: RawRecord: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RawRecord: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAclchanges - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAclchanges - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthAclchanges - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) - if m.Payload == nil { - m.Payload = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAclchanges - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAclchanges - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthAclchanges - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) - if m.Signature == nil { - m.Signature = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAclchanges - } - 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 ErrInvalidLengthAclchanges - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAclchanges - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAclchanges(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAclchanges - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ACLChange) 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 ErrIntOverflowAclchanges - } - 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: ACLChange: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ACLChange: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TreeHeadIds", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAclchanges - } - 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 ErrInvalidLengthAclchanges - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAclchanges - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TreeHeadIds = append(m.TreeHeadIds, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AclHeadIds", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAclchanges - } - 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 ErrInvalidLengthAclchanges - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAclchanges - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AclHeadIds = append(m.AclHeadIds, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SnapshotBaseId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAclchanges - } - 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 ErrInvalidLengthAclchanges - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAclchanges - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SnapshotBaseId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AclData", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAclchanges - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAclchanges - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAclchanges - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AclData == nil { - m.AclData = &ACLChangeACLData{} - } - if err := m.AclData.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChangesData", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAclchanges - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAclchanges - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthAclchanges - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChangesData = append(m.ChangesData[:0], dAtA[iNdEx:postIndex]...) - if m.ChangesData == nil { - m.ChangesData = []byte{} - } - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrentReadKeyHash", wireType) - } - m.CurrentReadKeyHash = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAclchanges - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CurrentReadKeyHash |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) - } - m.Timestamp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAclchanges - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Timestamp |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAclchanges - } - 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 ErrInvalidLengthAclchanges - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAclchanges - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Identity = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAclchanges(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAclchanges - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ACLChangeACLContentValue) Unmarshal(dAtA []byte) error { +func (m *ACLContentValue) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3700,11 +3127,11 @@ func (m *ACLChangeACLContentValue) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &ACLChangeUserAdd{} + v := &ACLUserAdd{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Value = &ACLChangeACLContentValueValueOfUserAdd{v} + m.Value = &ACLContentValue_UserAdd{v} iNdEx = postIndex case 2: if wireType != 2 { @@ -3735,11 +3162,11 @@ func (m *ACLChangeACLContentValue) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &ACLChangeUserRemove{} + v := &ACLUserRemove{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Value = &ACLChangeACLContentValueValueOfUserRemove{v} + m.Value = &ACLContentValue_UserRemove{v} iNdEx = postIndex case 3: if wireType != 2 { @@ -3770,11 +3197,11 @@ func (m *ACLChangeACLContentValue) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &ACLChangeUserPermissionChange{} + v := &ACLUserPermissionChange{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Value = &ACLChangeACLContentValueValueOfUserPermissionChange{v} + m.Value = &ACLContentValue_UserPermissionChange{v} iNdEx = postIndex case 4: if wireType != 2 { @@ -3805,11 +3232,11 @@ func (m *ACLChangeACLContentValue) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &ACLChangeUserInvite{} + v := &ACLUserInvite{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Value = &ACLChangeACLContentValueValueOfUserInvite{v} + m.Value = &ACLContentValue_UserInvite{v} iNdEx = postIndex case 5: if wireType != 2 { @@ -3840,11 +3267,11 @@ func (m *ACLChangeACLContentValue) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &ACLChangeUserJoin{} + v := &ACLUserJoin{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Value = &ACLChangeACLContentValueValueOfUserJoin{v} + m.Value = &ACLContentValue_UserJoin{v} iNdEx = postIndex case 6: if wireType != 2 { @@ -3875,11 +3302,11 @@ func (m *ACLChangeACLContentValue) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &ACLChangeUserConfirm{} + v := &ACLUserConfirm{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Value = &ACLChangeACLContentValueValueOfUserConfirm{v} + m.Value = &ACLContentValue_UserConfirm{v} iNdEx = postIndex default: iNdEx = preIndex @@ -3902,7 +3329,7 @@ func (m *ACLChangeACLContentValue) Unmarshal(dAtA []byte) error { } return nil } -func (m *ACLChangeACLData) Unmarshal(dAtA []byte) error { +func (m *ACLData) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3932,42 +3359,6 @@ func (m *ACLChangeACLData) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AclSnapshot", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAclchanges - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAclchanges - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAclchanges - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AclSnapshot == nil { - m.AclSnapshot = &ACLChangeACLSnapshot{} - } - if err := m.AclSnapshot.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field AclContent", wireType) } @@ -3996,7 +3387,7 @@ func (m *ACLChangeACLData) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.AclContent = append(m.AclContent, &ACLChangeACLContentValue{}) + m.AclContent = append(m.AclContent, &ACLContentValue{}) if err := m.AclContent[len(m.AclContent)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4022,93 +3413,7 @@ func (m *ACLChangeACLData) Unmarshal(dAtA []byte) error { } return nil } -func (m *ACLChangeACLSnapshot) 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 ErrIntOverflowAclchanges - } - 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: ACLSnapshot: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ACLSnapshot: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AclState", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAclchanges - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAclchanges - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAclchanges - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AclState == nil { - m.AclState = &ACLChangeACLState{} - } - if err := m.AclState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAclchanges(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAclchanges - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ACLChangeACLState) Unmarshal(dAtA []byte) error { +func (m *ACLState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4242,7 +3547,7 @@ func (m *ACLChangeACLState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.UserStates = append(m.UserStates, &ACLChangeUserState{}) + m.UserStates = append(m.UserStates, &ACLUserState{}) if err := m.UserStates[len(m.UserStates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4277,10 +3582,10 @@ func (m *ACLChangeACLState) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Invites == nil { - m.Invites = make(map[string]*ACLChangeUserInvite) + m.Invites = make(map[string]*ACLUserInvite) } var mapkey string - var mapvalue *ACLChangeUserInvite + var mapvalue *ACLUserInvite for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 @@ -4354,7 +3659,7 @@ func (m *ACLChangeACLState) Unmarshal(dAtA []byte) error { if postmsgIndex > l { return io.ErrUnexpectedEOF } - mapvalue = &ACLChangeUserInvite{} + mapvalue = &ACLUserInvite{} if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { return err } @@ -4397,7 +3702,7 @@ func (m *ACLChangeACLState) Unmarshal(dAtA []byte) error { } return nil } -func (m *ACLChangeUserState) Unmarshal(dAtA []byte) error { +func (m *ACLUserState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4420,17 +3725,17 @@ func (m *ACLChangeUserState) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: UserState: wiretype end group for non-group") + return fmt.Errorf("proto: ACLUserState: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: UserState: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ACLUserState: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowAclchanges @@ -4440,23 +3745,25 @@ func (m *ACLChangeUserState) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthAclchanges } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthAclchanges } if postIndex > l { return io.ErrUnexpectedEOF } - m.Identity = string(dAtA[iNdEx:postIndex]) + m.Identity = append(m.Identity[:0], dAtA[iNdEx:postIndex]...) + if m.Identity == nil { + m.Identity = []byte{} + } iNdEx = postIndex case 2: if wireType != 2 { @@ -4538,7 +3845,7 @@ func (m *ACLChangeUserState) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Permissions |= ACLChangeUserPermissions(b&0x7F) << shift + m.Permissions |= ACLUserPermissions(b&0x7F) << shift if b < 0x80 { break } @@ -4584,7 +3891,7 @@ func (m *ACLChangeUserState) Unmarshal(dAtA []byte) error { } return nil } -func (m *ACLChangeUserAdd) Unmarshal(dAtA []byte) error { +func (m *ACLUserAdd) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4607,17 +3914,17 @@ func (m *ACLChangeUserAdd) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: UserAdd: wiretype end group for non-group") + return fmt.Errorf("proto: ACLUserAdd: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: UserAdd: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ACLUserAdd: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowAclchanges @@ -4627,23 +3934,25 @@ func (m *ACLChangeUserAdd) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthAclchanges } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthAclchanges } if postIndex > l { return io.ErrUnexpectedEOF } - m.Identity = string(dAtA[iNdEx:postIndex]) + m.Identity = append(m.Identity[:0], dAtA[iNdEx:postIndex]...) + if m.Identity == nil { + m.Identity = []byte{} + } iNdEx = postIndex case 2: if wireType != 2 { @@ -4725,7 +4034,7 @@ func (m *ACLChangeUserAdd) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Permissions |= ACLChangeUserPermissions(b&0x7F) << shift + m.Permissions |= ACLUserPermissions(b&0x7F) << shift if b < 0x80 { break } @@ -4751,7 +4060,7 @@ func (m *ACLChangeUserAdd) Unmarshal(dAtA []byte) error { } return nil } -func (m *ACLChangeUserConfirm) Unmarshal(dAtA []byte) error { +func (m *ACLUserConfirm) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4774,17 +4083,17 @@ func (m *ACLChangeUserConfirm) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: UserConfirm: wiretype end group for non-group") + return fmt.Errorf("proto: ACLUserConfirm: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: UserConfirm: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ACLUserConfirm: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowAclchanges @@ -4794,23 +4103,25 @@ func (m *ACLChangeUserConfirm) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthAclchanges } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthAclchanges } if postIndex > l { return io.ErrUnexpectedEOF } - m.Identity = string(dAtA[iNdEx:postIndex]) + m.Identity = append(m.Identity[:0], dAtA[iNdEx:postIndex]...) + if m.Identity == nil { + m.Identity = []byte{} + } iNdEx = postIndex case 2: if wireType != 2 { @@ -4865,7 +4176,7 @@ func (m *ACLChangeUserConfirm) Unmarshal(dAtA []byte) error { } return nil } -func (m *ACLChangeUserInvite) Unmarshal(dAtA []byte) error { +func (m *ACLUserInvite) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4888,10 +4199,10 @@ func (m *ACLChangeUserInvite) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: UserInvite: wiretype end group for non-group") + return fmt.Errorf("proto: ACLUserInvite: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: UserInvite: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ACLUserInvite: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -5008,7 +4319,7 @@ func (m *ACLChangeUserInvite) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Permissions |= ACLChangeUserPermissions(b&0x7F) << shift + m.Permissions |= ACLUserPermissions(b&0x7F) << shift if b < 0x80 { break } @@ -5066,7 +4377,7 @@ func (m *ACLChangeUserInvite) Unmarshal(dAtA []byte) error { } return nil } -func (m *ACLChangeUserJoin) Unmarshal(dAtA []byte) error { +func (m *ACLUserJoin) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5089,17 +4400,17 @@ func (m *ACLChangeUserJoin) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: UserJoin: wiretype end group for non-group") + return fmt.Errorf("proto: ACLUserJoin: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: UserJoin: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ACLUserJoin: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowAclchanges @@ -5109,23 +4420,25 @@ func (m *ACLChangeUserJoin) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthAclchanges } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthAclchanges } if postIndex > l { return io.ErrUnexpectedEOF } - m.Identity = string(dAtA[iNdEx:postIndex]) + m.Identity = append(m.Identity[:0], dAtA[iNdEx:postIndex]...) + if m.Identity == nil { + m.Identity = []byte{} + } iNdEx = postIndex case 2: if wireType != 2 { @@ -5280,7 +4593,7 @@ func (m *ACLChangeUserJoin) Unmarshal(dAtA []byte) error { } return nil } -func (m *ACLChangeUserRemove) Unmarshal(dAtA []byte) error { +func (m *ACLUserRemove) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5303,17 +4616,17 @@ func (m *ACLChangeUserRemove) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: UserRemove: wiretype end group for non-group") + return fmt.Errorf("proto: ACLUserRemove: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: UserRemove: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ACLUserRemove: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowAclchanges @@ -5323,23 +4636,25 @@ func (m *ACLChangeUserRemove) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthAclchanges } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthAclchanges } if postIndex > l { return io.ErrUnexpectedEOF } - m.Identity = string(dAtA[iNdEx:postIndex]) + m.Identity = append(m.Identity[:0], dAtA[iNdEx:postIndex]...) + if m.Identity == nil { + m.Identity = []byte{} + } iNdEx = postIndex case 3: if wireType != 2 { @@ -5370,7 +4685,7 @@ func (m *ACLChangeUserRemove) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ReadKeyReplaces = append(m.ReadKeyReplaces, &ACLChangeReadKeyReplace{}) + m.ReadKeyReplaces = append(m.ReadKeyReplaces, &ACLReadKeyReplace{}) if err := m.ReadKeyReplaces[len(m.ReadKeyReplaces)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -5396,7 +4711,7 @@ func (m *ACLChangeUserRemove) Unmarshal(dAtA []byte) error { } return nil } -func (m *ACLChangeReadKeyReplace) Unmarshal(dAtA []byte) error { +func (m *ACLReadKeyReplace) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5419,17 +4734,17 @@ func (m *ACLChangeReadKeyReplace) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ReadKeyReplace: wiretype end group for non-group") + return fmt.Errorf("proto: ACLReadKeyReplace: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ReadKeyReplace: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ACLReadKeyReplace: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowAclchanges @@ -5439,23 +4754,25 @@ func (m *ACLChangeReadKeyReplace) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthAclchanges } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthAclchanges } if postIndex > l { return io.ErrUnexpectedEOF } - m.Identity = string(dAtA[iNdEx:postIndex]) + m.Identity = append(m.Identity[:0], dAtA[iNdEx:postIndex]...) + if m.Identity == nil { + m.Identity = []byte{} + } iNdEx = postIndex case 2: if wireType != 2 { @@ -5546,7 +4863,7 @@ func (m *ACLChangeReadKeyReplace) Unmarshal(dAtA []byte) error { } return nil } -func (m *ACLChangeUserPermissionChange) Unmarshal(dAtA []byte) error { +func (m *ACLUserPermissionChange) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5569,16 +4886,119 @@ func (m *ACLChangeUserPermissionChange) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: UserPermissionChange: wiretype end group for non-group") + return fmt.Errorf("proto: ACLUserPermissionChange: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: UserPermissionChange: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ACLUserPermissionChange: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAclchanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthAclchanges + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthAclchanges + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = append(m.Identity[:0], dAtA[iNdEx:postIndex]...) + if m.Identity == nil { + m.Identity = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Permissions", wireType) + } + m.Permissions = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAclchanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Permissions |= ACLUserPermissions(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipAclchanges(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAclchanges + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ACLRecord) 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 ErrIntOverflowAclchanges + } + 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: ACLRecord: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ACLRecord: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PrevId", wireType) + } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { @@ -5605,13 +5025,13 @@ func (m *ACLChangeUserPermissionChange) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Identity = string(dAtA[iNdEx:postIndex]) + m.PrevId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Permissions", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) } - m.Permissions = 0 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowAclchanges @@ -5621,7 +5041,94 @@ func (m *ACLChangeUserPermissionChange) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Permissions |= ACLChangeUserPermissions(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthAclchanges + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthAclchanges + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = append(m.Identity[:0], dAtA[iNdEx:postIndex]...) + if m.Identity == nil { + m.Identity = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAclchanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthAclchanges + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthAclchanges + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentReadKeyHash", wireType) + } + m.CurrentReadKeyHash = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAclchanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CurrentReadKeyHash |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + m.Timestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAclchanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Timestamp |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -5647,7 +5154,7 @@ func (m *ACLChangeUserPermissionChange) Unmarshal(dAtA []byte) error { } return nil } -func (m *Change) Unmarshal(dAtA []byte) error { +func (m *ACLHeader) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5670,10 +5177,360 @@ func (m *Change) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Change: wiretype end group for non-group") + return fmt.Errorf("proto: ACLHeader: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Change: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ACLHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FirstId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAclchanges + } + 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 ErrInvalidLengthAclchanges + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAclchanges + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FirstId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAclchanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthAclchanges + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthAclchanges + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = append(m.Identity[:0], dAtA[iNdEx:postIndex]...) + if m.Identity == nil { + m.Identity = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAclchanges(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAclchanges + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RawTreeChange) 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 ErrIntOverflowAclchanges + } + 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: RawTreeChange: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RawTreeChange: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAclchanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthAclchanges + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthAclchanges + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) + if m.Payload == nil { + m.Payload = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAclchanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthAclchanges + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthAclchanges + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAclchanges(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAclchanges + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RawTreeChangeWithId) 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 ErrIntOverflowAclchanges + } + 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: RawTreeChangeWithId: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RawTreeChangeWithId: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RawChange", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAclchanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthAclchanges + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthAclchanges + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RawChange = append(m.RawChange[:0], dAtA[iNdEx:postIndex]...) + if m.RawChange == nil { + m.RawChange = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAclchanges + } + 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 ErrInvalidLengthAclchanges + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAclchanges + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAclchanges(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAclchanges + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TreeChange) 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 ErrIntOverflowAclchanges + } + 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: TreeChange: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TreeChange: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -5848,7 +5705,7 @@ func (m *Change) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowAclchanges @@ -5858,23 +5715,25 @@ func (m *Change) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthAclchanges } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthAclchanges } if postIndex > l { return io.ErrUnexpectedEOF } - m.Identity = string(dAtA[iNdEx:postIndex]) + m.Identity = append(m.Identity[:0], dAtA[iNdEx:postIndex]...) + if m.Identity == nil { + m.Identity = []byte{} + } iNdEx = postIndex case 8: if wireType != 0 { @@ -5917,7 +5776,7 @@ func (m *Change) Unmarshal(dAtA []byte) error { } return nil } -func (m *Record) Unmarshal(dAtA []byte) error { +func (m *TreeHeader) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5940,196 +5799,10 @@ func (m *Record) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Record: wiretype end group for non-group") + return fmt.Errorf("proto: TreeHeader: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Record: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PrevId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAclchanges - } - 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 ErrInvalidLengthAclchanges - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAclchanges - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PrevId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAclchanges - } - 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 ErrInvalidLengthAclchanges - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAclchanges - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Identity = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAclchanges - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAclchanges - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthAclchanges - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrentReadKeyHash", wireType) - } - m.CurrentReadKeyHash = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAclchanges - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CurrentReadKeyHash |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) - } - m.Timestamp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAclchanges - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Timestamp |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipAclchanges(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAclchanges - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Header) 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 ErrIntOverflowAclchanges - } - 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: Header: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Header: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: TreeHeader: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -6166,7 +5839,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AclListId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AclId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -6194,13 +5867,13 @@ func (m *Header) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.AclListId = string(dAtA[iNdEx:postIndex]) + m.AclId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WorkspaceId", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TreeHeaderType", wireType) } - var stringLen uint64 + m.TreeHeaderType = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowAclchanges @@ -6210,29 +5883,50 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.TreeHeaderType |= TreeHeaderType(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAclchanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { return ErrInvalidLengthAclchanges } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthAclchanges } if postIndex > l { return io.ErrUnexpectedEOF } - m.WorkspaceId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DocType", wireType) + m.Identity = append(m.Identity[:0], dAtA[iNdEx:postIndex]...) + if m.Identity == nil { + m.Identity = []byte{} } - m.DocType = 0 + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowAclchanges @@ -6242,11 +5936,26 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.DocType |= HeaderDocType(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } + if byteLen < 0 { + return ErrInvalidLengthAclchanges + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthAclchanges + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipAclchanges(dAtA[iNdEx:]) diff --git a/pkg/acl/aclchanges/aclpb/protos/aclchanges.proto b/pkg/acl/aclchanges/aclpb/protos/aclchanges.proto index 76177a7c..73a3fc1f 100644 --- a/pkg/acl/aclchanges/aclpb/protos/aclchanges.proto +++ b/pkg/acl/aclchanges/aclpb/protos/aclchanges.proto @@ -2,147 +2,142 @@ syntax = "proto3"; package acl; option go_package = "aclpb"; -message RawChange { +// ACL protos + +message RawACLRecord { bytes payload = 1; bytes signature = 2; - string id = 3; + string id = 3; // this field is only used on user side for convenience, it should be empty when saving to db } -message RawRecord { - bytes payload = 1; - bytes signature = 2; - string id = 3; -} - -// the element of change tree used to store and internal apply smartBlock history -message ACLChange { - repeated string treeHeadIds = 1; - repeated string aclHeadIds = 2; - string snapshotBaseId = 3; // we will only have one base snapshot for both - ACLData aclData = 4; - // the data is encoded with read key and should be read in ChangesData format - bytes changesData = 5; - uint64 currentReadKeyHash = 6; - int64 timestamp = 7; - string identity = 8; - - message ACLContentValue { - oneof value { - UserAdd userAdd = 1; - UserRemove userRemove = 2; - UserPermissionChange userPermissionChange = 3; - UserInvite userInvite = 4; - UserJoin userJoin = 5; - UserConfirm userConfirm = 6; - } - } - - message ACLData { - ACLSnapshot aclSnapshot = 1; - repeated ACLContentValue aclContent = 2; - } - - message ACLSnapshot { - // We don't need ACLState as a separate message now, because we simplified the snapshot model - ACLState aclState = 1; - } - - message ACLState { - repeated uint64 readKeyHashes = 1; - repeated UserState userStates = 2; - map invites = 3; // TODO: later - // repeated string unconfirmedUsers = 4; // TODO: later - } - - message UserState { - string identity = 1; - bytes encryptionKey = 2; - repeated bytes encryptedReadKeys = 3; // all read keys that we know - UserPermissions permissions = 4; - bool IsConfirmed = 5; - } - - // we already know identity and encryptionKey - message UserAdd { - string identity = 1; // public signing key - bytes encryptionKey = 2; // public encryption key - repeated bytes encryptedReadKeys = 3; // all read keys that we know for the user - UserPermissions permissions = 4; - } - - // TODO: this is not used as of now - message UserConfirm { // not needed for read permissions - string identity = 1; // not needed - string userAddId = 2; - } - - message UserInvite { - bytes acceptPublicKey = 1; - bytes encryptPublicKey = 2; - repeated bytes encryptedReadKeys = 3; // all read keys that we know for the user - UserPermissions permissions = 4; - string InviteId = 5; - } - - message UserJoin { - string identity = 1; - bytes encryptionKey = 2; - bytes acceptSignature = 3; // sign acceptPublicKey - string userInviteId = 4; - repeated bytes encryptedReadKeys = 5; // the idea is that user should itself reencrypt the keys with the pub key - } - - message UserRemove { - string identity = 1; - repeated ReadKeyReplace readKeyReplaces = 3; // new read key encrypted for all users - } - - message ReadKeyReplace { - string identity = 1; - bytes encryptionKey = 2; - bytes encryptedReadKey = 3; - } - - message UserPermissionChange { - string identity = 1; - UserPermissions permissions = 2; - } - - enum UserPermissions { - Admin = 0; - Writer = 1; - Reader = 2; - Removed = 3; +message ACLContentValue { + oneof value { + ACLUserAdd userAdd = 1; + ACLUserRemove userRemove = 2; + ACLUserPermissionChange userPermissionChange = 3; + ACLUserInvite userInvite = 4; + ACLUserJoin userJoin = 5; + ACLUserConfirm userConfirm = 6; } } -message Change { - repeated string treeHeadIds = 1; - string aclHeadId = 2; - string snapshotBaseId = 3; // we will only have one base snapshot for both - bytes changesData = 4; - uint64 currentReadKeyHash = 5; - int64 timestamp = 6; - string identity = 7; - bool isSnapshot = 8; +message ACLData { + repeated ACLContentValue aclContent = 1; } -message Record { +message ACLState { + repeated uint64 readKeyHashes = 1; + repeated ACLUserState userStates = 2; + map invites = 3; // TODO: later + // repeated string unconfirmedUsers = 4; // TODO: later +} + +message ACLUserState { + bytes identity = 1; + bytes encryptionKey = 2; + repeated bytes encryptedReadKeys = 3; // all read keys that we know + ACLUserPermissions permissions = 4; + bool isConfirmed = 5; +} + +// we already know identity and encryptionKey +message ACLUserAdd { + bytes identity = 1; // public signing key + bytes encryptionKey = 2; // public encryption key + repeated bytes encryptedReadKeys = 3; // all read keys that we know for the user + ACLUserPermissions permissions = 4; +} + +// TODO: this is not used as of now +message ACLUserConfirm { // not needed for read permissions + bytes identity = 1; // not needed + string userAddId = 2; +} + +message ACLUserInvite { + bytes acceptPublicKey = 1; + bytes encryptPublicKey = 2; + repeated bytes encryptedReadKeys = 3; // all read keys that we know for the user + ACLUserPermissions permissions = 4; + string inviteId = 5; +} + +message ACLUserJoin { + bytes identity = 1; + bytes encryptionKey = 2; + bytes acceptSignature = 3; // sign acceptPublicKey + string userInviteId = 4; + repeated bytes encryptedReadKeys = 5; // the idea is that user should itself reencrypt the keys with the pub key +} + +message ACLUserRemove { + bytes identity = 1; + repeated ACLReadKeyReplace readKeyReplaces = 3; // new read key encrypted for all users +} + +message ACLReadKeyReplace { + bytes identity = 1; + bytes encryptionKey = 2; + bytes encryptedReadKey = 3; +} + +message ACLUserPermissionChange { + bytes identity = 1; + ACLUserPermissions permissions = 2; +} + +enum ACLUserPermissions { + Admin = 0; + Writer = 1; + Reader = 2; + Removed = 3; +} + +message ACLRecord { string prevId = 1; - string identity = 2; + bytes identity = 2; bytes data = 3; uint64 currentReadKeyHash = 4; int64 timestamp = 5; } -message Header { +message ACLHeader { string firstId = 1; - string aclListId = 2; - string workspaceId = 3; - DocType docType = 4; - - enum DocType { - ACL = 0; - DocTree = 1; - } + bytes identity = 2; // the identity of the creator +} + +// Tree protos + +message RawTreeChange { + bytes payload = 1; + bytes signature = 2; +} + +message RawTreeChangeWithId { + bytes rawChange = 1; + string id = 2; +} + +message TreeChange { + repeated string treeHeadIds = 1; + string aclHeadId = 2; + string snapshotBaseId = 3; + bytes changesData = 4; + uint64 currentReadKeyHash = 5; + int64 timestamp = 6; + bytes identity = 7; + bool isSnapshot = 8; +} + +enum TreeHeaderType { + Object = 0; + Space = 1; +} + +message TreeHeader { + string firstId = 1; + string aclId = 2; + TreeHeaderType treeHeaderType = 3; + bytes identity = 4; + bytes data = 5; // this should be reserved for the client to add the data it needs } diff --git a/pkg/acl/list/aclstate.go b/pkg/acl/list/aclstate.go index 6765ee99..d7a849fb 100644 --- a/pkg/acl/list/aclstate.go +++ b/pkg/acl/list/aclstate.go @@ -1,6 +1,7 @@ package list import ( + "bytes" "errors" "fmt" "github.com/anytypeio/go-anytype-infrastructure-experiments/app/logger" @@ -29,14 +30,14 @@ var ErrInvalidSignature = errors.New("signature is invalid") type UserPermissionPair struct { Identity string - Permission aclpb.ACLChangeUserPermissions + Permission aclpb.ACLUserPermissions } type ACLState struct { currentReadKeyHash uint64 userReadKeys map[uint64]*symmetric.Key - userStates map[string]*aclpb.ACLChangeUserState - userInvites map[string]*aclpb.ACLChangeUserInvite + userStates map[string]*aclpb.ACLUserState + userInvites map[string]*aclpb.ACLUserInvite signingPubKeyDecoder keys.Decoder encryptionKey encryptionkey.PrivKey @@ -55,8 +56,8 @@ func newACLStateWithIdentity( identity: identity, encryptionKey: encryptionKey, userReadKeys: make(map[uint64]*symmetric.Key), - userStates: make(map[string]*aclpb.ACLChangeUserState), - userInvites: make(map[string]*aclpb.ACLChangeUserInvite), + userStates: make(map[string]*aclpb.ACLUserState), + userInvites: make(map[string]*aclpb.ACLUserInvite), signingPubKeyDecoder: decoder, permissionsAtRecord: make(map[string][]UserPermissionPair), keychain: common.NewKeychain(), @@ -67,8 +68,8 @@ func newACLState(decoder keys.Decoder) *ACLState { return &ACLState{ signingPubKeyDecoder: decoder, userReadKeys: make(map[uint64]*symmetric.Key), - userStates: make(map[string]*aclpb.ACLChangeUserState), - userInvites: make(map[string]*aclpb.ACLChangeUserInvite), + userStates: make(map[string]*aclpb.ACLUserState), + userInvites: make(map[string]*aclpb.ACLUserInvite), permissionsAtRecord: make(map[string][]UserPermissionPair), keychain: common.NewKeychain(), } @@ -105,8 +106,8 @@ func (st *ACLState) PermissionsAtRecord(id string, identity string) (UserPermiss return UserPermissionPair{}, ErrNoSuchUser } -func (st *ACLState) applyRecord(record *aclpb.Record) (err error) { - aclData := &aclpb.ACLChangeACLData{} +func (st *ACLState) applyRecord(record *aclpb.ACLRecord) (err error) { + aclData := &aclpb.ACLData{} err = proto.Unmarshal(record.Data, aclData) if err != nil { @@ -122,14 +123,14 @@ func (st *ACLState) applyRecord(record *aclpb.Record) (err error) { return } -func (st *ACLState) applyChangeAndUpdate(recordWrapper *Record) (err error) { +func (st *ACLState) applyChangeAndUpdate(recordWrapper *ACLRecord) (err error) { var ( change = recordWrapper.Content - aclData = &aclpb.ACLChangeACLData{} + aclData = &aclpb.ACLData{} ) if recordWrapper.Model != nil { - aclData = recordWrapper.Model.(*aclpb.ACLChangeACLData) + aclData = recordWrapper.Model.(*aclpb.ACLData) } else { err = proto.Unmarshal(change.Data, aclData) if err != nil { @@ -147,7 +148,7 @@ func (st *ACLState) applyChangeAndUpdate(recordWrapper *Record) (err error) { var permissions []UserPermissionPair for _, state := range st.userStates { permission := UserPermissionPair{ - Identity: state.Identity, + Identity: string(state.Identity), Permission: state.Permissions, } permissions = append(permissions, permission) @@ -157,7 +158,7 @@ func (st *ACLState) applyChangeAndUpdate(recordWrapper *Record) (err error) { return nil } -func (st *ACLState) applyChangeData(changeData *aclpb.ACLChangeACLData, hash uint64, identity string) (err error) { +func (st *ACLState) applyChangeData(changeData *aclpb.ACLData, hash uint64, identity []byte) (err error) { defer func() { if err != nil { return @@ -170,12 +171,12 @@ func (st *ACLState) applyChangeData(changeData *aclpb.ACLChangeACLData, hash uin skipIdentityCheck := st.isUserJoin(changeData) || (st.currentReadKeyHash == 0 && st.isUserAdd(changeData, identity)) if !skipIdentityCheck { // we check signature when we add this to the Tree, so no need to do it here - if _, exists := st.userStates[identity]; !exists { + if _, exists := st.userStates[string(identity)]; !exists { err = ErrNoSuchUser return } - if !st.hasPermission(identity, aclpb.ACLChange_Admin) { + if !st.hasPermission(identity, aclpb.ACLUserPermissions_Admin) { err = fmt.Errorf("user %s must have admin permissions", identity) return } @@ -191,7 +192,7 @@ func (st *ACLState) applyChangeData(changeData *aclpb.ACLChangeACLData, hash uin return nil } -func (st *ACLState) applyChangeContent(ch *aclpb.ACLChangeACLContentValue) error { +func (st *ACLState) applyChangeContent(ch *aclpb.ACLContentValue) error { switch { case ch.GetUserPermissionChange() != nil: return st.applyUserPermissionChange(ch.GetUserPermissionChange()) @@ -210,27 +211,29 @@ func (st *ACLState) applyChangeContent(ch *aclpb.ACLChangeACLContentValue) error } } -func (st *ACLState) applyUserPermissionChange(ch *aclpb.ACLChangeUserPermissionChange) error { - if _, exists := st.userStates[ch.Identity]; !exists { +func (st *ACLState) applyUserPermissionChange(ch *aclpb.ACLUserPermissionChange) error { + chIdentity := string(ch.Identity) + if _, exists := st.userStates[chIdentity]; !exists { return ErrNoSuchUser } - st.userStates[ch.Identity].Permissions = ch.Permissions + st.userStates[chIdentity].Permissions = ch.Permissions return nil } -func (st *ACLState) applyUserInvite(ch *aclpb.ACLChangeUserInvite) error { +func (st *ACLState) applyUserInvite(ch *aclpb.ACLUserInvite) error { st.userInvites[ch.InviteId] = ch return nil } -func (st *ACLState) applyUserJoin(ch *aclpb.ACLChangeUserJoin) error { +func (st *ACLState) applyUserJoin(ch *aclpb.ACLUserJoin) error { invite, exists := st.userInvites[ch.UserInviteId] if !exists { return fmt.Errorf("no such invite with id %s", ch.UserInviteId) } + chIdentity := string(ch.Identity) - if _, exists = st.userStates[ch.Identity]; exists { + if _, exists = st.userStates[chIdentity]; exists { return ErrUserAlreadyExists } @@ -241,12 +244,7 @@ func (st *ACLState) applyUserJoin(ch *aclpb.ACLChangeUserJoin) error { return fmt.Errorf("public key verifying invite accepts is given in incorrect format: %v", err) } - rawSignedId, err := st.signingPubKeyDecoder.DecodeFromStringIntoBytes(ch.Identity) - if err != nil { - return fmt.Errorf("failed to decode signing identity as bytes") - } - - res, err := verificationKey.(signingkey.PubKey).Verify(rawSignedId, signature) + res, err := verificationKey.(signingkey.PubKey).Verify(ch.Identity, signature) if err != nil { return fmt.Errorf("verification returned error: %w", err) } @@ -255,7 +253,7 @@ func (st *ACLState) applyUserJoin(ch *aclpb.ACLChangeUserJoin) error { } // if ourselves -> we need to decrypt the read keys - if st.identity == ch.Identity { + if st.identity == chIdentity { for _, key := range ch.EncryptedReadKeys { key, hash, err := st.decryptReadKeyAndHash(key) if err != nil { @@ -267,30 +265,31 @@ func (st *ACLState) applyUserJoin(ch *aclpb.ACLChangeUserJoin) error { } // adding user to the list - userState := &aclpb.ACLChangeUserState{ + userState := &aclpb.ACLUserState{ Identity: ch.Identity, EncryptionKey: ch.EncryptionKey, EncryptedReadKeys: ch.EncryptedReadKeys, Permissions: invite.Permissions, IsConfirmed: true, } - st.userStates[ch.Identity] = userState + st.userStates[chIdentity] = userState return nil } -func (st *ACLState) applyUserAdd(ch *aclpb.ACLChangeUserAdd) error { - if _, exists := st.userStates[ch.Identity]; exists { +func (st *ACLState) applyUserAdd(ch *aclpb.ACLUserAdd) error { + chIdentity := string(ch.Identity) + if _, exists := st.userStates[chIdentity]; exists { return ErrUserAlreadyExists } - st.userStates[ch.Identity] = &aclpb.ACLChangeUserState{ + st.userStates[chIdentity] = &aclpb.ACLUserState{ Identity: ch.Identity, EncryptionKey: ch.EncryptionKey, Permissions: ch.Permissions, EncryptedReadKeys: ch.EncryptedReadKeys, } - if ch.Identity == st.identity { + if chIdentity == st.identity { for _, key := range ch.EncryptedReadKeys { key, hash, err := st.decryptReadKeyAndHash(key) if err != nil { @@ -304,26 +303,28 @@ func (st *ACLState) applyUserAdd(ch *aclpb.ACLChangeUserAdd) error { return nil } -func (st *ACLState) applyUserRemove(ch *aclpb.ACLChangeUserRemove) error { - if ch.Identity == st.identity { +func (st *ACLState) applyUserRemove(ch *aclpb.ACLUserRemove) error { + chIdentity := string(ch.Identity) + if chIdentity == st.identity { return ErrDocumentForbidden } - if _, exists := st.userStates[ch.Identity]; !exists { + if _, exists := st.userStates[chIdentity]; !exists { return ErrNoSuchUser } - delete(st.userStates, ch.Identity) + delete(st.userStates, chIdentity) for _, replace := range ch.ReadKeyReplaces { - userState, exists := st.userStates[replace.Identity] + repIdentity := string(replace.Identity) + userState, exists := st.userStates[repIdentity] if !exists { continue } userState.EncryptedReadKeys = append(userState.EncryptedReadKeys, replace.EncryptedReadKey) // if this is our identity then we have to decrypt the key - if replace.Identity == st.identity { + if repIdentity == st.identity { key, hash, err := st.decryptReadKeyAndHash(replace.EncryptedReadKey) if err != nil { return ErrFailedToDecrypt @@ -336,12 +337,13 @@ func (st *ACLState) applyUserRemove(ch *aclpb.ACLChangeUserRemove) error { return nil } -func (st *ACLState) applyUserConfirm(ch *aclpb.ACLChangeUserConfirm) error { - if _, exists := st.userStates[ch.Identity]; !exists { +func (st *ACLState) applyUserConfirm(ch *aclpb.ACLUserConfirm) error { + chIdentity := string(ch.Identity) + if _, exists := st.userStates[chIdentity]; !exists { return ErrNoSuchUser } - userState := st.userStates[ch.Identity] + userState := st.userStates[chIdentity] userState.IsConfirmed = true return nil } @@ -362,8 +364,8 @@ func (st *ACLState) decryptReadKeyAndHash(msg []byte) (*symmetric.Key, uint64, e return key, hasher.Sum64(), nil } -func (st *ACLState) hasPermission(identity string, permission aclpb.ACLChangeUserPermissions) bool { - state, exists := st.userStates[identity] +func (st *ACLState) hasPermission(identity []byte, permission aclpb.ACLUserPermissions) bool { + state, exists := st.userStates[string(identity)] if !exists { return false } @@ -371,17 +373,17 @@ func (st *ACLState) hasPermission(identity string, permission aclpb.ACLChangeUse return state.Permissions == permission } -func (st *ACLState) isUserJoin(data *aclpb.ACLChangeACLData) bool { +func (st *ACLState) isUserJoin(data *aclpb.ACLData) bool { // if we have a UserJoin, then it should always be the first one applied return data.GetAclContent() != nil && data.GetAclContent()[0].GetUserJoin() != nil } -func (st *ACLState) isUserAdd(data *aclpb.ACLChangeACLData, identity string) bool { +func (st *ACLState) isUserAdd(data *aclpb.ACLData, identity []byte) bool { // if we have a UserAdd, then it should always be the first one applied userAdd := data.GetAclContent()[0].GetUserAdd() - return data.GetAclContent() != nil && userAdd != nil && userAdd.GetIdentity() == identity + return data.GetAclContent() != nil && userAdd != nil && bytes.Compare(userAdd.GetIdentity(), identity) == 0 } -func (st *ACLState) GetUserStates() map[string]*aclpb.ACLChangeUserState { +func (st *ACLState) GetUserStates() map[string]*aclpb.ACLUserState { return st.userStates } diff --git a/pkg/acl/list/aclstatebuilder.go b/pkg/acl/list/aclstatebuilder.go index f7a06f51..da79141b 100644 --- a/pkg/acl/list/aclstatebuilder.go +++ b/pkg/acl/list/aclstatebuilder.go @@ -15,7 +15,7 @@ type aclStateBuilder struct { func newACLStateBuilderWithIdentity(decoder keys.Decoder, accountData *account.AccountData) *aclStateBuilder { return &aclStateBuilder{ decoder: decoder, - identity: accountData.Identity, + identity: string(accountData.Identity), key: accountData.EncKey, } } @@ -26,7 +26,7 @@ func newACLStateBuilder(decoder keys.Decoder) *aclStateBuilder { } } -func (sb *aclStateBuilder) Build(records []*Record) (*ACLState, error) { +func (sb *aclStateBuilder) Build(records []*ACLRecord) (*ACLState, error) { var ( err error state *ACLState diff --git a/pkg/acl/list/changebuilder.go b/pkg/acl/list/changebuilder.go index f5d2fa17..c6413cb0 100644 --- a/pkg/acl/list/changebuilder.go +++ b/pkg/acl/list/changebuilder.go @@ -14,7 +14,7 @@ import ( type MarshalledChange = []byte type ACLChangeBuilder interface { - UserAdd(identity string, encryptionKey encryptionkey.PubKey, permissions aclpb.ACLChangeUserPermissions) error + UserAdd(identity string, encryptionKey encryptionkey.PubKey, permissions aclpb.ACLUserPermissions) error AddId(id string) // TODO: this is only for testing } @@ -23,7 +23,7 @@ type aclChangeBuilder struct { list ACLList acc *account.AccountData - aclData *aclpb.ACLChangeACLData + aclData *aclpb.ACLData id string readKey *symmetric.Key readKeyHash uint64 @@ -38,7 +38,7 @@ func (c *aclChangeBuilder) Init(state *ACLState, list ACLList, acc *account.Acco c.list = list c.acc = acc - c.aclData = &aclpb.ACLChangeACLData{} + c.aclData = &aclpb.ACLData{} // setting read key for further encryption etc if state.currentReadKeyHash == 0 { c.readKey, _ = symmetric.NewRandom() @@ -56,7 +56,7 @@ func (c *aclChangeBuilder) AddId(id string) { c.id = id } -func (c *aclChangeBuilder) UserAdd(identity string, encryptionKey encryptionkey.PubKey, permissions aclpb.ACLChangeUserPermissions) error { +func (c *aclChangeBuilder) UserAdd(identity string, encryptionKey encryptionkey.PubKey, permissions aclpb.ACLUserPermissions) error { var allKeys []*symmetric.Key if c.aclState.currentReadKeyHash != 0 { for _, key := range c.aclState.userReadKeys { @@ -79,10 +79,10 @@ func (c *aclChangeBuilder) UserAdd(identity string, encryptionKey encryptionkey. if err != nil { return err } - ch := &aclpb.ACLChangeACLContentValue{ - Value: &aclpb.ACLChangeACLContentValueValueOfUserAdd{ - UserAdd: &aclpb.ACLChangeUserAdd{ - Identity: identity, + ch := &aclpb.ACLContentValue{ + Value: &aclpb.ACLContentValue_UserAdd{ + UserAdd: &aclpb.ACLUserAdd{ + Identity: []byte(identity), EncryptionKey: rawKey, EncryptedReadKeys: encryptedKeys, Permissions: permissions, @@ -93,8 +93,8 @@ func (c *aclChangeBuilder) UserAdd(identity string, encryptionKey encryptionkey. return nil } -func (c *aclChangeBuilder) BuildAndApply() (*Record, []byte, error) { - aclRecord := &aclpb.Record{ +func (c *aclChangeBuilder) BuildAndApply() (*ACLRecord, []byte, error) { + aclRecord := &aclpb.ACLRecord{ PrevId: c.list.Head().Id, CurrentReadKeyHash: c.readKeyHash, Timestamp: int64(time.Now().Nanosecond()), diff --git a/pkg/acl/list/list.go b/pkg/acl/list/list.go index ad924714..3cfedd06 100644 --- a/pkg/acl/list/list.go +++ b/pkg/acl/list/list.go @@ -13,7 +13,7 @@ import ( "sync" ) -type IterFunc = func(record *Record) (IsContinue bool) +type IterFunc = func(record *ACLRecord) (IsContinue bool) var ErrIncorrectCID = errors.New("incorrect CID") @@ -26,20 +26,20 @@ type RWLocker interface { type ACLList interface { RWLocker ID() string - Header() *aclpb.Header - Records() []*Record + Header() *aclpb.ACLHeader + Records() []*ACLRecord ACLState() *ACLState IsAfter(first string, second string) (bool, error) - Head() *Record - Get(id string) (*Record, error) + Head() *ACLRecord + Get(id string) (*ACLRecord, error) Iterate(iterFunc IterFunc) IterateFrom(startId string, iterFunc IterFunc) Close() (err error) } type aclList struct { - header *aclpb.Header - records []*Record + header *aclpb.ACLHeader + records []*ACLRecord indexes map[string]int id string @@ -84,7 +84,7 @@ func buildWithACLStateBuilder(builder *aclStateBuilder, storage storage.ListStor if err != nil { return } - records := []*Record{record} + records := []*ACLRecord{record} for record.Content.PrevId != "" { rawRecord, err = storage.GetRawRecord(context.Background(), record.Content.PrevId) @@ -131,7 +131,7 @@ func buildWithACLStateBuilder(builder *aclStateBuilder, storage storage.ListStor return } -func (a *aclList) Records() []*Record { +func (a *aclList) Records() []*ACLRecord { return a.records } @@ -139,7 +139,7 @@ func (a *aclList) ID() string { return a.id } -func (a *aclList) Header() *aclpb.Header { +func (a *aclList) Header() *aclpb.ACLHeader { return a.header } @@ -156,11 +156,11 @@ func (a *aclList) IsAfter(first string, second string) (bool, error) { return firstRec >= secondRec, nil } -func (a *aclList) Head() *Record { +func (a *aclList) Head() *ACLRecord { return a.records[len(a.records)-1] } -func (a *aclList) Get(id string) (*Record, error) { +func (a *aclList) Get(id string) (*ACLRecord, error) { recIdx, ok := a.indexes[id] if !ok { return nil, fmt.Errorf("no such record") @@ -192,8 +192,8 @@ func (a *aclList) Close() (err error) { return nil } -func verifyRecord(keychain *common.Keychain, rawRecord *aclpb.RawRecord, record *Record) (err error) { - identityKey, err := keychain.GetOrAdd(record.Content.Identity) +func verifyRecord(keychain *common.Keychain, rawRecord *aclpb.RawACLRecord, record *ACLRecord) (err error) { + identityKey, err := keychain.GetOrAdd(record.Identity) if err != nil { return } diff --git a/pkg/acl/list/list_test.go b/pkg/acl/list/list_test.go index 8ca208be..acc5f570 100644 --- a/pkg/acl/list/list_test.go +++ b/pkg/acl/list/list_test.go @@ -28,8 +28,8 @@ func TestAclList_ACLState_UserInviteAndJoin(t *testing.T) { assert.Equal(t, aclpb.ACLChange_Reader, aclList.ACLState().GetUserStates()[idC].Permissions) assert.Equal(t, aclList.Head().Content.CurrentReadKeyHash, aclList.ACLState().CurrentReadKeyHash()) - var records []*Record - aclList.Iterate(func(record *Record) (IsContinue bool) { + var records []*ACLRecord + aclList.Iterate(func(record *ACLRecord) (IsContinue bool) { records = append(records, record) return true }) @@ -69,8 +69,8 @@ func TestAclList_ACLState_UserJoinAndRemove(t *testing.T) { _, exists := aclList.ACLState().GetUserStates()[idB] assert.Equal(t, false, exists) - var records []*Record - aclList.Iterate(func(record *Record) (IsContinue bool) { + var records []*ACLRecord + aclList.Iterate(func(record *ACLRecord) (IsContinue bool) { records = append(records, record) return true }) diff --git a/pkg/acl/list/record.go b/pkg/acl/list/record.go index 724bd94e..1cf10e59 100644 --- a/pkg/acl/list/record.go +++ b/pkg/acl/list/record.go @@ -5,30 +5,33 @@ import ( "github.com/gogo/protobuf/proto" ) -type Record struct { - Id string - Content *aclpb.Record - Model interface{} - Sign []byte +type ACLRecord struct { + Id string + Content *aclpb.ACLRecord + Identity string + Model interface{} + Sign []byte } -func NewRecord(id string, aclRecord *aclpb.Record) *Record { - return &Record{ - Id: id, - Content: aclRecord, +func NewRecord(id string, aclRecord *aclpb.ACLRecord) *ACLRecord { + return &ACLRecord{ + Id: id, + Content: aclRecord, + Identity: string(aclRecord.Identity), } } -func NewFromRawRecord(rawRec *aclpb.RawRecord) (*Record, error) { - aclRec := &aclpb.Record{} +func NewFromRawRecord(rawRec *aclpb.RawACLRecord) (*ACLRecord, error) { + aclRec := &aclpb.ACLRecord{} err := proto.Unmarshal(rawRec.Payload, aclRec) if err != nil { return nil, err } - return &Record{ - Id: rawRec.Id, - Content: aclRec, - Sign: rawRec.Signature, + return &ACLRecord{ + Id: rawRec.Id, + Content: aclRec, + Sign: rawRec.Signature, + Identity: string(aclRec.Identity), }, nil } diff --git a/pkg/acl/storage/inmemory.go b/pkg/acl/storage/inmemory.go index 16879c38..7f6af367 100644 --- a/pkg/acl/storage/inmemory.go +++ b/pkg/acl/storage/inmemory.go @@ -8,8 +8,8 @@ import ( ) type inMemoryACLListStorage struct { - header *aclpb.Header - records []*aclpb.RawRecord + header *aclpb.ACLHeader + records []*aclpb.RawACLRecord id string @@ -18,8 +18,8 @@ type inMemoryACLListStorage struct { func NewInMemoryACLListStorage( id string, - header *aclpb.Header, - records []*aclpb.RawRecord) (ListStorage, error) { + header *aclpb.ACLHeader, + records []*aclpb.RawACLRecord) (ListStorage, error) { return &inMemoryACLListStorage{ id: id, header: header, @@ -28,19 +28,19 @@ func NewInMemoryACLListStorage( }, nil } -func (i *inMemoryACLListStorage) Header() (*aclpb.Header, error) { +func (i *inMemoryACLListStorage) Header() (*aclpb.ACLHeader, error) { i.RLock() defer i.RUnlock() return i.header, nil } -func (i *inMemoryACLListStorage) Head() (*aclpb.RawRecord, error) { +func (i *inMemoryACLListStorage) Head() (*aclpb.RawACLRecord, error) { i.RLock() defer i.RUnlock() return i.records[len(i.records)-1], nil } -func (i *inMemoryACLListStorage) GetRawRecord(ctx context.Context, id string) (*aclpb.RawRecord, error) { +func (i *inMemoryACLListStorage) GetRawRecord(ctx context.Context, id string) (*aclpb.RawACLRecord, error) { i.RLock() defer i.RUnlock() for _, rec := range i.records { @@ -51,7 +51,7 @@ func (i *inMemoryACLListStorage) GetRawRecord(ctx context.Context, id string) (* return nil, fmt.Errorf("no such record") } -func (i *inMemoryACLListStorage) AddRawRecord(ctx context.Context, rec *aclpb.RawRecord) error { +func (i *inMemoryACLListStorage) AddRawRecord(ctx context.Context, rec *aclpb.RawACLRecord) error { panic("implement me") } @@ -63,19 +63,19 @@ func (i *inMemoryACLListStorage) ID() (string, error) { type inMemoryTreeStorage struct { id string - header *aclpb.Header + header *aclpb.TreeHeader heads []string - changes map[string]*aclpb.RawChange + changes map[string]*aclpb.RawTreeChangeWithId sync.RWMutex } func NewInMemoryTreeStorage( treeId string, - header *aclpb.Header, + header *aclpb.TreeHeader, heads []string, - changes []*aclpb.RawChange) (TreeStorage, error) { - allChanges := make(map[string]*aclpb.RawChange) + changes []*aclpb.RawTreeChangeWithId) (TreeStorage, error) { + allChanges := make(map[string]*aclpb.RawTreeChangeWithId) for _, ch := range changes { allChanges[ch.Id] = ch } @@ -95,7 +95,7 @@ func (t *inMemoryTreeStorage) ID() (string, error) { return t.id, nil } -func (t *inMemoryTreeStorage) Header() (*aclpb.Header, error) { +func (t *inMemoryTreeStorage) Header() (*aclpb.TreeHeader, error) { t.RLock() defer t.RUnlock() return t.header, nil @@ -118,7 +118,7 @@ func (t *inMemoryTreeStorage) SetHeads(heads []string) error { return nil } -func (t *inMemoryTreeStorage) AddRawChange(change *aclpb.RawChange) error { +func (t *inMemoryTreeStorage) AddRawChange(change *aclpb.RawTreeChangeWithId) error { t.Lock() defer t.Unlock() // TODO: better to do deep copy @@ -126,7 +126,7 @@ func (t *inMemoryTreeStorage) AddRawChange(change *aclpb.RawChange) error { return nil } -func (t *inMemoryTreeStorage) GetRawChange(ctx context.Context, changeId string) (*aclpb.RawChange, error) { +func (t *inMemoryTreeStorage) GetRawChange(ctx context.Context, changeId string) (*aclpb.RawTreeChangeWithId, error) { t.RLock() defer t.RUnlock() if res, exists := t.changes[changeId]; exists { diff --git a/pkg/acl/storage/liststorage.go b/pkg/acl/storage/liststorage.go index ff2ff426..90cb9cdc 100644 --- a/pkg/acl/storage/liststorage.go +++ b/pkg/acl/storage/liststorage.go @@ -7,8 +7,8 @@ import ( type ListStorage interface { Storage - Head() (*aclpb.RawRecord, error) + Head() (*aclpb.RawACLRecord, error) - GetRawRecord(ctx context.Context, id string) (*aclpb.RawRecord, error) - AddRawRecord(ctx context.Context, rec *aclpb.RawRecord) error + GetRawRecord(ctx context.Context, id string) (*aclpb.RawACLRecord, error) + AddRawRecord(ctx context.Context, rec *aclpb.RawACLRecord) error } diff --git a/pkg/acl/storage/provider.go b/pkg/acl/storage/provider.go index 12d47d00..984b21c4 100644 --- a/pkg/acl/storage/provider.go +++ b/pkg/acl/storage/provider.go @@ -9,15 +9,15 @@ var ErrUnknownTreeId = errors.New("tree does not exist") type TreeStorageCreatePayload struct { TreeId string - Header *aclpb.Header - Changes []*aclpb.RawChange + Header *aclpb.TreeHeader + Changes []*aclpb.RawTreeChangeWithId Heads []string } type ACLListStorageCreatePayload struct { ListId string - Header *aclpb.Header - Records []*aclpb.RawRecord + Header *aclpb.ACLHeader + Records []*aclpb.RawACLRecord } type Provider interface { diff --git a/pkg/acl/storage/treestorage.go b/pkg/acl/storage/treestorage.go index d2cf7eec..3a5d8866 100644 --- a/pkg/acl/storage/treestorage.go +++ b/pkg/acl/storage/treestorage.go @@ -10,8 +10,8 @@ type TreeStorage interface { Heads() ([]string, error) SetHeads(heads []string) error - AddRawChange(change *aclpb.RawChange) error - GetRawChange(ctx context.Context, recordID string) (*aclpb.RawChange, error) + AddRawChange(change *aclpb.RawTreeChangeWithId) error + GetRawChange(ctx context.Context, recordID string) (*aclpb.RawTreeChangeWithId, error) } type TreeStorageCreatorFunc = func(payload TreeStorageCreatePayload) (TreeStorage, error) diff --git a/pkg/acl/testutils/acllistbuilder/liststoragebuilder.go b/pkg/acl/testutils/acllistbuilder/liststoragebuilder.go index 324f8733..4dc5086e 100644 --- a/pkg/acl/testutils/acllistbuilder/liststoragebuilder.go +++ b/pkg/acl/testutils/acllistbuilder/liststoragebuilder.go @@ -19,8 +19,8 @@ import ( type ACLListStorageBuilder struct { aclList string - records []*aclpb.Record - rawRecords []*aclpb.RawRecord + records []*aclpb.ACLRecord + rawRecords []*aclpb.RawACLRecord indexes map[string]int keychain *Keychain header *aclpb.Header @@ -29,7 +29,7 @@ type ACLListStorageBuilder struct { func NewACLListStorageBuilder(keychain *Keychain) *ACLListStorageBuilder { return &ACLListStorageBuilder{ - records: make([]*aclpb.Record, 0), + records: make([]*aclpb.ACLRecord, 0), indexes: make(map[string]int), keychain: keychain, } @@ -58,7 +58,7 @@ func NewACLListStorageBuilderFromFile(file string) (*ACLListStorageBuilder, erro return tb, nil } -func (t *ACLListStorageBuilder) createRaw(rec *aclpb.Record) *aclpb.RawRecord { +func (t *ACLListStorageBuilder) createRaw(rec *aclpb.ACLRecord) *aclpb.RawACLRecord { aclMarshaled, err := proto.Marshal(rec) if err != nil { panic("should be able to marshal final acl message!") @@ -71,18 +71,18 @@ func (t *ACLListStorageBuilder) createRaw(rec *aclpb.Record) *aclpb.RawRecord { id, _ := cid.NewCIDFromBytes(aclMarshaled) - return &aclpb.RawRecord{ + return &aclpb.RawACLRecord{ Payload: aclMarshaled, Signature: signature, Id: id, } } -func (t *ACLListStorageBuilder) getRecord(idx int) *aclpb.RawRecord { +func (t *ACLListStorageBuilder) getRecord(idx int) *aclpb.RawACLRecord { return t.rawRecords[idx] } -func (t *ACLListStorageBuilder) Head() (*aclpb.RawRecord, error) { +func (t *ACLListStorageBuilder) Head() (*aclpb.RawACLRecord, error) { return t.getRecord(len(t.records) - 1), nil } @@ -90,7 +90,7 @@ func (t *ACLListStorageBuilder) Header() (*aclpb.Header, error) { return t.header, nil } -func (t *ACLListStorageBuilder) GetRawRecord(ctx context.Context, id string) (*aclpb.RawRecord, error) { +func (t *ACLListStorageBuilder) GetRawRecord(ctx context.Context, id string) (*aclpb.RawACLRecord, error) { recIdx, ok := t.indexes[id] if !ok { return nil, fmt.Errorf("no such record") @@ -98,7 +98,7 @@ func (t *ACLListStorageBuilder) GetRawRecord(ctx context.Context, id string) (*a return t.getRecord(recIdx), nil } -func (t *ACLListStorageBuilder) AddRawRecord(ctx context.Context, rec *aclpb.RawRecord) error { +func (t *ACLListStorageBuilder) AddRawRecord(ctx context.Context, rec *aclpb.RawACLRecord) error { panic("implement me") } @@ -106,7 +106,7 @@ func (t *ACLListStorageBuilder) ID() (string, error) { return t.id, nil } -func (t *ACLListStorageBuilder) GetRawRecords() []*aclpb.RawRecord { +func (t *ACLListStorageBuilder) GetRawRecords() []*aclpb.RawACLRecord { return t.rawRecords } @@ -132,7 +132,7 @@ func (t *ACLListStorageBuilder) Parse(tree *YMLList) { t.createHeaderAndId() } -func (t *ACLListStorageBuilder) parseRecord(rec *Record, prevId string) *aclpb.Record { +func (t *ACLListStorageBuilder) parseRecord(rec *Record, prevId string) *aclpb.ACLRecord { k := t.keychain.GetKey(rec.ReadKey).(*SymKey) var aclChangeContents []*aclpb.ACLChangeACLContentValue for _, ch := range rec.AclChanges { @@ -144,7 +144,7 @@ func (t *ACLListStorageBuilder) parseRecord(rec *Record, prevId string) *aclpb.R } bytes, _ := data.Marshal() - return &aclpb.Record{ + return &aclpb.ACLRecord{ PrevId: prevId, Identity: t.keychain.GetIdentity(rec.Identity), Data: bytes, @@ -163,7 +163,7 @@ func (t *ACLListStorageBuilder) parseACLChange(ch *ACLChange) (convCh *aclpb.ACL convCh = &aclpb.ACLChangeACLContentValue{ Value: &aclpb.ACLChangeACLContentValueValueOfUserAdd{ - UserAdd: &aclpb.ACLChangeUserAdd{ + UserAdd: &aclpb.ACLUserPermissionsAdd{ Identity: t.keychain.GetIdentity(add.Identity), EncryptionKey: rawKey, EncryptedReadKeys: t.encryptReadKeys(add.EncryptedReadKeys, encKey), @@ -187,7 +187,7 @@ func (t *ACLListStorageBuilder) parseACLChange(ch *ACLChange) (convCh *aclpb.ACL convCh = &aclpb.ACLChangeACLContentValue{ Value: &aclpb.ACLChangeACLContentValueValueOfUserJoin{ - UserJoin: &aclpb.ACLChangeUserJoin{ + UserJoin: &aclpb.ACLUserPermissionsJoin{ Identity: t.keychain.GetIdentity(join.Identity), EncryptionKey: rawKey, AcceptSignature: signature, @@ -205,7 +205,7 @@ func (t *ACLListStorageBuilder) parseACLChange(ch *ACLChange) (convCh *aclpb.ACL convCh = &aclpb.ACLChangeACLContentValue{ Value: &aclpb.ACLChangeACLContentValueValueOfUserInvite{ - UserInvite: &aclpb.ACLChangeUserInvite{ + UserInvite: &aclpb.ACLUserPermissionsInvite{ AcceptPublicKey: rawAcceptKey, EncryptPublicKey: rawEncKey, EncryptedReadKeys: t.encryptReadKeys(invite.EncryptedReadKeys, encKey), @@ -219,7 +219,7 @@ func (t *ACLListStorageBuilder) parseACLChange(ch *ACLChange) (convCh *aclpb.ACL convCh = &aclpb.ACLChangeACLContentValue{ Value: &aclpb.ACLChangeACLContentValueValueOfUserConfirm{ - UserConfirm: &aclpb.ACLChangeUserConfirm{ + UserConfirm: &aclpb.ACLUserPermissionsConfirm{ Identity: t.keychain.GetIdentity(confirm.Identity), UserAddId: confirm.UserAddId, }, @@ -230,7 +230,7 @@ func (t *ACLListStorageBuilder) parseACLChange(ch *ACLChange) (convCh *aclpb.ACL convCh = &aclpb.ACLChangeACLContentValue{ Value: &aclpb.ACLChangeACLContentValueValueOfUserPermissionChange{ - UserPermissionChange: &aclpb.ACLChangeUserPermissionChange{ + UserPermissionChange: &aclpb.ACLUserPermissionsPermissionChange{ Identity: t.keychain.GetIdentity(permissionChange.Identity), Permissions: t.convertPermission(permissionChange.Permission), }, @@ -259,7 +259,7 @@ func (t *ACLListStorageBuilder) parseACLChange(ch *ACLChange) (convCh *aclpb.ACL convCh = &aclpb.ACLChangeACLContentValue{ Value: &aclpb.ACLChangeACLContentValueValueOfUserRemove{ - UserRemove: &aclpb.ACLChangeUserRemove{ + UserRemove: &aclpb.ACLUserPermissionsRemove{ Identity: t.keychain.GetIdentity(remove.RemovedIdentity), ReadKeyReplaces: replaces, }, @@ -286,7 +286,7 @@ func (t *ACLListStorageBuilder) encryptReadKeys(keys []string, encKey encryption return } -func (t *ACLListStorageBuilder) convertPermission(perm string) aclpb.ACLChangeUserPermissions { +func (t *ACLListStorageBuilder) convertPermission(perm string) aclpb.ACLUserPermissions { switch perm { case "admin": return aclpb.ACLChange_Admin @@ -299,7 +299,7 @@ func (t *ACLListStorageBuilder) convertPermission(perm string) aclpb.ACLChangeUs } } -func (t *ACLListStorageBuilder) traverseFromHead(f func(rec *aclpb.Record, id string) error) (err error) { +func (t *ACLListStorageBuilder) traverseFromHead(f func(rec *aclpb.ACLRecord, id string) error) (err error) { for i := len(t.records) - 1; i >= 0; i-- { err = f(t.records[i], t.rawRecords[i].Id) if err != nil { diff --git a/pkg/acl/testutils/acllistbuilder/liststoragebuildergraph_nix.go b/pkg/acl/testutils/acllistbuilder/liststoragebuildergraph_nix.go index b637827f..9c7bf581 100644 --- a/pkg/acl/testutils/acllistbuilder/liststoragebuildergraph_nix.go +++ b/pkg/acl/testutils/acllistbuilder/liststoragebuildergraph_nix.go @@ -33,7 +33,7 @@ func (t *ACLListStorageBuilder) Graph() (string, error) { graph.SetDir(true) var nodes = make(map[string]struct{}) - var addNodes = func(r *aclpb.Record, id string) error { + var addNodes = func(r *aclpb.ACLRecord, id string) error { style := "solid" var chSymbs []string @@ -92,7 +92,7 @@ func (t *ACLListStorageBuilder) Graph() (string, error) { return nil } - var addLinks = func(r *aclpb.Record, id string) error { + var addLinks = func(r *aclpb.ACLRecord, id string) error { if r.PrevId == "" { return nil } diff --git a/pkg/acl/testutils/testchanges/proto/test.pb.go b/pkg/acl/testutils/testchanges/proto/test.pb.go index 53be5aba..e8e43c54 100644 --- a/pkg/acl/testutils/testchanges/proto/test.pb.go +++ b/pkg/acl/testutils/testchanges/proto/test.pb.go @@ -58,24 +58,24 @@ func (m *PlainTextChange) XXX_DiscardUnknown() { var xxx_messageInfo_PlainTextChange proto.InternalMessageInfo -type PlainTextChangeContent struct { +type PlainTextChange_Content struct { // Types that are valid to be assigned to Value: - // *PlainTextChangeContentValueOfTextAppend - Value IsPlainTextChangeContentValue `protobuf_oneof:"value"` + // *PlainTextChange_Content_TextAppend + Value isPlainTextChange_Content_Value `protobuf_oneof:"value"` } -func (m *PlainTextChangeContent) Reset() { *m = PlainTextChangeContent{} } -func (m *PlainTextChangeContent) String() string { return proto.CompactTextString(m) } -func (*PlainTextChangeContent) ProtoMessage() {} -func (*PlainTextChangeContent) Descriptor() ([]byte, []int) { +func (m *PlainTextChange_Content) Reset() { *m = PlainTextChange_Content{} } +func (m *PlainTextChange_Content) String() string { return proto.CompactTextString(m) } +func (*PlainTextChange_Content) ProtoMessage() {} +func (*PlainTextChange_Content) Descriptor() ([]byte, []int) { return fileDescriptor_37f33c266ada4318, []int{0, 0} } -func (m *PlainTextChangeContent) XXX_Unmarshal(b []byte) error { +func (m *PlainTextChange_Content) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *PlainTextChangeContent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *PlainTextChange_Content) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_PlainTextChangeContent.Marshal(b, m, deterministic) + return xxx_messageInfo_PlainTextChange_Content.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -85,67 +85,67 @@ func (m *PlainTextChangeContent) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } -func (m *PlainTextChangeContent) XXX_Merge(src proto.Message) { - xxx_messageInfo_PlainTextChangeContent.Merge(m, src) +func (m *PlainTextChange_Content) XXX_Merge(src proto.Message) { + xxx_messageInfo_PlainTextChange_Content.Merge(m, src) } -func (m *PlainTextChangeContent) XXX_Size() int { +func (m *PlainTextChange_Content) XXX_Size() int { return m.Size() } -func (m *PlainTextChangeContent) XXX_DiscardUnknown() { - xxx_messageInfo_PlainTextChangeContent.DiscardUnknown(m) +func (m *PlainTextChange_Content) XXX_DiscardUnknown() { + xxx_messageInfo_PlainTextChange_Content.DiscardUnknown(m) } -var xxx_messageInfo_PlainTextChangeContent proto.InternalMessageInfo +var xxx_messageInfo_PlainTextChange_Content proto.InternalMessageInfo -type IsPlainTextChangeContentValue interface { - IsPlainTextChangeContentValue() +type isPlainTextChange_Content_Value interface { + isPlainTextChange_Content_Value() MarshalTo([]byte) (int, error) Size() int } -type PlainTextChangeContentValueOfTextAppend struct { - TextAppend *PlainTextChangeTextAppend `protobuf:"bytes,1,opt,name=textAppend,proto3,oneof" json:"textAppend,omitempty"` +type PlainTextChange_Content_TextAppend struct { + TextAppend *PlainTextChange_TextAppend `protobuf:"bytes,1,opt,name=textAppend,proto3,oneof" json:"textAppend,omitempty"` } -func (*PlainTextChangeContentValueOfTextAppend) IsPlainTextChangeContentValue() {} +func (*PlainTextChange_Content_TextAppend) isPlainTextChange_Content_Value() {} -func (m *PlainTextChangeContent) GetValue() IsPlainTextChangeContentValue { +func (m *PlainTextChange_Content) GetValue() isPlainTextChange_Content_Value { if m != nil { return m.Value } return nil } -func (m *PlainTextChangeContent) GetTextAppend() *PlainTextChangeTextAppend { - if x, ok := m.GetValue().(*PlainTextChangeContentValueOfTextAppend); ok { +func (m *PlainTextChange_Content) GetTextAppend() *PlainTextChange_TextAppend { + if x, ok := m.GetValue().(*PlainTextChange_Content_TextAppend); ok { return x.TextAppend } return nil } // XXX_OneofWrappers is for the internal use of the proto package. -func (*PlainTextChangeContent) XXX_OneofWrappers() []interface{} { +func (*PlainTextChange_Content) XXX_OneofWrappers() []interface{} { return []interface{}{ - (*PlainTextChangeContentValueOfTextAppend)(nil), + (*PlainTextChange_Content_TextAppend)(nil), } } -type PlainTextChangeTextAppend struct { +type PlainTextChange_TextAppend struct { Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"` } -func (m *PlainTextChangeTextAppend) Reset() { *m = PlainTextChangeTextAppend{} } -func (m *PlainTextChangeTextAppend) String() string { return proto.CompactTextString(m) } -func (*PlainTextChangeTextAppend) ProtoMessage() {} -func (*PlainTextChangeTextAppend) Descriptor() ([]byte, []int) { +func (m *PlainTextChange_TextAppend) Reset() { *m = PlainTextChange_TextAppend{} } +func (m *PlainTextChange_TextAppend) String() string { return proto.CompactTextString(m) } +func (*PlainTextChange_TextAppend) ProtoMessage() {} +func (*PlainTextChange_TextAppend) Descriptor() ([]byte, []int) { return fileDescriptor_37f33c266ada4318, []int{0, 1} } -func (m *PlainTextChangeTextAppend) XXX_Unmarshal(b []byte) error { +func (m *PlainTextChange_TextAppend) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *PlainTextChangeTextAppend) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *PlainTextChange_TextAppend) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_PlainTextChangeTextAppend.Marshal(b, m, deterministic) + return xxx_messageInfo_PlainTextChange_TextAppend.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -155,41 +155,41 @@ func (m *PlainTextChangeTextAppend) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } -func (m *PlainTextChangeTextAppend) XXX_Merge(src proto.Message) { - xxx_messageInfo_PlainTextChangeTextAppend.Merge(m, src) +func (m *PlainTextChange_TextAppend) XXX_Merge(src proto.Message) { + xxx_messageInfo_PlainTextChange_TextAppend.Merge(m, src) } -func (m *PlainTextChangeTextAppend) XXX_Size() int { +func (m *PlainTextChange_TextAppend) XXX_Size() int { return m.Size() } -func (m *PlainTextChangeTextAppend) XXX_DiscardUnknown() { - xxx_messageInfo_PlainTextChangeTextAppend.DiscardUnknown(m) +func (m *PlainTextChange_TextAppend) XXX_DiscardUnknown() { + xxx_messageInfo_PlainTextChange_TextAppend.DiscardUnknown(m) } -var xxx_messageInfo_PlainTextChangeTextAppend proto.InternalMessageInfo +var xxx_messageInfo_PlainTextChange_TextAppend proto.InternalMessageInfo -func (m *PlainTextChangeTextAppend) GetText() string { +func (m *PlainTextChange_TextAppend) GetText() string { if m != nil { return m.Text } return "" } -type PlainTextChangeSnapshot struct { +type PlainTextChange_Snapshot struct { Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"` } -func (m *PlainTextChangeSnapshot) Reset() { *m = PlainTextChangeSnapshot{} } -func (m *PlainTextChangeSnapshot) String() string { return proto.CompactTextString(m) } -func (*PlainTextChangeSnapshot) ProtoMessage() {} -func (*PlainTextChangeSnapshot) Descriptor() ([]byte, []int) { +func (m *PlainTextChange_Snapshot) Reset() { *m = PlainTextChange_Snapshot{} } +func (m *PlainTextChange_Snapshot) String() string { return proto.CompactTextString(m) } +func (*PlainTextChange_Snapshot) ProtoMessage() {} +func (*PlainTextChange_Snapshot) Descriptor() ([]byte, []int) { return fileDescriptor_37f33c266ada4318, []int{0, 2} } -func (m *PlainTextChangeSnapshot) XXX_Unmarshal(b []byte) error { +func (m *PlainTextChange_Snapshot) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *PlainTextChangeSnapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *PlainTextChange_Snapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_PlainTextChangeSnapshot.Marshal(b, m, deterministic) + return xxx_messageInfo_PlainTextChange_Snapshot.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -199,42 +199,42 @@ func (m *PlainTextChangeSnapshot) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } -func (m *PlainTextChangeSnapshot) XXX_Merge(src proto.Message) { - xxx_messageInfo_PlainTextChangeSnapshot.Merge(m, src) +func (m *PlainTextChange_Snapshot) XXX_Merge(src proto.Message) { + xxx_messageInfo_PlainTextChange_Snapshot.Merge(m, src) } -func (m *PlainTextChangeSnapshot) XXX_Size() int { +func (m *PlainTextChange_Snapshot) XXX_Size() int { return m.Size() } -func (m *PlainTextChangeSnapshot) XXX_DiscardUnknown() { - xxx_messageInfo_PlainTextChangeSnapshot.DiscardUnknown(m) +func (m *PlainTextChange_Snapshot) XXX_DiscardUnknown() { + xxx_messageInfo_PlainTextChange_Snapshot.DiscardUnknown(m) } -var xxx_messageInfo_PlainTextChangeSnapshot proto.InternalMessageInfo +var xxx_messageInfo_PlainTextChange_Snapshot proto.InternalMessageInfo -func (m *PlainTextChangeSnapshot) GetText() string { +func (m *PlainTextChange_Snapshot) GetText() string { if m != nil { return m.Text } return "" } -type PlainTextChangeData struct { - Content []*PlainTextChangeContent `protobuf:"bytes,1,rep,name=content,proto3" json:"content,omitempty"` - Snapshot *PlainTextChangeSnapshot `protobuf:"bytes,2,opt,name=snapshot,proto3" json:"snapshot,omitempty"` +type PlainTextChange_Data struct { + Content []*PlainTextChange_Content `protobuf:"bytes,1,rep,name=content,proto3" json:"content,omitempty"` + Snapshot *PlainTextChange_Snapshot `protobuf:"bytes,2,opt,name=snapshot,proto3" json:"snapshot,omitempty"` } -func (m *PlainTextChangeData) Reset() { *m = PlainTextChangeData{} } -func (m *PlainTextChangeData) String() string { return proto.CompactTextString(m) } -func (*PlainTextChangeData) ProtoMessage() {} -func (*PlainTextChangeData) Descriptor() ([]byte, []int) { +func (m *PlainTextChange_Data) Reset() { *m = PlainTextChange_Data{} } +func (m *PlainTextChange_Data) String() string { return proto.CompactTextString(m) } +func (*PlainTextChange_Data) ProtoMessage() {} +func (*PlainTextChange_Data) Descriptor() ([]byte, []int) { return fileDescriptor_37f33c266ada4318, []int{0, 3} } -func (m *PlainTextChangeData) XXX_Unmarshal(b []byte) error { +func (m *PlainTextChange_Data) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *PlainTextChangeData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *PlainTextChange_Data) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_PlainTextChangeData.Marshal(b, m, deterministic) + return xxx_messageInfo_PlainTextChange_Data.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -244,26 +244,26 @@ func (m *PlainTextChangeData) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *PlainTextChangeData) XXX_Merge(src proto.Message) { - xxx_messageInfo_PlainTextChangeData.Merge(m, src) +func (m *PlainTextChange_Data) XXX_Merge(src proto.Message) { + xxx_messageInfo_PlainTextChange_Data.Merge(m, src) } -func (m *PlainTextChangeData) XXX_Size() int { +func (m *PlainTextChange_Data) XXX_Size() int { return m.Size() } -func (m *PlainTextChangeData) XXX_DiscardUnknown() { - xxx_messageInfo_PlainTextChangeData.DiscardUnknown(m) +func (m *PlainTextChange_Data) XXX_DiscardUnknown() { + xxx_messageInfo_PlainTextChange_Data.DiscardUnknown(m) } -var xxx_messageInfo_PlainTextChangeData proto.InternalMessageInfo +var xxx_messageInfo_PlainTextChange_Data proto.InternalMessageInfo -func (m *PlainTextChangeData) GetContent() []*PlainTextChangeContent { +func (m *PlainTextChange_Data) GetContent() []*PlainTextChange_Content { if m != nil { return m.Content } return nil } -func (m *PlainTextChangeData) GetSnapshot() *PlainTextChangeSnapshot { +func (m *PlainTextChange_Data) GetSnapshot() *PlainTextChange_Snapshot { if m != nil { return m.Snapshot } @@ -272,10 +272,10 @@ func (m *PlainTextChangeData) GetSnapshot() *PlainTextChangeSnapshot { func init() { proto.RegisterType((*PlainTextChange)(nil), "anytype.PlainTextChange") - proto.RegisterType((*PlainTextChangeContent)(nil), "anytype.PlainTextChange.Content") - proto.RegisterType((*PlainTextChangeTextAppend)(nil), "anytype.PlainTextChange.TextAppend") - proto.RegisterType((*PlainTextChangeSnapshot)(nil), "anytype.PlainTextChange.Snapshot") - proto.RegisterType((*PlainTextChangeData)(nil), "anytype.PlainTextChange.Data") + proto.RegisterType((*PlainTextChange_Content)(nil), "anytype.PlainTextChange.Content") + proto.RegisterType((*PlainTextChange_TextAppend)(nil), "anytype.PlainTextChange.TextAppend") + proto.RegisterType((*PlainTextChange_Snapshot)(nil), "anytype.PlainTextChange.Snapshot") + proto.RegisterType((*PlainTextChange_Data)(nil), "anytype.PlainTextChange.Data") } func init() { @@ -326,7 +326,7 @@ func (m *PlainTextChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *PlainTextChangeContent) Marshal() (dAtA []byte, err error) { +func (m *PlainTextChange_Content) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -336,12 +336,12 @@ func (m *PlainTextChangeContent) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PlainTextChangeContent) MarshalTo(dAtA []byte) (int, error) { +func (m *PlainTextChange_Content) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PlainTextChangeContent) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *PlainTextChange_Content) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -358,12 +358,12 @@ func (m *PlainTextChangeContent) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *PlainTextChangeContentValueOfTextAppend) MarshalTo(dAtA []byte) (int, error) { +func (m *PlainTextChange_Content_TextAppend) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PlainTextChangeContentValueOfTextAppend) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *PlainTextChange_Content_TextAppend) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) if m.TextAppend != nil { { @@ -379,7 +379,7 @@ func (m *PlainTextChangeContentValueOfTextAppend) MarshalToSizedBuffer(dAtA []by } return len(dAtA) - i, nil } -func (m *PlainTextChangeTextAppend) Marshal() (dAtA []byte, err error) { +func (m *PlainTextChange_TextAppend) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -389,12 +389,12 @@ func (m *PlainTextChangeTextAppend) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PlainTextChangeTextAppend) MarshalTo(dAtA []byte) (int, error) { +func (m *PlainTextChange_TextAppend) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PlainTextChangeTextAppend) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *PlainTextChange_TextAppend) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -409,7 +409,7 @@ func (m *PlainTextChangeTextAppend) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } -func (m *PlainTextChangeSnapshot) Marshal() (dAtA []byte, err error) { +func (m *PlainTextChange_Snapshot) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -419,12 +419,12 @@ func (m *PlainTextChangeSnapshot) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PlainTextChangeSnapshot) MarshalTo(dAtA []byte) (int, error) { +func (m *PlainTextChange_Snapshot) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PlainTextChangeSnapshot) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *PlainTextChange_Snapshot) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -439,7 +439,7 @@ func (m *PlainTextChangeSnapshot) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *PlainTextChangeData) Marshal() (dAtA []byte, err error) { +func (m *PlainTextChange_Data) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -449,12 +449,12 @@ func (m *PlainTextChangeData) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PlainTextChangeData) MarshalTo(dAtA []byte) (int, error) { +func (m *PlainTextChange_Data) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PlainTextChangeData) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *PlainTextChange_Data) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -508,7 +508,7 @@ func (m *PlainTextChange) Size() (n int) { return n } -func (m *PlainTextChangeContent) Size() (n int) { +func (m *PlainTextChange_Content) Size() (n int) { if m == nil { return 0 } @@ -520,7 +520,7 @@ func (m *PlainTextChangeContent) Size() (n int) { return n } -func (m *PlainTextChangeContentValueOfTextAppend) Size() (n int) { +func (m *PlainTextChange_Content_TextAppend) Size() (n int) { if m == nil { return 0 } @@ -532,7 +532,7 @@ func (m *PlainTextChangeContentValueOfTextAppend) Size() (n int) { } return n } -func (m *PlainTextChangeTextAppend) Size() (n int) { +func (m *PlainTextChange_TextAppend) Size() (n int) { if m == nil { return 0 } @@ -545,7 +545,7 @@ func (m *PlainTextChangeTextAppend) Size() (n int) { return n } -func (m *PlainTextChangeSnapshot) Size() (n int) { +func (m *PlainTextChange_Snapshot) Size() (n int) { if m == nil { return 0 } @@ -558,7 +558,7 @@ func (m *PlainTextChangeSnapshot) Size() (n int) { return n } -func (m *PlainTextChangeData) Size() (n int) { +func (m *PlainTextChange_Data) Size() (n int) { if m == nil { return 0 } @@ -633,7 +633,7 @@ func (m *PlainTextChange) Unmarshal(dAtA []byte) error { } return nil } -func (m *PlainTextChangeContent) Unmarshal(dAtA []byte) error { +func (m *PlainTextChange_Content) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -691,11 +691,11 @@ func (m *PlainTextChangeContent) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &PlainTextChangeTextAppend{} + v := &PlainTextChange_TextAppend{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Value = &PlainTextChangeContentValueOfTextAppend{v} + m.Value = &PlainTextChange_Content_TextAppend{v} iNdEx = postIndex default: iNdEx = preIndex @@ -718,7 +718,7 @@ func (m *PlainTextChangeContent) Unmarshal(dAtA []byte) error { } return nil } -func (m *PlainTextChangeTextAppend) Unmarshal(dAtA []byte) error { +func (m *PlainTextChange_TextAppend) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -800,7 +800,7 @@ func (m *PlainTextChangeTextAppend) Unmarshal(dAtA []byte) error { } return nil } -func (m *PlainTextChangeSnapshot) Unmarshal(dAtA []byte) error { +func (m *PlainTextChange_Snapshot) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -882,7 +882,7 @@ func (m *PlainTextChangeSnapshot) Unmarshal(dAtA []byte) error { } return nil } -func (m *PlainTextChangeData) Unmarshal(dAtA []byte) error { +func (m *PlainTextChange_Data) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -940,7 +940,7 @@ func (m *PlainTextChangeData) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Content = append(m.Content, &PlainTextChangeContent{}) + m.Content = append(m.Content, &PlainTextChange_Content{}) if err := m.Content[len(m.Content)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -975,7 +975,7 @@ func (m *PlainTextChangeData) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Snapshot == nil { - m.Snapshot = &PlainTextChangeSnapshot{} + m.Snapshot = &PlainTextChange_Snapshot{} } if err := m.Snapshot.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/pkg/acl/tree/change.go b/pkg/acl/tree/change.go index 514cf862..cefc9327 100644 --- a/pkg/acl/tree/change.go +++ b/pkg/acl/tree/change.go @@ -16,7 +16,7 @@ var ( type ChangeContent struct { ChangesData proto.Marshaler - ACLData *aclpb.ACLChangeACLData + ACLData *aclpb.ACLData Id string // TODO: this is just for testing, because id should be created automatically from content } @@ -34,8 +34,9 @@ type Change struct { visited bool branchesFinished bool - Content *aclpb.Change - Sign []byte + Content *aclpb.TreeChange + Identity string + Sign []byte } func (ch *Change) ProtoChange() proto.Marshaler { @@ -56,7 +57,7 @@ func (ch *Change) DecryptContents(key *symmetric.Key) error { return nil } -func NewChange(id string, ch *aclpb.Change, signature []byte) *Change { +func NewChange(id string, ch *aclpb.TreeChange, signature []byte) *Change { return &Change{ Next: nil, PreviousIds: ch.TreeHeadIds, @@ -64,6 +65,7 @@ func NewChange(id string, ch *aclpb.Change, signature []byte) *Change { Content: ch, SnapshotId: ch.SnapshotBaseId, IsSnapshot: ch.IsSnapshot, + Identity: string(ch.Identity), Sign: signature, } } diff --git a/pkg/acl/tree/changebuilder.go b/pkg/acl/tree/changebuilder.go index edaa93a2..3a2f0701 100644 --- a/pkg/acl/tree/changebuilder.go +++ b/pkg/acl/tree/changebuilder.go @@ -1,6 +1,7 @@ package tree import ( + "errors" "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/aclchanges/aclpb" "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/common" "github.com/anytypeio/go-anytype-infrastructure-experiments/util/cid" @@ -10,25 +11,24 @@ import ( "time" ) -const componentBuilder = "tree.changebuilder" +var ErrEmptyChange = errors.New("change payload should not be empty") type BuilderContent struct { treeHeadIds []string aclHeadId string snapshotBaseId string currentReadKeyHash uint64 - identity string + identity []byte isSnapshot bool signingKey signingkey.PrivKey readKey *symmetric.Key - content proto.Marshaler + content []byte } type ChangeBuilder interface { - ConvertFromRaw(rawChange *aclpb.RawChange) (ch *Change, err error) - ConvertFromRawAndVerify(rawChange *aclpb.RawChange) (ch *Change, err error) - BuildContent(payload BuilderContent) (ch *Change, raw *aclpb.RawChange, err error) - BuildRaw(ch *Change) (*aclpb.RawChange, error) + ConvertFromRaw(rawIdChange *aclpb.RawTreeChangeWithId, verify bool) (ch *Change, err error) + BuildContent(payload BuilderContent) (ch *Change, raw *aclpb.RawTreeChangeWithId, err error) + BuildRaw(ch *Change) (*aclpb.RawTreeChangeWithId, error) } type changeBuilder struct { @@ -39,49 +39,55 @@ func newChangeBuilder(keys *common.Keychain) ChangeBuilder { return &changeBuilder{keys: keys} } -func (c *changeBuilder) ConvertFromRaw(rawChange *aclpb.RawChange) (ch *Change, err error) { - unmarshalled := &aclpb.Change{} - err = proto.Unmarshal(rawChange.Payload, unmarshalled) - if err != nil { - return nil, err +func (c *changeBuilder) ConvertFromRaw(rawIdChange *aclpb.RawTreeChangeWithId, verify bool) (ch *Change, err error) { + if rawIdChange.GetRawChange() == nil { + err = ErrEmptyChange + return } - ch = NewChange(rawChange.Id, unmarshalled, rawChange.Signature) + if verify { + // verifying ID + if !cid.VerifyCID(rawIdChange.RawChange, rawIdChange.Id) { + err = ErrIncorrectCID + return + } + } + + raw := &aclpb.RawTreeChange{} + err = proto.Unmarshal(rawIdChange.GetRawChange(), raw) + if err != nil { + return + } + + if verify { + identityKey, err := c.keys.GetOrAdd(ch.Identity) + if err != nil { + return + } + + // verifying signature + res, err := identityKey.Verify(raw.Payload, raw.Signature) + if err != nil { + return + } + if !res { + err = ErrIncorrectSignature + return + } + } + + unmarshalled := &aclpb.TreeChange{} + err = proto.Unmarshal(raw.Payload, unmarshalled) + if err != nil { + return + } + + ch = NewChange(rawIdChange.Id, unmarshalled, raw.Signature) return } -func (c *changeBuilder) ConvertFromRawAndVerify(rawChange *aclpb.RawChange) (ch *Change, err error) { - unmarshalled := &aclpb.Change{} - ch, err = c.ConvertFromRaw(rawChange) - if err != nil { - return nil, err - } - - identityKey, err := c.keys.GetOrAdd(unmarshalled.Identity) - if err != nil { - return - } - - // verifying signature - res, err := identityKey.Verify(rawChange.Payload, rawChange.Signature) - if err != nil { - return - } - if !res { - err = ErrIncorrectSignature - return - } - - // verifying ID - if !cid.VerifyCID(rawChange.Payload, rawChange.Id) { - err = ErrIncorrectCID - } - - return -} - -func (c *changeBuilder) BuildContent(payload BuilderContent) (ch *Change, raw *aclpb.RawChange, err error) { - aclChange := &aclpb.Change{ +func (c *changeBuilder) BuildContent(payload BuilderContent) (ch *Change, rawIdChange *aclpb.RawTreeChangeWithId, err error) { + change := &aclpb.TreeChange{ TreeHeadIds: payload.treeHeadIds, AclHeadId: payload.aclHeadId, SnapshotBaseId: payload.snapshotBaseId, @@ -90,53 +96,65 @@ func (c *changeBuilder) BuildContent(payload BuilderContent) (ch *Change, raw *a Identity: payload.identity, IsSnapshot: payload.isSnapshot, } - marshalledData, err := payload.content.Marshal() + + encrypted, err := payload.readKey.Encrypt(payload.content) + if err != nil { + return + } + change.ChangesData = encrypted + + marshalledChange, err := proto.Marshal(change) if err != nil { return } - encrypted, err := payload.readKey.Encrypt(marshalledData) - if err != nil { - return - } - aclChange.ChangesData = encrypted - - fullMarshalledChange, err := proto.Marshal(aclChange) + signature, err := payload.signingKey.Sign(marshalledChange) if err != nil { return } - signature, err := payload.signingKey.Sign(fullMarshalledChange) + raw := &aclpb.RawTreeChange{ + Payload: marshalledChange, + Signature: signature, + } + + marshalledRawChange, err := proto.Marshal(raw) if err != nil { return } - id, err := cid.NewCIDFromBytes(fullMarshalledChange) + id, err := cid.NewCIDFromBytes(marshalledRawChange) if err != nil { return } - ch = NewChange(id, aclChange, signature) + ch = NewChange(id, change, signature) ch.ParsedModel = payload.content - raw = &aclpb.RawChange{ - Payload: fullMarshalledChange, - Signature: signature, + rawIdChange = &aclpb.RawTreeChangeWithId{ + RawChange: marshalledRawChange, Id: id, } return } -func (c *changeBuilder) BuildRaw(ch *Change) (raw *aclpb.RawChange, err error) { +func (c *changeBuilder) BuildRaw(ch *Change) (raw *aclpb.RawTreeChangeWithId, err error) { var marshalled []byte marshalled, err = ch.Content.Marshal() if err != nil { return } - raw = &aclpb.RawChange{ + marshalledRawChange, err := proto.Marshal(&aclpb.RawTreeChange{ Payload: marshalled, - Signature: ch.Signature(), + Signature: ch.Sign, + }) + if err != nil { + return + } + + raw = &aclpb.RawTreeChangeWithId{ + RawChange: marshalledRawChange, Id: ch.Id, } return diff --git a/pkg/acl/tree/changevalidator.go b/pkg/acl/tree/changevalidator.go index 2f582c33..1dfac831 100644 --- a/pkg/acl/tree/changevalidator.go +++ b/pkg/acl/tree/changevalidator.go @@ -48,7 +48,7 @@ func (v *objectTreeValidator) validateChange(tree *Tree, aclList list.ACLList, c return } - if perm.Permission != aclpb.ACLChange_Writer && perm.Permission != aclpb.ACLChange_Admin { + if perm.Permission != aclpb.ACLUserPermissions_Writer && perm.Permission != aclpb.ACLUserPermissions_Admin { err = list.ErrInsufficientPermissions return } diff --git a/pkg/acl/tree/objecttree.go b/pkg/acl/tree/objecttree.go index 114e61ba..c6ffeca7 100644 --- a/pkg/acl/tree/objecttree.go +++ b/pkg/acl/tree/objecttree.go @@ -8,8 +8,6 @@ import ( "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/list" "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/storage" "github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys/symmetric" - "github.com/anytypeio/go-anytype-infrastructure-experiments/util/slice" - "go.uber.org/zap" "sync" ) @@ -34,7 +32,7 @@ type AddResultSummary int type AddResult struct { OldHeads []string Heads []string - Added []*aclpb.RawChange + Added []*aclpb.RawTreeChangeWithId Mode Mode } @@ -46,7 +44,7 @@ type ObjectTree interface { RWLocker ID() string - Header() *aclpb.Header + Header() *aclpb.TreeHeader Heads() []string Root() *Change HasChange(string) bool @@ -55,13 +53,13 @@ type ObjectTree interface { IterateFrom(id string, convert ChangeConvertFunc, iterate ChangeIterateFunc) error SnapshotPath() []string - ChangesAfterCommonSnapshot(snapshotPath, heads []string) ([]*aclpb.RawChange, error) + ChangesAfterCommonSnapshot(snapshotPath, heads []string) ([]*aclpb.RawTreeChangeWithId, error) Storage() storage.TreeStorage DebugDump() (string, error) - AddContent(ctx context.Context, content SignableChangeContent) (*aclpb.RawChange, error) - AddRawChanges(ctx context.Context, changes ...*aclpb.RawChange) (AddResult, error) + AddContent(ctx context.Context, content SignableChangeContent) (*aclpb.RawTreeChangeWithId, error) + AddRawChanges(ctx context.Context, changes ...*aclpb.RawTreeChangeWithId) (AddResult, error) Close() error } @@ -76,13 +74,13 @@ type objectTree struct { aclList list.ACLList id string - header *aclpb.Header + header *aclpb.TreeHeader tree *Tree keys map[uint64]*symmetric.Key // buffers - difSnapshotBuf []*aclpb.RawChange + difSnapshotBuf []*aclpb.RawTreeChangeWithId tmpChangesBuf []*Change newSnapshotsBuf []*Change notSeenIdxBuf []int @@ -121,65 +119,6 @@ func defaultObjectTreeDeps( } } -func buildObjectTree(deps objectTreeDeps) (ObjectTree, error) { - objTree := &objectTree{ - treeStorage: deps.treeStorage, - updateListener: deps.updateListener, - treeBuilder: deps.treeBuilder, - validator: deps.validator, - aclList: deps.aclList, - changeBuilder: deps.changeBuilder, - rawChangeLoader: deps.rawChangeLoader, - tree: nil, - keys: make(map[uint64]*symmetric.Key), - tmpChangesBuf: make([]*Change, 0, 10), - difSnapshotBuf: make([]*aclpb.RawChange, 0, 10), - notSeenIdxBuf: make([]int, 0, 10), - newSnapshotsBuf: make([]*Change, 0, 10), - } - - err := objTree.rebuildFromStorage(nil) - if err != nil { - return nil, err - } - storageHeads, err := objTree.treeStorage.Heads() - if err != nil { - return nil, err - } - - // comparing rebuilt heads with heads in storage - // in theory it can happen that we didn't set heads because the process has crashed - // therefore we want to set them later - if !slice.UnsortedEquals(storageHeads, objTree.tree.Heads()) { - log.With(zap.Strings("storage", storageHeads), zap.Strings("rebuilt", objTree.tree.Heads())). - Errorf("the heads in storage and objTree are different") - err = objTree.treeStorage.SetHeads(objTree.tree.Heads()) - if err != nil { - return nil, err - } - } - - objTree.id, err = objTree.treeStorage.ID() - if err != nil { - return nil, err - } - objTree.header, err = objTree.treeStorage.Header() - if err != nil { - return nil, err - } - - if objTree.updateListener != nil { - objTree.updateListener.Rebuild(objTree) - } - - return objTree, nil -} - -func BuildObjectTree(treeStorage storage.TreeStorage, listener ObjectTreeUpdateListener, aclList list.ACLList) (ObjectTree, error) { - deps := defaultObjectTreeDeps(treeStorage, listener, aclList) - return buildObjectTree(deps) -} - func (ot *objectTree) rebuildFromStorage(newChanges []*Change) (err error) { ot.treeBuilder.Reset() @@ -201,7 +140,7 @@ func (ot *objectTree) ID() string { return ot.id } -func (ot *objectTree) Header() *aclpb.Header { +func (ot *objectTree) Header() *aclpb.TreeHeader { return ot.header } @@ -209,7 +148,7 @@ func (ot *objectTree) Storage() storage.TreeStorage { return ot.treeStorage } -func (ot *objectTree) AddContent(ctx context.Context, content SignableChangeContent) (rawChange *aclpb.RawChange, err error) { +func (ot *objectTree) AddContent(ctx context.Context, content SignableChangeContent) (rawChange *aclpb.RawTreeChangeWithId, err error) { defer func() { if err == nil && ot.updateListener != nil { ot.updateListener.Update(ot) @@ -258,12 +197,12 @@ func (ot *objectTree) prepareBuilderContent(content SignableChangeContent) (cnt isSnapshot: content.IsSnapshot, signingKey: content.Key, readKey: readKey, - content: content.Proto, + content: content.Data, } return } -func (ot *objectTree) AddRawChanges(ctx context.Context, rawChanges ...*aclpb.RawChange) (addResult AddResult, err error) { +func (ot *objectTree) AddRawChanges(ctx context.Context, rawChanges ...*aclpb.RawTreeChangeWithId) (addResult AddResult, err error) { var mode Mode mode, addResult, err = ot.addRawChanges(ctx, rawChanges...) if err != nil { @@ -302,7 +241,7 @@ func (ot *objectTree) AddRawChanges(ctx context.Context, rawChanges ...*aclpb.Ra return } -func (ot *objectTree) addRawChanges(ctx context.Context, rawChanges ...*aclpb.RawChange) (mode Mode, addResult AddResult, err error) { +func (ot *objectTree) addRawChanges(ctx context.Context, rawChanges ...*aclpb.RawTreeChangeWithId) (mode Mode, addResult AddResult, err error) { // resetting buffers ot.tmpChangesBuf = ot.tmpChangesBuf[:0] ot.notSeenIdxBuf = ot.notSeenIdxBuf[:0] @@ -329,7 +268,7 @@ func (ot *objectTree) addRawChanges(ctx context.Context, rawChanges ...*aclpb.Ra } var change *Change - change, err = ot.changeBuilder.ConvertFromRawAndVerify(ch) + change, err = ot.changeBuilder.ConvertFromRaw(ch, true) if err != nil { return } @@ -354,7 +293,7 @@ func (ot *objectTree) addRawChanges(ctx context.Context, rawChanges ...*aclpb.Ra // returns changes that we added to the tree as attached this round // they can include not only the changes that were added now, // but also the changes that were previously in the tree - getAddedChanges := func(toConvert []*Change) (added []*aclpb.RawChange, err error) { + getAddedChanges := func(toConvert []*Change) (added []*aclpb.RawTreeChangeWithId, err error) { alreadyConverted := make(map[*Change]struct{}) // first we see if we have already unmarshalled those changes @@ -379,7 +318,7 @@ func (ot *objectTree) addRawChanges(ctx context.Context, rawChanges ...*aclpb.Ra for _, ch := range toConvert { // if we got some changes that we need to convert to raw if _, exists := alreadyConverted[ch]; !exists { - var raw *aclpb.RawChange + var raw *aclpb.RawTreeChangeWithId raw, err = ot.changeBuilder.BuildRaw(ch) if err != nil { return @@ -421,7 +360,7 @@ func (ot *objectTree) addRawChanges(ctx context.Context, rawChanges ...*aclpb.Ra ot.rebuildFromStorage(nil) return } - var added []*aclpb.RawChange + var added []*aclpb.RawTreeChangeWithId added, err = getAddedChanges(nil) // we shouldn't get any error in this case if err != nil { @@ -457,7 +396,7 @@ func (ot *objectTree) addRawChanges(ctx context.Context, rawChanges ...*aclpb.Ra err = ErrHasInvalidChanges return } - var added []*aclpb.RawChange + var added []*aclpb.RawTreeChangeWithId added, err = getAddedChanges(treeChangesAdded) if err != nil { // that means that some unattached changes were somehow corrupted in memory @@ -553,7 +492,7 @@ func (ot *objectTree) SnapshotPath() []string { return path } -func (ot *objectTree) ChangesAfterCommonSnapshot(theirPath, theirHeads []string) ([]*aclpb.RawChange, error) { +func (ot *objectTree) ChangesAfterCommonSnapshot(theirPath, theirHeads []string) ([]*aclpb.RawTreeChangeWithId, error) { var ( needFullDocument = len(theirPath) == 0 ourPath = ot.SnapshotPath() @@ -577,11 +516,11 @@ func (ot *objectTree) ChangesAfterCommonSnapshot(theirPath, theirHeads []string) } } -func (ot *objectTree) getChangesFromTree(theirHeads []string) (rawChanges []*aclpb.RawChange, err error) { +func (ot *objectTree) getChangesFromTree(theirHeads []string) (rawChanges []*aclpb.RawTreeChangeWithId, err error) { return ot.rawChangeLoader.LoadFromTree(ot.tree, theirHeads) } -func (ot *objectTree) getChangesFromDB(commonSnapshot string, theirHeads []string) (rawChanges []*aclpb.RawChange, err error) { +func (ot *objectTree) getChangesFromDB(commonSnapshot string, theirHeads []string) (rawChanges []*aclpb.RawTreeChangeWithId, err error) { return ot.rawChangeLoader.LoadFromStorage(commonSnapshot, ot.tree.headIds, theirHeads) } diff --git a/pkg/acl/tree/objecttree_test.go b/pkg/acl/tree/objecttree_test.go index 991eddd7..c73ce3ff 100644 --- a/pkg/acl/tree/objecttree_test.go +++ b/pkg/acl/tree/objecttree_test.go @@ -15,7 +15,7 @@ import ( type mockChangeCreator struct{} func (c *mockChangeCreator) createRaw(id, aclId, snapshotId string, isSnapshot bool, prevIds ...string) *aclpb.RawChange { - aclChange := &aclpb.Change{ + aclChange := &aclpb.TreeChange{ TreeHeadIds: prevIds, AclHeadId: aclId, SnapshotBaseId: snapshotId, @@ -23,22 +23,27 @@ func (c *mockChangeCreator) createRaw(id, aclId, snapshotId string, isSnapshot b IsSnapshot: isSnapshot, } res, _ := aclChange.Marshal() - return &aclpb.RawChange{ + + raw := &aclpb.RawTreeChange{ Payload: res, Signature: nil, + } + rawMarshalled, _ := raw.Marshal() + + return &aclpb.RawTreeChangeWithId{ + RawChange: rawMarshalled, Id: id, } } func (c *mockChangeCreator) createNewTreeStorage(treeId, aclListId, aclHeadId, firstChangeId string) storage.TreeStorage { firstChange := c.createRaw(firstChangeId, aclHeadId, "", true) - header := &aclpb.Header{ - FirstId: firstChangeId, - AclListId: aclListId, - WorkspaceId: "", - DocType: aclpb.Header_DocTree, + header := &aclpb.TreeHeader{ + FirstId: firstChangeId, + AclId: aclListId, + TreeHeaderType: aclpb.TreeHeaderType_Object, } - treeStorage, _ := storage.NewInMemoryTreeStorage(treeId, header, []string{firstChangeId}, []*aclpb.RawChange{firstChange}) + treeStorage, _ := storage.NewInMemoryTreeStorage(treeId, header, []string{firstChangeId}, []*aclpb.RawTreeChangeWithId{firstChange}) return treeStorage } diff --git a/pkg/acl/tree/objecttreefactory.go b/pkg/acl/tree/objecttreefactory.go new file mode 100644 index 00000000..a62c8add --- /dev/null +++ b/pkg/acl/tree/objecttreefactory.go @@ -0,0 +1,161 @@ +package tree + +import ( + "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/account" + "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/aclchanges/aclpb" + "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/list" + "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/storage" + "github.com/anytypeio/go-anytype-infrastructure-experiments/util/cid" + "github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys/symmetric" + "github.com/anytypeio/go-anytype-infrastructure-experiments/util/slice" + "github.com/gogo/protobuf/proto" + "go.uber.org/zap" +) + +type ObjectTreeCreatePayload struct { + AccountData *account.AccountData + HeaderData []byte + ChangeData []byte + TreeType aclpb.TreeHeaderType +} + +func BuildObjectTree(treeStorage storage.TreeStorage, listener ObjectTreeUpdateListener, aclList list.ACLList) (ObjectTree, error) { + deps := defaultObjectTreeDeps(treeStorage, listener, aclList) + return buildObjectTree(deps) +} + +func CreateObjectTree( + payload ObjectTreeCreatePayload, + listener ObjectTreeUpdateListener, + aclList list.ACLList, + createStorage storage.TreeStorageCreatorFunc) (objTree ObjectTree, err error) { + aclList.RLock() + var ( + deps = defaultObjectTreeDeps(nil, listener, aclList) + state = aclList.ACLState() + aclId = aclList.ID() + aclHeadId = aclList.Head().Id + readKeyHash = state.CurrentReadKeyHash() + ) + readKey, err := state.CurrentReadKey() + aclList.RUnlock() + + if err != nil { + return + } + + // create first change + cnt := BuilderContent{ + treeHeadIds: nil, + aclHeadId: aclHeadId, + snapshotBaseId: "", + currentReadKeyHash: readKeyHash, + isSnapshot: true, + readKey: readKey, + identity: payload.AccountData.Identity, + signingKey: payload.AccountData.SignKey, + content: payload.ChangeData, + } + + _, raw, err := deps.changeBuilder.BuildContent(cnt) + if err != nil { + return + } + + // create header + header, id, err := createTreeHeaderAndId( + raw, + payload.TreeType, + aclId, + payload.AccountData.Identity, + payload.HeaderData) + if err != nil { + return + } + + // create storage + st, err := createStorage(storage.TreeStorageCreatePayload{ + TreeId: id, + Header: header, + Changes: []*aclpb.RawTreeChangeWithId{raw}, + Heads: []string{raw.Id}, + }) + if err != nil { + return + } + + deps.treeStorage = st + return buildObjectTree(deps) +} + +func buildObjectTree(deps objectTreeDeps) (ObjectTree, error) { + objTree := &objectTree{ + treeStorage: deps.treeStorage, + updateListener: deps.updateListener, + treeBuilder: deps.treeBuilder, + validator: deps.validator, + aclList: deps.aclList, + changeBuilder: deps.changeBuilder, + rawChangeLoader: deps.rawChangeLoader, + tree: nil, + keys: make(map[uint64]*symmetric.Key), + tmpChangesBuf: make([]*Change, 0, 10), + difSnapshotBuf: make([]*aclpb.RawTreeChangeWithId, 0, 10), + notSeenIdxBuf: make([]int, 0, 10), + newSnapshotsBuf: make([]*Change, 0, 10), + } + + err := objTree.rebuildFromStorage(nil) + if err != nil { + return nil, err + } + storageHeads, err := objTree.treeStorage.Heads() + if err != nil { + return nil, err + } + + // comparing rebuilt heads with heads in storage + // in theory it can happen that we didn't set heads because the process has crashed + // therefore we want to set them later + if !slice.UnsortedEquals(storageHeads, objTree.tree.Heads()) { + log.With(zap.Strings("storage", storageHeads), zap.Strings("rebuilt", objTree.tree.Heads())). + Errorf("the heads in storage and objTree are different") + err = objTree.treeStorage.SetHeads(objTree.tree.Heads()) + if err != nil { + return nil, err + } + } + + objTree.id, err = objTree.treeStorage.ID() + if err != nil { + return nil, err + } + objTree.header, err = objTree.treeStorage.Header() + if err != nil { + return nil, err + } + + return objTree, nil +} + +func createTreeHeaderAndId( + raw *aclpb.RawTreeChangeWithId, + treeType aclpb.TreeHeaderType, + aclId string, + identity []byte, + headerData []byte) (header *aclpb.TreeHeader, treeId string, err error) { + header = &aclpb.TreeHeader{ + FirstId: raw.Id, + TreeHeaderType: treeType, + AclId: aclId, + Identity: identity, + Data: headerData, + } + marshalledHeader, err := proto.Marshal(header) + if err != nil { + return + } + + treeId, err = cid.NewCIDFromBytes(marshalledHeader) + return +} diff --git a/pkg/acl/tree/rawloader.go b/pkg/acl/tree/rawloader.go index 424fa2c2..c068cdba 100644 --- a/pkg/acl/tree/rawloader.go +++ b/pkg/acl/tree/rawloader.go @@ -18,7 +18,7 @@ type rawChangeLoader struct { type rawCacheEntry struct { change *Change - rawChange *aclpb.RawChange + rawChange *aclpb.RawTreeChangeWithId position int } @@ -29,15 +29,15 @@ func newRawChangeLoader(treeStorage storage.TreeStorage, changeBuilder ChangeBui } } -func (r *rawChangeLoader) LoadFromTree(t *Tree, breakpoints []string) ([]*aclpb.RawChange, error) { +func (r *rawChangeLoader) LoadFromTree(t *Tree, breakpoints []string) ([]*aclpb.RawTreeChangeWithId, error) { var stack []*Change for _, h := range t.headIds { stack = append(stack, t.attached[h]) } - convert := func(chs []*Change) (rawChanges []*aclpb.RawChange, err error) { + convert := func(chs []*Change) (rawChanges []*aclpb.RawTreeChangeWithId, err error) { for _, ch := range chs { - var raw *aclpb.RawChange + var raw *aclpb.RawTreeChangeWithId raw, err = r.changeBuilder.BuildRaw(ch) if err != nil { return @@ -95,7 +95,7 @@ func (r *rawChangeLoader) LoadFromTree(t *Tree, breakpoints []string) ([]*aclpb. return convert(results) } -func (r *rawChangeLoader) LoadFromStorage(commonSnapshot string, heads, breakpoints []string) ([]*aclpb.RawChange, error) { +func (r *rawChangeLoader) LoadFromStorage(commonSnapshot string, heads, breakpoints []string) ([]*aclpb.RawTreeChangeWithId, error) { // resetting cache r.cache = make(map[string]rawCacheEntry) defer func() { @@ -162,7 +162,7 @@ func (r *rawChangeLoader) LoadFromStorage(commonSnapshot string, heads, breakpoi // preparing first pass r.idStack = append(r.idStack, heads...) - var buffer []*aclpb.RawChange + var buffer []*aclpb.RawTreeChangeWithId rootVisited := dfs(commonSnapshot, heads, 0, func(counter int, mapExists bool) bool { @@ -203,7 +203,7 @@ func (r *rawChangeLoader) LoadFromStorage(commonSnapshot string, heads, breakpoi }) // discarding visited - buffer = discardFromSlice(buffer, func(change *aclpb.RawChange) bool { + buffer = discardFromSlice(buffer, func(change *aclpb.RawTreeChangeWithId) bool { return change == nil }) @@ -219,7 +219,7 @@ func (r *rawChangeLoader) loadEntry(id string) (entry rawCacheEntry, err error) return } - change, err := r.changeBuilder.ConvertFromRaw(rawChange) + change, err := r.changeBuilder.ConvertFromRaw(rawChange, false) if err != nil { return } diff --git a/pkg/acl/tree/signablecontent.go b/pkg/acl/tree/signablecontent.go index f97ed44a..4774c2fb 100644 --- a/pkg/acl/tree/signablecontent.go +++ b/pkg/acl/tree/signablecontent.go @@ -2,12 +2,11 @@ package tree import ( "github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys/asymmetric/signingkey" - "github.com/gogo/protobuf/proto" ) type SignableChangeContent struct { - Proto proto.Marshaler + Data []byte Key signingkey.PrivKey - Identity string + Identity []byte IsSnapshot bool } diff --git a/pkg/acl/tree/tests/benches_test.go b/pkg/acl/tree/tests/benches_test.go new file mode 100644 index 00000000..703cb7a0 --- /dev/null +++ b/pkg/acl/tree/tests/benches_test.go @@ -0,0 +1,91 @@ +package tests + +import ( + "bytes" + "math/rand" + "testing" + "time" +) + +func BenchmarkHashes(b *testing.B) { + genRandomBytes := func() [][]byte { + var res [][]byte + s := rand.NewSource(time.Now().Unix()) + r := rand.New(s) + for i := 0; i < 10000; i++ { + var newBytes []byte + for j := 0; j < 64; j++ { + newBytes = append(newBytes, byte(r.Intn(256))) + } + res = append(res, newBytes) + } + return res + } + makeStrings := func(input [][]byte) []string { + var res []string + for _, bytes := range input { + res = append(res, string(bytes)) + } + return res + } + res := genRandomBytes() + stringRes := makeStrings(res) + stringMap := map[string]struct{}{} + b.Run("string bytes hash map write", func(b *testing.B) { + stringMap = map[string]struct{}{} + for i := 0; i < b.N; i++ { + for _, bytes := range res { + stringMap[string(bytes)] = struct{}{} + } + } + b.Run("hash map read", func(b *testing.B) { + for i := 0; i < b.N; i++ { + for _, bytes := range res { + _, _ = stringMap[string(bytes)] + } + } + }) + }) + b.Run("compare byte slices as strings", func(b *testing.B) { + for i := 0; i < b.N; i++ { + for _, bytes := range res { + if string(bytes) == string(bytes) { + + } + } + } + }) + b.Run("compare byte slices", func(b *testing.B) { + for i := 0; i < b.N; i++ { + for _, bt := range res { + if bytes.Compare(bt, bt) == 0 { + + } + } + } + }) + b.Run("compare strings", func(b *testing.B) { + for i := 0; i < b.N; i++ { + for _, st := range stringRes { + if st == st { + + } + } + } + }) + b.Run("string hash map write", func(b *testing.B) { + stringMap = map[string]struct{}{} + for i := 0; i < b.N; i++ { + for _, str := range stringRes { + stringMap[str] = struct{}{} + } + } + b.Run("hash map read", func(b *testing.B) { + for i := 0; i < b.N; i++ { + for _, str := range stringRes { + _, _ = stringMap[str] + } + } + }) + }) +} diff --git a/pkg/acl/tree/treebuilder.go b/pkg/acl/tree/treebuilder.go index fdf69873..d7249d28 100644 --- a/pkg/acl/tree/treebuilder.go +++ b/pkg/acl/tree/treebuilder.go @@ -129,7 +129,7 @@ func (tb *treeBuilder) loadChange(id string) (ch *Change, err error) { return nil, err } - ch, err = tb.builder.ConvertFromRawAndVerify(change) + ch, err = tb.builder.ConvertFromRaw(change, true) if err != nil { return nil, err } diff --git a/pkg/acl/tree/treestorage.go b/pkg/acl/tree/treestorage.go deleted file mode 100644 index 27fce1d5..00000000 --- a/pkg/acl/tree/treestorage.go +++ /dev/null @@ -1,91 +0,0 @@ -package tree - -import ( - "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/account" - "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/aclchanges/aclpb" - "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/list" - "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/storage" - "github.com/anytypeio/go-anytype-infrastructure-experiments/util/cid" - "github.com/gogo/protobuf/proto" - "time" -) - -func CreateNewTreeStorage( - acc *account.AccountData, - aclList list.ACLList, - content proto.Marshaler, - create storage.TreeStorageCreatorFunc) (thr storage.TreeStorage, err error) { - - state := aclList.ACLState() - change := &aclpb.Change{ - AclHeadId: aclList.Head().Id, - CurrentReadKeyHash: state.CurrentReadKeyHash(), - Timestamp: int64(time.Now().Nanosecond()), - Identity: acc.Identity, - IsSnapshot: true, - } - - marshalledData, err := content.Marshal() - if err != nil { - return - } - - readKey, err := state.CurrentReadKey() - if err != nil { - return - } - - encrypted, err := readKey.Encrypt(marshalledData) - if err != nil { - return - } - - change.ChangesData = encrypted - - fullMarshalledChange, err := proto.Marshal(change) - if err != nil { - return - } - - signature, err := acc.SignKey.Sign(fullMarshalledChange) - if err != nil { - return - } - - changeId, err := cid.NewCIDFromBytes(fullMarshalledChange) - if err != nil { - return - } - - rawChange := &aclpb.RawChange{ - Payload: fullMarshalledChange, - Signature: signature, - Id: changeId, - } - header, treeId, err := createTreeHeaderAndId(rawChange, aclpb.Header_DocTree, aclList.ID()) - if err != nil { - return - } - - return create(storage.TreeStorageCreatePayload{ - TreeId: treeId, - Header: header, - Changes: []*aclpb.RawChange{rawChange}, - Heads: []string{rawChange.Id}, - }) -} - -func createTreeHeaderAndId(change *aclpb.RawChange, treeType aclpb.HeaderDocType, aclListId string) (header *aclpb.Header, treeId string, err error) { - header = &aclpb.Header{ - FirstId: change.Id, - DocType: treeType, - AclListId: aclListId, - } - marshalledHeader, err := proto.Marshal(header) - if err != nil { - return - } - - treeId, err = cid.NewCIDFromBytes(marshalledHeader) - return -} diff --git a/service/storage/service.go b/service/storage/service.go index e1a6ae6d..43fb44d5 100644 --- a/service/storage/service.go +++ b/service/storage/service.go @@ -15,7 +15,7 @@ var log = logger.NewNamed("storage").Sugar() type ImportedACLSyncData struct { Id string Header *aclpb.Header - Records []*aclpb.RawRecord + Records []*aclpb.RawACLRecord } type Service interface { diff --git a/syncproto/proto/sync.proto b/syncproto/proto/sync.proto index d6cc1ddd..80548336 100644 --- a/syncproto/proto/sync.proto +++ b/syncproto/proto/sync.proto @@ -47,44 +47,3 @@ message System { } } } - -message Sync { - string spaceId = 1; - ContentValue message = 2; - acl.Header treeHeader = 3; - string treeId = 4; - - message ContentValue { - oneof value { - HeadUpdate headUpdate = 1; - Full.Request fullSyncRequest = 2; - Full.Response fullSyncResponse = 3; - ACLList aclList = 4; - } - } - - message ACLList { - repeated acl.RawRecord records = 1; - } - - message HeadUpdate { - repeated string heads = 1; - repeated acl.RawChange changes = 2; - repeated string snapshotPath = 3; - } - - message Full { - // here with send the request with all changes we have (we already know sender's snapshot path) - message Request { - repeated string heads = 1; - repeated acl.RawChange changes = 2; - repeated string snapshotPath = 3; - } - - message Response { - repeated string heads = 1; - repeated acl.RawChange changes = 2; - repeated string snapshotPath = 3; - } - } -} diff --git a/syncproto/sync.pb.go b/syncproto/sync.pb.go index 0f8d273b..20a189a1 100644 --- a/syncproto/sync.pb.go +++ b/syncproto/sync.pb.go @@ -5,7 +5,7 @@ package syncproto import ( fmt "fmt" - aclpb "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/aclchanges/aclpb" + _ "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/aclchanges/aclpb" proto "github.com/gogo/protobuf/proto" io "io" math "math" @@ -51,28 +51,28 @@ func (MessageType) EnumDescriptor() ([]byte, []int) { return fileDescriptor_4b28dfdd48a89166, []int{0} } -type SystemErrorCode int32 +type System_Error_Code int32 const ( - SystemError_UNKNOWN SystemErrorCode = 0 - SystemError_UNSUPPORTED_PROTOCOL_VERSION SystemErrorCode = 10 + System_Error_UNKNOWN System_Error_Code = 0 + System_Error_UNSUPPORTED_PROTOCOL_VERSION System_Error_Code = 10 ) -var SystemErrorCode_name = map[int32]string{ +var System_Error_Code_name = map[int32]string{ 0: "UNKNOWN", 10: "UNSUPPORTED_PROTOCOL_VERSION", } -var SystemErrorCode_value = map[string]int32{ +var System_Error_Code_value = map[string]int32{ "UNKNOWN": 0, "UNSUPPORTED_PROTOCOL_VERSION": 10, } -func (x SystemErrorCode) String() string { - return proto.EnumName(SystemErrorCode_name, int32(x)) +func (x System_Error_Code) String() string { + return proto.EnumName(System_Error_Code_name, int32(x)) } -func (SystemErrorCode) EnumDescriptor() ([]byte, []int) { +func (System_Error_Code) EnumDescriptor() ([]byte, []int) { return fileDescriptor_4b28dfdd48a89166, []int{2, 3, 0} } @@ -205,9 +205,9 @@ func (m *Header) GetDebugInfo() string { } type System struct { - Handshake *SystemHandshake `protobuf:"bytes,1,opt,name=handshake,proto3" json:"handshake,omitempty"` - Ping *SystemPing `protobuf:"bytes,2,opt,name=ping,proto3" json:"ping,omitempty"` - Ack *SystemAck `protobuf:"bytes,3,opt,name=ack,proto3" json:"ack,omitempty"` + Handshake *System_Handshake `protobuf:"bytes,1,opt,name=handshake,proto3" json:"handshake,omitempty"` + Ping *System_Ping `protobuf:"bytes,2,opt,name=ping,proto3" json:"ping,omitempty"` + Ack *System_Ack `protobuf:"bytes,3,opt,name=ack,proto3" json:"ack,omitempty"` } func (m *System) Reset() { *m = System{} } @@ -243,43 +243,43 @@ func (m *System) XXX_DiscardUnknown() { var xxx_messageInfo_System proto.InternalMessageInfo -func (m *System) GetHandshake() *SystemHandshake { +func (m *System) GetHandshake() *System_Handshake { if m != nil { return m.Handshake } return nil } -func (m *System) GetPing() *SystemPing { +func (m *System) GetPing() *System_Ping { if m != nil { return m.Ping } return nil } -func (m *System) GetAck() *SystemAck { +func (m *System) GetAck() *System_Ack { if m != nil { return m.Ack } return nil } -type SystemHandshake struct { +type System_Handshake struct { ProtocolVersion string `protobuf:"bytes,1,opt,name=protocolVersion,proto3" json:"protocolVersion,omitempty"` } -func (m *SystemHandshake) Reset() { *m = SystemHandshake{} } -func (m *SystemHandshake) String() string { return proto.CompactTextString(m) } -func (*SystemHandshake) ProtoMessage() {} -func (*SystemHandshake) Descriptor() ([]byte, []int) { +func (m *System_Handshake) Reset() { *m = System_Handshake{} } +func (m *System_Handshake) String() string { return proto.CompactTextString(m) } +func (*System_Handshake) ProtoMessage() {} +func (*System_Handshake) Descriptor() ([]byte, []int) { return fileDescriptor_4b28dfdd48a89166, []int{2, 0} } -func (m *SystemHandshake) XXX_Unmarshal(b []byte) error { +func (m *System_Handshake) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *SystemHandshake) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *System_Handshake) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_SystemHandshake.Marshal(b, m, deterministic) + return xxx_messageInfo_System_Handshake.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -289,41 +289,41 @@ func (m *SystemHandshake) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } -func (m *SystemHandshake) XXX_Merge(src proto.Message) { - xxx_messageInfo_SystemHandshake.Merge(m, src) +func (m *System_Handshake) XXX_Merge(src proto.Message) { + xxx_messageInfo_System_Handshake.Merge(m, src) } -func (m *SystemHandshake) XXX_Size() int { +func (m *System_Handshake) XXX_Size() int { return m.Size() } -func (m *SystemHandshake) XXX_DiscardUnknown() { - xxx_messageInfo_SystemHandshake.DiscardUnknown(m) +func (m *System_Handshake) XXX_DiscardUnknown() { + xxx_messageInfo_System_Handshake.DiscardUnknown(m) } -var xxx_messageInfo_SystemHandshake proto.InternalMessageInfo +var xxx_messageInfo_System_Handshake proto.InternalMessageInfo -func (m *SystemHandshake) GetProtocolVersion() string { +func (m *System_Handshake) GetProtocolVersion() string { if m != nil { return m.ProtocolVersion } return "" } -type SystemPing struct { +type System_Ping struct { UnixTime uint64 `protobuf:"varint,1,opt,name=unixTime,proto3" json:"unixTime,omitempty"` } -func (m *SystemPing) Reset() { *m = SystemPing{} } -func (m *SystemPing) String() string { return proto.CompactTextString(m) } -func (*SystemPing) ProtoMessage() {} -func (*SystemPing) Descriptor() ([]byte, []int) { +func (m *System_Ping) Reset() { *m = System_Ping{} } +func (m *System_Ping) String() string { return proto.CompactTextString(m) } +func (*System_Ping) ProtoMessage() {} +func (*System_Ping) Descriptor() ([]byte, []int) { return fileDescriptor_4b28dfdd48a89166, []int{2, 1} } -func (m *SystemPing) XXX_Unmarshal(b []byte) error { +func (m *System_Ping) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *SystemPing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *System_Ping) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_SystemPing.Marshal(b, m, deterministic) + return xxx_messageInfo_System_Ping.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -333,41 +333,41 @@ func (m *SystemPing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *SystemPing) XXX_Merge(src proto.Message) { - xxx_messageInfo_SystemPing.Merge(m, src) +func (m *System_Ping) XXX_Merge(src proto.Message) { + xxx_messageInfo_System_Ping.Merge(m, src) } -func (m *SystemPing) XXX_Size() int { +func (m *System_Ping) XXX_Size() int { return m.Size() } -func (m *SystemPing) XXX_DiscardUnknown() { - xxx_messageInfo_SystemPing.DiscardUnknown(m) +func (m *System_Ping) XXX_DiscardUnknown() { + xxx_messageInfo_System_Ping.DiscardUnknown(m) } -var xxx_messageInfo_SystemPing proto.InternalMessageInfo +var xxx_messageInfo_System_Ping proto.InternalMessageInfo -func (m *SystemPing) GetUnixTime() uint64 { +func (m *System_Ping) GetUnixTime() uint64 { if m != nil { return m.UnixTime } return 0 } -type SystemAck struct { - Error *SystemError `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` +type System_Ack struct { + Error *System_Error `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` } -func (m *SystemAck) Reset() { *m = SystemAck{} } -func (m *SystemAck) String() string { return proto.CompactTextString(m) } -func (*SystemAck) ProtoMessage() {} -func (*SystemAck) Descriptor() ([]byte, []int) { +func (m *System_Ack) Reset() { *m = System_Ack{} } +func (m *System_Ack) String() string { return proto.CompactTextString(m) } +func (*System_Ack) ProtoMessage() {} +func (*System_Ack) Descriptor() ([]byte, []int) { return fileDescriptor_4b28dfdd48a89166, []int{2, 2} } -func (m *SystemAck) XXX_Unmarshal(b []byte) error { +func (m *System_Ack) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *SystemAck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *System_Ack) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_SystemAck.Marshal(b, m, deterministic) + return xxx_messageInfo_System_Ack.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -377,42 +377,42 @@ func (m *SystemAck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *SystemAck) XXX_Merge(src proto.Message) { - xxx_messageInfo_SystemAck.Merge(m, src) +func (m *System_Ack) XXX_Merge(src proto.Message) { + xxx_messageInfo_System_Ack.Merge(m, src) } -func (m *SystemAck) XXX_Size() int { +func (m *System_Ack) XXX_Size() int { return m.Size() } -func (m *SystemAck) XXX_DiscardUnknown() { - xxx_messageInfo_SystemAck.DiscardUnknown(m) +func (m *System_Ack) XXX_DiscardUnknown() { + xxx_messageInfo_System_Ack.DiscardUnknown(m) } -var xxx_messageInfo_SystemAck proto.InternalMessageInfo +var xxx_messageInfo_System_Ack proto.InternalMessageInfo -func (m *SystemAck) GetError() *SystemError { +func (m *System_Ack) GetError() *System_Error { if m != nil { return m.Error } return nil } -type SystemError struct { - Code SystemErrorCode `protobuf:"varint,1,opt,name=code,proto3,enum=anytype.SystemErrorCode" json:"code,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` +type System_Error struct { + Code System_Error_Code `protobuf:"varint,1,opt,name=code,proto3,enum=anytype.System_Error_Code" json:"code,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` } -func (m *SystemError) Reset() { *m = SystemError{} } -func (m *SystemError) String() string { return proto.CompactTextString(m) } -func (*SystemError) ProtoMessage() {} -func (*SystemError) Descriptor() ([]byte, []int) { +func (m *System_Error) Reset() { *m = System_Error{} } +func (m *System_Error) String() string { return proto.CompactTextString(m) } +func (*System_Error) ProtoMessage() {} +func (*System_Error) Descriptor() ([]byte, []int) { return fileDescriptor_4b28dfdd48a89166, []int{2, 3} } -func (m *SystemError) XXX_Unmarshal(b []byte) error { +func (m *System_Error) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *SystemError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *System_Error) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_SystemError.Marshal(b, m, deterministic) + return xxx_messageInfo_System_Error.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -422,546 +422,82 @@ func (m *SystemError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } -func (m *SystemError) XXX_Merge(src proto.Message) { - xxx_messageInfo_SystemError.Merge(m, src) +func (m *System_Error) XXX_Merge(src proto.Message) { + xxx_messageInfo_System_Error.Merge(m, src) } -func (m *SystemError) XXX_Size() int { +func (m *System_Error) XXX_Size() int { return m.Size() } -func (m *SystemError) XXX_DiscardUnknown() { - xxx_messageInfo_SystemError.DiscardUnknown(m) +func (m *System_Error) XXX_DiscardUnknown() { + xxx_messageInfo_System_Error.DiscardUnknown(m) } -var xxx_messageInfo_SystemError proto.InternalMessageInfo +var xxx_messageInfo_System_Error proto.InternalMessageInfo -func (m *SystemError) GetCode() SystemErrorCode { +func (m *System_Error) GetCode() System_Error_Code { if m != nil { return m.Code } - return SystemError_UNKNOWN + return System_Error_UNKNOWN } -func (m *SystemError) GetDescription() string { +func (m *System_Error) GetDescription() string { if m != nil { return m.Description } return "" } -type Sync struct { - SpaceId string `protobuf:"bytes,1,opt,name=spaceId,proto3" json:"spaceId,omitempty"` - Message *SyncContentValue `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` - TreeHeader *aclpb.Header `protobuf:"bytes,3,opt,name=treeHeader,proto3" json:"treeHeader,omitempty"` - TreeId string `protobuf:"bytes,4,opt,name=treeId,proto3" json:"treeId,omitempty"` -} - -func (m *Sync) Reset() { *m = Sync{} } -func (m *Sync) String() string { return proto.CompactTextString(m) } -func (*Sync) ProtoMessage() {} -func (*Sync) Descriptor() ([]byte, []int) { - return fileDescriptor_4b28dfdd48a89166, []int{3} -} -func (m *Sync) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Sync) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Sync.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 *Sync) XXX_Merge(src proto.Message) { - xxx_messageInfo_Sync.Merge(m, src) -} -func (m *Sync) XXX_Size() int { - return m.Size() -} -func (m *Sync) XXX_DiscardUnknown() { - xxx_messageInfo_Sync.DiscardUnknown(m) -} - -var xxx_messageInfo_Sync proto.InternalMessageInfo - -func (m *Sync) GetSpaceId() string { - if m != nil { - return m.SpaceId - } - return "" -} - -func (m *Sync) GetMessage() *SyncContentValue { - if m != nil { - return m.Message - } - return nil -} - -func (m *Sync) GetTreeHeader() *aclpb.Header { - if m != nil { - return m.TreeHeader - } - return nil -} - -func (m *Sync) GetTreeId() string { - if m != nil { - return m.TreeId - } - return "" -} - -type SyncContentValue struct { - // Types that are valid to be assigned to Value: - // *SyncContentValueValueOfHeadUpdate - // *SyncContentValueValueOfFullSyncRequest - // *SyncContentValueValueOfFullSyncResponse - // *SyncContentValueValueOfAclList - Value IsSyncContentValueValue `protobuf_oneof:"value"` -} - -func (m *SyncContentValue) Reset() { *m = SyncContentValue{} } -func (m *SyncContentValue) String() string { return proto.CompactTextString(m) } -func (*SyncContentValue) ProtoMessage() {} -func (*SyncContentValue) Descriptor() ([]byte, []int) { - return fileDescriptor_4b28dfdd48a89166, []int{3, 0} -} -func (m *SyncContentValue) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SyncContentValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SyncContentValue.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 *SyncContentValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_SyncContentValue.Merge(m, src) -} -func (m *SyncContentValue) XXX_Size() int { - return m.Size() -} -func (m *SyncContentValue) XXX_DiscardUnknown() { - xxx_messageInfo_SyncContentValue.DiscardUnknown(m) -} - -var xxx_messageInfo_SyncContentValue proto.InternalMessageInfo - -type IsSyncContentValueValue interface { - IsSyncContentValueValue() - MarshalTo([]byte) (int, error) - Size() int -} - -type SyncContentValueValueOfHeadUpdate struct { - HeadUpdate *SyncHeadUpdate `protobuf:"bytes,1,opt,name=headUpdate,proto3,oneof" json:"headUpdate,omitempty"` -} -type SyncContentValueValueOfFullSyncRequest struct { - FullSyncRequest *SyncFullRequest `protobuf:"bytes,2,opt,name=fullSyncRequest,proto3,oneof" json:"fullSyncRequest,omitempty"` -} -type SyncContentValueValueOfFullSyncResponse struct { - FullSyncResponse *SyncFullResponse `protobuf:"bytes,3,opt,name=fullSyncResponse,proto3,oneof" json:"fullSyncResponse,omitempty"` -} -type SyncContentValueValueOfAclList struct { - AclList *SyncACLList `protobuf:"bytes,4,opt,name=aclList,proto3,oneof" json:"aclList,omitempty"` -} - -func (*SyncContentValueValueOfHeadUpdate) IsSyncContentValueValue() {} -func (*SyncContentValueValueOfFullSyncRequest) IsSyncContentValueValue() {} -func (*SyncContentValueValueOfFullSyncResponse) IsSyncContentValueValue() {} -func (*SyncContentValueValueOfAclList) IsSyncContentValueValue() {} - -func (m *SyncContentValue) GetValue() IsSyncContentValueValue { - if m != nil { - return m.Value - } - return nil -} - -func (m *SyncContentValue) GetHeadUpdate() *SyncHeadUpdate { - if x, ok := m.GetValue().(*SyncContentValueValueOfHeadUpdate); ok { - return x.HeadUpdate - } - return nil -} - -func (m *SyncContentValue) GetFullSyncRequest() *SyncFullRequest { - if x, ok := m.GetValue().(*SyncContentValueValueOfFullSyncRequest); ok { - return x.FullSyncRequest - } - return nil -} - -func (m *SyncContentValue) GetFullSyncResponse() *SyncFullResponse { - if x, ok := m.GetValue().(*SyncContentValueValueOfFullSyncResponse); ok { - return x.FullSyncResponse - } - return nil -} - -func (m *SyncContentValue) GetAclList() *SyncACLList { - if x, ok := m.GetValue().(*SyncContentValueValueOfAclList); ok { - return x.AclList - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*SyncContentValue) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*SyncContentValueValueOfHeadUpdate)(nil), - (*SyncContentValueValueOfFullSyncRequest)(nil), - (*SyncContentValueValueOfFullSyncResponse)(nil), - (*SyncContentValueValueOfAclList)(nil), - } -} - -type SyncACLList struct { - Records []*aclpb.RawRecord `protobuf:"bytes,1,rep,name=records,proto3" json:"records,omitempty"` -} - -func (m *SyncACLList) Reset() { *m = SyncACLList{} } -func (m *SyncACLList) String() string { return proto.CompactTextString(m) } -func (*SyncACLList) ProtoMessage() {} -func (*SyncACLList) Descriptor() ([]byte, []int) { - return fileDescriptor_4b28dfdd48a89166, []int{3, 1} -} -func (m *SyncACLList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SyncACLList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SyncACLList.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 *SyncACLList) XXX_Merge(src proto.Message) { - xxx_messageInfo_SyncACLList.Merge(m, src) -} -func (m *SyncACLList) XXX_Size() int { - return m.Size() -} -func (m *SyncACLList) XXX_DiscardUnknown() { - xxx_messageInfo_SyncACLList.DiscardUnknown(m) -} - -var xxx_messageInfo_SyncACLList proto.InternalMessageInfo - -func (m *SyncACLList) GetRecords() []*aclpb.RawRecord { - if m != nil { - return m.Records - } - return nil -} - -type SyncHeadUpdate struct { - Heads []string `protobuf:"bytes,1,rep,name=heads,proto3" json:"heads,omitempty"` - Changes []*aclpb.RawChange `protobuf:"bytes,2,rep,name=changes,proto3" json:"changes,omitempty"` - SnapshotPath []string `protobuf:"bytes,3,rep,name=snapshotPath,proto3" json:"snapshotPath,omitempty"` -} - -func (m *SyncHeadUpdate) Reset() { *m = SyncHeadUpdate{} } -func (m *SyncHeadUpdate) String() string { return proto.CompactTextString(m) } -func (*SyncHeadUpdate) ProtoMessage() {} -func (*SyncHeadUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_4b28dfdd48a89166, []int{3, 2} -} -func (m *SyncHeadUpdate) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SyncHeadUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SyncHeadUpdate.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 *SyncHeadUpdate) XXX_Merge(src proto.Message) { - xxx_messageInfo_SyncHeadUpdate.Merge(m, src) -} -func (m *SyncHeadUpdate) XXX_Size() int { - return m.Size() -} -func (m *SyncHeadUpdate) XXX_DiscardUnknown() { - xxx_messageInfo_SyncHeadUpdate.DiscardUnknown(m) -} - -var xxx_messageInfo_SyncHeadUpdate proto.InternalMessageInfo - -func (m *SyncHeadUpdate) GetHeads() []string { - if m != nil { - return m.Heads - } - return nil -} - -func (m *SyncHeadUpdate) GetChanges() []*aclpb.RawChange { - if m != nil { - return m.Changes - } - return nil -} - -func (m *SyncHeadUpdate) GetSnapshotPath() []string { - if m != nil { - return m.SnapshotPath - } - return nil -} - -type SyncFull struct { -} - -func (m *SyncFull) Reset() { *m = SyncFull{} } -func (m *SyncFull) String() string { return proto.CompactTextString(m) } -func (*SyncFull) ProtoMessage() {} -func (*SyncFull) Descriptor() ([]byte, []int) { - return fileDescriptor_4b28dfdd48a89166, []int{3, 3} -} -func (m *SyncFull) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SyncFull) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SyncFull.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 *SyncFull) XXX_Merge(src proto.Message) { - xxx_messageInfo_SyncFull.Merge(m, src) -} -func (m *SyncFull) XXX_Size() int { - return m.Size() -} -func (m *SyncFull) XXX_DiscardUnknown() { - xxx_messageInfo_SyncFull.DiscardUnknown(m) -} - -var xxx_messageInfo_SyncFull proto.InternalMessageInfo - -// here with send the request with all changes we have (we already know sender's snapshot path) -type SyncFullRequest struct { - Heads []string `protobuf:"bytes,1,rep,name=heads,proto3" json:"heads,omitempty"` - Changes []*aclpb.RawChange `protobuf:"bytes,2,rep,name=changes,proto3" json:"changes,omitempty"` - SnapshotPath []string `protobuf:"bytes,3,rep,name=snapshotPath,proto3" json:"snapshotPath,omitempty"` -} - -func (m *SyncFullRequest) Reset() { *m = SyncFullRequest{} } -func (m *SyncFullRequest) String() string { return proto.CompactTextString(m) } -func (*SyncFullRequest) ProtoMessage() {} -func (*SyncFullRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_4b28dfdd48a89166, []int{3, 3, 0} -} -func (m *SyncFullRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SyncFullRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SyncFullRequest.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 *SyncFullRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SyncFullRequest.Merge(m, src) -} -func (m *SyncFullRequest) XXX_Size() int { - return m.Size() -} -func (m *SyncFullRequest) XXX_DiscardUnknown() { - xxx_messageInfo_SyncFullRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_SyncFullRequest proto.InternalMessageInfo - -func (m *SyncFullRequest) GetHeads() []string { - if m != nil { - return m.Heads - } - return nil -} - -func (m *SyncFullRequest) GetChanges() []*aclpb.RawChange { - if m != nil { - return m.Changes - } - return nil -} - -func (m *SyncFullRequest) GetSnapshotPath() []string { - if m != nil { - return m.SnapshotPath - } - return nil -} - -type SyncFullResponse struct { - Heads []string `protobuf:"bytes,1,rep,name=heads,proto3" json:"heads,omitempty"` - Changes []*aclpb.RawChange `protobuf:"bytes,2,rep,name=changes,proto3" json:"changes,omitempty"` - SnapshotPath []string `protobuf:"bytes,3,rep,name=snapshotPath,proto3" json:"snapshotPath,omitempty"` -} - -func (m *SyncFullResponse) Reset() { *m = SyncFullResponse{} } -func (m *SyncFullResponse) String() string { return proto.CompactTextString(m) } -func (*SyncFullResponse) ProtoMessage() {} -func (*SyncFullResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_4b28dfdd48a89166, []int{3, 3, 1} -} -func (m *SyncFullResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SyncFullResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SyncFullResponse.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 *SyncFullResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SyncFullResponse.Merge(m, src) -} -func (m *SyncFullResponse) XXX_Size() int { - return m.Size() -} -func (m *SyncFullResponse) XXX_DiscardUnknown() { - xxx_messageInfo_SyncFullResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_SyncFullResponse proto.InternalMessageInfo - -func (m *SyncFullResponse) GetHeads() []string { - if m != nil { - return m.Heads - } - return nil -} - -func (m *SyncFullResponse) GetChanges() []*aclpb.RawChange { - if m != nil { - return m.Changes - } - return nil -} - -func (m *SyncFullResponse) GetSnapshotPath() []string { - if m != nil { - return m.SnapshotPath - } - return nil -} - func init() { proto.RegisterEnum("anytype.MessageType", MessageType_name, MessageType_value) - proto.RegisterEnum("anytype.SystemErrorCode", SystemErrorCode_name, SystemErrorCode_value) + proto.RegisterEnum("anytype.System_Error_Code", System_Error_Code_name, System_Error_Code_value) proto.RegisterType((*Message)(nil), "anytype.Message") proto.RegisterType((*Header)(nil), "anytype.Header") proto.RegisterType((*System)(nil), "anytype.System") - proto.RegisterType((*SystemHandshake)(nil), "anytype.System.Handshake") - proto.RegisterType((*SystemPing)(nil), "anytype.System.Ping") - proto.RegisterType((*SystemAck)(nil), "anytype.System.Ack") - proto.RegisterType((*SystemError)(nil), "anytype.System.Error") - proto.RegisterType((*Sync)(nil), "anytype.Sync") - proto.RegisterType((*SyncContentValue)(nil), "anytype.Sync.ContentValue") - proto.RegisterType((*SyncACLList)(nil), "anytype.Sync.ACLList") - proto.RegisterType((*SyncHeadUpdate)(nil), "anytype.Sync.HeadUpdate") - proto.RegisterType((*SyncFull)(nil), "anytype.Sync.Full") - proto.RegisterType((*SyncFullRequest)(nil), "anytype.Sync.Full.Request") - proto.RegisterType((*SyncFullResponse)(nil), "anytype.Sync.Full.Response") + proto.RegisterType((*System_Handshake)(nil), "anytype.System.Handshake") + proto.RegisterType((*System_Ping)(nil), "anytype.System.Ping") + proto.RegisterType((*System_Ack)(nil), "anytype.System.Ack") + proto.RegisterType((*System_Error)(nil), "anytype.System.Error") } func init() { proto.RegisterFile("syncproto/proto/sync.proto", fileDescriptor_4b28dfdd48a89166) } var fileDescriptor_4b28dfdd48a89166 = []byte{ - // 812 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0xc1, 0x8e, 0xe2, 0x46, - 0x10, 0xb5, 0xc1, 0xe0, 0x75, 0x79, 0x34, 0x90, 0xde, 0xd9, 0xc8, 0x71, 0x56, 0x08, 0xa1, 0x44, - 0x41, 0x59, 0xc9, 0x93, 0xb0, 0x59, 0x45, 0xca, 0x6d, 0x96, 0xcc, 0xc8, 0x28, 0x13, 0x40, 0x0d, - 0x4c, 0xa4, 0x5c, 0x56, 0x3d, 0xed, 0x5e, 0x40, 0x98, 0xb6, 0xe3, 0x36, 0x49, 0xf8, 0x8b, 0xbd, - 0xe6, 0x9a, 0x6f, 0xc8, 0x37, 0x44, 0x39, 0xee, 0x31, 0xc7, 0x68, 0x46, 0xf9, 0x8f, 0xa8, 0xdb, - 0x36, 0x18, 0x32, 0xe7, 0x39, 0x00, 0x5d, 0xaf, 0x5e, 0x55, 0xbf, 0x2a, 0x57, 0x19, 0x70, 0xc5, - 0x96, 0xd3, 0x38, 0x89, 0xd2, 0xe8, 0x3c, 0xfb, 0x96, 0xb6, 0xa7, 0x8e, 0xc8, 0x24, 0x7c, 0x9b, - 0x6e, 0x63, 0xe6, 0x7e, 0x11, 0xaf, 0xe6, 0xe7, 0x84, 0x86, 0xf2, 0x43, 0x17, 0x84, 0xcf, 0x99, - 0x90, 0xc7, 0xf8, 0x36, 0x8b, 0x11, 0x25, 0x3c, 0x0b, 0xed, 0x5c, 0x81, 0xf9, 0x3d, 0x13, 0x82, - 0xcc, 0x19, 0xfa, 0x0c, 0xea, 0x0b, 0x46, 0x02, 0x96, 0x38, 0x7a, 0x5b, 0xef, 0xda, 0xbd, 0x86, - 0x97, 0xa7, 0xf5, 0x7c, 0x05, 0xe3, 0xdc, 0x8d, 0x10, 0x18, 0x01, 0x49, 0x89, 0x53, 0x69, 0xeb, - 0xdd, 0x13, 0xac, 0xce, 0x9d, 0xdf, 0x75, 0xa8, 0x67, 0x34, 0xe4, 0x80, 0x99, 0x26, 0x84, 0xb2, - 0x41, 0xa0, 0x12, 0x9d, 0xe0, 0xc2, 0x44, 0xcf, 0xc1, 0x4a, 0xd8, 0x4f, 0x1b, 0x26, 0xd2, 0x41, - 0xa0, 0xa2, 0x0d, 0xbc, 0x07, 0x64, 0x5c, 0xc2, 0xe2, 0x70, 0x3b, 0x08, 0x9c, 0xaa, 0xf2, 0x15, - 0x26, 0xea, 0x82, 0x21, 0x75, 0x38, 0x46, 0x5b, 0xef, 0x9e, 0xf6, 0xce, 0x76, 0xba, 0x72, 0xe5, - 0xd3, 0x6d, 0xcc, 0xb0, 0x62, 0xc8, 0x1b, 0x02, 0x76, 0xbb, 0x99, 0x0f, 0xf8, 0xdb, 0xc8, 0xa9, - 0xb5, 0xf5, 0xae, 0x85, 0xf7, 0x40, 0xe7, 0x8f, 0x2a, 0xd4, 0x27, 0x5b, 0x91, 0xb2, 0x35, 0xfa, - 0x1a, 0xac, 0x05, 0xe1, 0x81, 0x58, 0x90, 0x15, 0xcb, 0xeb, 0xfd, 0x68, 0x97, 0x37, 0xe3, 0x78, - 0x7e, 0x41, 0xc0, 0x7b, 0xae, 0xd4, 0x12, 0x2f, 0xf9, 0x5c, 0xc9, 0xb7, 0x4b, 0x5a, 0xf2, 0x98, - 0xf1, 0x92, 0xcf, 0xb1, 0x62, 0xa0, 0x4f, 0xa1, 0x4a, 0xe8, 0x4a, 0xd5, 0x62, 0xf7, 0x9e, 0x1e, - 0x13, 0x2f, 0xe8, 0x0a, 0x4b, 0xbf, 0xfb, 0x0a, 0x2c, 0xbf, 0x94, 0xbd, 0xa1, 0x9e, 0x0b, 0x8d, - 0xc2, 0x1b, 0x96, 0x88, 0x65, 0xc4, 0x95, 0x38, 0x0b, 0x1f, 0xc3, 0x6e, 0x07, 0x0c, 0x79, 0x17, - 0x72, 0xe1, 0xc9, 0x86, 0x2f, 0x7f, 0x9d, 0x2e, 0xd7, 0x59, 0x1d, 0x06, 0xde, 0xd9, 0x6e, 0x0f, - 0xaa, 0x17, 0x74, 0x85, 0x5e, 0x40, 0x8d, 0x25, 0x49, 0x94, 0xe4, 0x9a, 0x9f, 0x1d, 0x4b, 0xb9, - 0x94, 0x4e, 0x9c, 0x71, 0xdc, 0x77, 0x3a, 0xd4, 0x14, 0x80, 0x3c, 0x30, 0x68, 0x14, 0x64, 0x59, - 0x4f, 0x7b, 0xee, 0x83, 0x51, 0x5e, 0x3f, 0x0a, 0x18, 0x56, 0x3c, 0xd4, 0x06, 0x3b, 0x60, 0x82, - 0x26, 0xcb, 0x38, 0x95, 0xba, 0x2b, 0x4a, 0x77, 0x19, 0xea, 0xbc, 0x02, 0x43, 0xf2, 0x91, 0x0d, - 0xe6, 0x6c, 0xf8, 0xdd, 0x70, 0xf4, 0xc3, 0xb0, 0xa9, 0xa1, 0x36, 0x3c, 0x9f, 0x0d, 0x27, 0xb3, - 0xf1, 0x78, 0x84, 0xa7, 0x97, 0xdf, 0xbe, 0x19, 0xe3, 0xd1, 0x74, 0xd4, 0x1f, 0x5d, 0xbf, 0xb9, - 0xb9, 0xc4, 0x93, 0xc1, 0x68, 0xd8, 0x84, 0xce, 0x9f, 0x75, 0x30, 0x26, 0x5b, 0x4e, 0xe5, 0x84, - 0x88, 0x78, 0x3f, 0x59, 0x16, 0x2e, 0x4c, 0xf4, 0x15, 0x98, 0xeb, 0x6c, 0x18, 0xf2, 0x22, 0xcb, - 0x72, 0x39, 0xf5, 0xfa, 0x11, 0x4f, 0x19, 0x4f, 0x6f, 0x48, 0xb8, 0x61, 0xb8, 0xa0, 0xa2, 0x17, - 0x00, 0x69, 0xc2, 0x58, 0x36, 0xb7, 0xf9, 0x83, 0xb2, 0x3d, 0x42, 0xc3, 0x62, 0xe2, 0x4b, 0x6e, - 0xf4, 0x21, 0xd4, 0xa5, 0x35, 0x08, 0xd4, 0x18, 0x5a, 0x38, 0xb7, 0xdc, 0xdf, 0x2a, 0x70, 0x52, - 0x4e, 0x8f, 0xbe, 0x01, 0x90, 0x8b, 0x32, 0x8b, 0x03, 0x92, 0x16, 0xb3, 0xe5, 0x1c, 0xca, 0xf1, - 0x77, 0x7e, 0x5f, 0xc3, 0x25, 0x36, 0xba, 0x82, 0xc6, 0xdb, 0x4d, 0x18, 0x4a, 0x12, 0xce, 0x16, - 0xe3, 0xe1, 0x7a, 0xae, 0x36, 0x61, 0xe8, 0xe5, 0x0c, 0x5f, 0xc3, 0xc7, 0x41, 0x68, 0x00, 0xcd, - 0x3d, 0x24, 0xe2, 0x88, 0x0b, 0x96, 0xd7, 0xf7, 0xf1, 0x83, 0x89, 0x32, 0x8a, 0xaf, 0xe1, 0xff, - 0x85, 0xa1, 0x2f, 0xc1, 0x24, 0x34, 0xbc, 0x5e, 0x8a, 0x54, 0x15, 0x7e, 0x38, 0x3f, 0x9c, 0x7a, - 0x17, 0xfd, 0x6b, 0xe9, 0xf4, 0x35, 0x5c, 0xf0, 0x5e, 0x9b, 0x50, 0xfb, 0x59, 0xb6, 0xc2, 0x7d, - 0x09, 0x66, 0xee, 0x46, 0x5d, 0xb9, 0xdd, 0x34, 0x4a, 0x02, 0xe1, 0xe8, 0xed, 0x6a, 0xd7, 0xee, - 0x9d, 0xaa, 0x46, 0x63, 0xf2, 0x0b, 0x56, 0x30, 0x2e, 0xdc, 0x6e, 0x0c, 0xb0, 0xef, 0x0f, 0x3a, - 0x83, 0x9a, 0xec, 0x4f, 0x16, 0x65, 0xe1, 0xcc, 0x90, 0xd9, 0xf2, 0xf7, 0x98, 0x53, 0x39, 0xcc, - 0xd6, 0x57, 0x30, 0x2e, 0xdc, 0xa8, 0x03, 0x27, 0x82, 0x93, 0x58, 0x2c, 0xa2, 0x74, 0x4c, 0xd2, - 0x85, 0x53, 0x55, 0x69, 0x0e, 0x30, 0xf7, 0x5f, 0x1d, 0x0c, 0xd9, 0x08, 0x77, 0x0d, 0x66, 0xd1, - 0xc1, 0xc7, 0xb8, 0x97, 0xc3, 0x93, 0x5d, 0x9b, 0x1f, 0xe1, 0xbe, 0xcf, 0x47, 0x60, 0x97, 0x5e, - 0x99, 0xe8, 0x19, 0x7c, 0x50, 0x32, 0xb3, 0xb5, 0x6e, 0x6a, 0xe8, 0x0c, 0x9a, 0x65, 0x58, 0x6e, - 0x58, 0x53, 0x47, 0x4f, 0xa1, 0x71, 0x40, 0xe6, 0xb4, 0x59, 0x79, 0xfd, 0xc9, 0x5f, 0x77, 0x2d, - 0xfd, 0xfd, 0x5d, 0x4b, 0xff, 0xe7, 0xae, 0xa5, 0xbf, 0xbb, 0x6f, 0x69, 0xef, 0xef, 0x5b, 0xda, - 0xdf, 0xf7, 0x2d, 0xed, 0x47, 0x38, 0xdf, 0xfd, 0x5f, 0xdd, 0xd6, 0xd5, 0xcf, 0xcb, 0xff, 0x02, - 0x00, 0x00, 0xff, 0xff, 0x6a, 0xb8, 0x16, 0xd3, 0xc3, 0x06, 0x00, 0x00, + // 536 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x93, 0xd1, 0x8a, 0xd3, 0x40, + 0x14, 0x86, 0x3b, 0xdb, 0x6c, 0x6b, 0x4f, 0x96, 0xdd, 0x38, 0xbb, 0x0b, 0x31, 0x2c, 0x21, 0x14, + 0xc5, 0xa2, 0x90, 0x4a, 0x65, 0xf1, 0x7a, 0x5d, 0x2b, 0x2d, 0x6a, 0x53, 0xa6, 0xed, 0x0a, 0xde, + 0x2c, 0xd3, 0xc9, 0x98, 0x86, 0x76, 0x93, 0x98, 0xa4, 0x60, 0xde, 0x62, 0x9f, 0xc1, 0x67, 0xf0, + 0x21, 0xbc, 0xdc, 0x4b, 0x2f, 0xa5, 0x7d, 0x11, 0x99, 0x49, 0xda, 0xc6, 0xe2, 0x45, 0x92, 0x39, + 0xff, 0xf9, 0xff, 0x33, 0xdf, 0x30, 0x04, 0x8c, 0x24, 0x0b, 0x58, 0x14, 0x87, 0x69, 0xd8, 0xce, + 0xdf, 0xa2, 0xb6, 0xe5, 0x12, 0xd7, 0x69, 0x90, 0xa5, 0x59, 0xc4, 0x8d, 0x57, 0xd1, 0xdc, 0x6b, + 0x53, 0xb6, 0x10, 0x0f, 0x9b, 0xd1, 0xc0, 0xe3, 0x89, 0x58, 0x46, 0xd3, 0x3c, 0x93, 0x94, 0xf4, + 0x3c, 0xda, 0x7c, 0x0f, 0xf5, 0x4f, 0x3c, 0x49, 0xa8, 0xc7, 0xf1, 0x73, 0xa8, 0xcd, 0x38, 0x75, + 0x79, 0xac, 0x23, 0x0b, 0xb5, 0xd4, 0xce, 0x89, 0x5d, 0x8c, 0xb5, 0x7b, 0x52, 0x26, 0x45, 0x1b, + 0x63, 0x50, 0x5c, 0x9a, 0x52, 0xfd, 0xc0, 0x42, 0xad, 0x23, 0x22, 0xd7, 0xcd, 0x1f, 0x08, 0x6a, + 0xb9, 0x0d, 0xeb, 0x50, 0x4f, 0x63, 0xca, 0x78, 0xdf, 0x95, 0x83, 0x8e, 0xc8, 0xa6, 0xc4, 0x17, + 0xd0, 0x88, 0xf9, 0xb7, 0x25, 0x4f, 0xd2, 0xbe, 0x2b, 0xd3, 0x0a, 0xd9, 0x09, 0x22, 0x17, 0xf3, + 0x68, 0x91, 0xf5, 0x5d, 0xbd, 0x2a, 0x7b, 0x9b, 0x12, 0xb7, 0x40, 0x11, 0x1c, 0xba, 0x62, 0xa1, + 0xd6, 0x71, 0xe7, 0x6c, 0xcb, 0x55, 0x90, 0x8f, 0xb3, 0x88, 0x13, 0xe9, 0x10, 0x3b, 0xb8, 0x7c, + 0xba, 0xf4, 0xfa, 0xc1, 0xd7, 0x50, 0x3f, 0xb4, 0x50, 0xab, 0x41, 0x76, 0x42, 0xf3, 0x67, 0x15, + 0x6a, 0xa3, 0x2c, 0x49, 0xf9, 0x1d, 0x7e, 0x03, 0x8d, 0x19, 0x0d, 0xdc, 0x64, 0x46, 0xe7, 0xbc, + 0x38, 0xef, 0x93, 0xed, 0xdc, 0xdc, 0x63, 0xf7, 0x36, 0x06, 0xb2, 0xf3, 0x0a, 0x96, 0xc8, 0x0f, + 0x3c, 0x89, 0xaf, 0x96, 0x58, 0x8a, 0xcc, 0xd0, 0x0f, 0x3c, 0x22, 0x1d, 0xf8, 0x19, 0x54, 0x29, + 0x9b, 0xcb, 0xb3, 0xa8, 0x9d, 0xd3, 0x7d, 0xe3, 0x15, 0x9b, 0x13, 0xd1, 0x37, 0x2e, 0xa1, 0xd1, + 0x2b, 0x4d, 0x3f, 0x91, 0xf7, 0xc2, 0xc2, 0xc5, 0x0d, 0x8f, 0x13, 0x3f, 0x0c, 0x24, 0x5c, 0x83, + 0xec, 0xcb, 0x46, 0x13, 0x14, 0xb1, 0x17, 0x36, 0xe0, 0xd1, 0x32, 0xf0, 0xbf, 0x8f, 0xfd, 0xbb, + 0xfc, 0x1c, 0x0a, 0xd9, 0xd6, 0x46, 0x07, 0xaa, 0x57, 0x6c, 0x8e, 0x5f, 0xc2, 0x21, 0x8f, 0xe3, + 0x30, 0x2e, 0x98, 0xcf, 0xf7, 0x51, 0xba, 0xa2, 0x49, 0x72, 0x8f, 0x71, 0x8f, 0xe0, 0x50, 0x0a, + 0xd8, 0x06, 0x85, 0x85, 0x6e, 0x3e, 0xf5, 0xb8, 0x63, 0xfc, 0x37, 0x65, 0x5f, 0x87, 0x2e, 0x27, + 0xd2, 0x87, 0x2d, 0x50, 0x5d, 0x9e, 0xb0, 0xd8, 0x8f, 0x52, 0xc1, 0x7d, 0x20, 0xb9, 0xcb, 0x52, + 0xf3, 0x12, 0x14, 0xe1, 0xc7, 0x2a, 0xd4, 0x27, 0x83, 0x0f, 0x03, 0xe7, 0xf3, 0x40, 0xab, 0x60, + 0x0b, 0x2e, 0x26, 0x83, 0xd1, 0x64, 0x38, 0x74, 0xc8, 0xb8, 0xfb, 0xee, 0x76, 0x48, 0x9c, 0xb1, + 0x73, 0xed, 0x7c, 0xbc, 0xbd, 0xe9, 0x92, 0x51, 0xdf, 0x19, 0x68, 0xf0, 0xc2, 0x01, 0xb5, 0x74, + 0xd3, 0xf8, 0x1c, 0x1e, 0x97, 0xca, 0x9c, 0x46, 0xab, 0xe0, 0x33, 0xd0, 0xca, 0x72, 0x44, 0x19, + 0xd7, 0x10, 0x3e, 0x85, 0x93, 0x7f, 0xcc, 0x01, 0xd3, 0x0e, 0xde, 0x3e, 0xfd, 0xb5, 0x32, 0xd1, + 0xc3, 0xca, 0x44, 0x7f, 0x56, 0x26, 0xba, 0x5f, 0x9b, 0x95, 0x87, 0xb5, 0x59, 0xf9, 0xbd, 0x36, + 0x2b, 0x5f, 0xa0, 0xbd, 0xfd, 0xcd, 0xa6, 0x35, 0xf9, 0x79, 0xfd, 0x37, 0x00, 0x00, 0xff, 0xff, + 0x5f, 0xee, 0x92, 0xca, 0x7a, 0x03, 0x00, 0x00, } func (m *Message) Marshal() (dAtA []byte, err error) { @@ -1117,7 +653,7 @@ func (m *System) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *SystemHandshake) Marshal() (dAtA []byte, err error) { +func (m *System_Handshake) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1127,12 +663,12 @@ func (m *SystemHandshake) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *SystemHandshake) MarshalTo(dAtA []byte) (int, error) { +func (m *System_Handshake) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *SystemHandshake) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *System_Handshake) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1147,7 +683,7 @@ func (m *SystemHandshake) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *SystemPing) Marshal() (dAtA []byte, err error) { +func (m *System_Ping) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1157,12 +693,12 @@ func (m *SystemPing) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *SystemPing) MarshalTo(dAtA []byte) (int, error) { +func (m *System_Ping) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *SystemPing) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *System_Ping) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1175,7 +711,7 @@ func (m *SystemPing) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *SystemAck) Marshal() (dAtA []byte, err error) { +func (m *System_Ack) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1185,12 +721,12 @@ func (m *SystemAck) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *SystemAck) MarshalTo(dAtA []byte) (int, error) { +func (m *System_Ack) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *SystemAck) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *System_Ack) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1210,7 +746,7 @@ func (m *SystemAck) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *SystemError) Marshal() (dAtA []byte, err error) { +func (m *System_Error) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1220,12 +756,12 @@ func (m *SystemError) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *SystemError) MarshalTo(dAtA []byte) (int, error) { +func (m *System_Error) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *SystemError) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *System_Error) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1245,408 +781,6 @@ func (m *SystemError) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Sync) 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 *Sync) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Sync) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.TreeId) > 0 { - i -= len(m.TreeId) - copy(dAtA[i:], m.TreeId) - i = encodeVarintSync(dAtA, i, uint64(len(m.TreeId))) - i-- - dAtA[i] = 0x22 - } - if m.TreeHeader != nil { - { - size, err := m.TreeHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSync(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.Message != nil { - { - size, err := m.Message.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSync(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.SpaceId) > 0 { - i -= len(m.SpaceId) - copy(dAtA[i:], m.SpaceId) - i = encodeVarintSync(dAtA, i, uint64(len(m.SpaceId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SyncContentValue) 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 *SyncContentValue) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SyncContentValue) 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 *SyncContentValueValueOfHeadUpdate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SyncContentValueValueOfHeadUpdate) 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 = encodeVarintSync(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *SyncContentValueValueOfFullSyncRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SyncContentValueValueOfFullSyncRequest) 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 = encodeVarintSync(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *SyncContentValueValueOfFullSyncResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SyncContentValueValueOfFullSyncResponse) 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 = encodeVarintSync(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} -func (m *SyncContentValueValueOfAclList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SyncContentValueValueOfAclList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.AclList != nil { - { - size, err := m.AclList.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSync(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - return len(dAtA) - i, nil -} -func (m *SyncACLList) 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 *SyncACLList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SyncACLList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Records) > 0 { - for iNdEx := len(m.Records) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Records[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSync(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *SyncHeadUpdate) 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 *SyncHeadUpdate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SyncHeadUpdate) 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 = encodeVarintSync(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 = encodeVarintSync(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 = encodeVarintSync(dAtA, i, uint64(len(m.Heads[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *SyncFull) 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 *SyncFull) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SyncFull) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *SyncFullRequest) 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 *SyncFullRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SyncFullRequest) 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 = encodeVarintSync(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 = encodeVarintSync(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 = encodeVarintSync(dAtA, i, uint64(len(m.Heads[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *SyncFullResponse) 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 *SyncFullResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SyncFullResponse) 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 = encodeVarintSync(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 = encodeVarintSync(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 = encodeVarintSync(dAtA, i, uint64(len(m.Heads[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - func encodeVarintSync(dAtA []byte, offset int, v uint64) int { offset -= sovSync(v) base := offset @@ -1722,7 +856,7 @@ func (m *System) Size() (n int) { return n } -func (m *SystemHandshake) Size() (n int) { +func (m *System_Handshake) Size() (n int) { if m == nil { return 0 } @@ -1735,7 +869,7 @@ func (m *SystemHandshake) Size() (n int) { return n } -func (m *SystemPing) Size() (n int) { +func (m *System_Ping) Size() (n int) { if m == nil { return 0 } @@ -1747,7 +881,7 @@ func (m *SystemPing) Size() (n int) { return n } -func (m *SystemAck) Size() (n int) { +func (m *System_Ack) Size() (n int) { if m == nil { return 0 } @@ -1760,7 +894,7 @@ func (m *SystemAck) Size() (n int) { return n } -func (m *SystemError) Size() (n int) { +func (m *System_Error) Size() (n int) { if m == nil { return 0 } @@ -1776,196 +910,6 @@ func (m *SystemError) Size() (n int) { return n } -func (m *Sync) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.SpaceId) - if l > 0 { - n += 1 + l + sovSync(uint64(l)) - } - if m.Message != nil { - l = m.Message.Size() - n += 1 + l + sovSync(uint64(l)) - } - if m.TreeHeader != nil { - l = m.TreeHeader.Size() - n += 1 + l + sovSync(uint64(l)) - } - l = len(m.TreeId) - if l > 0 { - n += 1 + l + sovSync(uint64(l)) - } - return n -} - -func (m *SyncContentValue) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Value != nil { - n += m.Value.Size() - } - return n -} - -func (m *SyncContentValueValueOfHeadUpdate) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.HeadUpdate != nil { - l = m.HeadUpdate.Size() - n += 1 + l + sovSync(uint64(l)) - } - return n -} -func (m *SyncContentValueValueOfFullSyncRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.FullSyncRequest != nil { - l = m.FullSyncRequest.Size() - n += 1 + l + sovSync(uint64(l)) - } - return n -} -func (m *SyncContentValueValueOfFullSyncResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.FullSyncResponse != nil { - l = m.FullSyncResponse.Size() - n += 1 + l + sovSync(uint64(l)) - } - return n -} -func (m *SyncContentValueValueOfAclList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.AclList != nil { - l = m.AclList.Size() - n += 1 + l + sovSync(uint64(l)) - } - return n -} -func (m *SyncACLList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Records) > 0 { - for _, e := range m.Records { - l = e.Size() - n += 1 + l + sovSync(uint64(l)) - } - } - return n -} - -func (m *SyncHeadUpdate) 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 + sovSync(uint64(l)) - } - } - if len(m.Changes) > 0 { - for _, e := range m.Changes { - l = e.Size() - n += 1 + l + sovSync(uint64(l)) - } - } - if len(m.SnapshotPath) > 0 { - for _, s := range m.SnapshotPath { - l = len(s) - n += 1 + l + sovSync(uint64(l)) - } - } - return n -} - -func (m *SyncFull) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *SyncFullRequest) 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 + sovSync(uint64(l)) - } - } - if len(m.Changes) > 0 { - for _, e := range m.Changes { - l = e.Size() - n += 1 + l + sovSync(uint64(l)) - } - } - if len(m.SnapshotPath) > 0 { - for _, s := range m.SnapshotPath { - l = len(s) - n += 1 + l + sovSync(uint64(l)) - } - } - return n -} - -func (m *SyncFullResponse) 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 + sovSync(uint64(l)) - } - } - if len(m.Changes) > 0 { - for _, e := range m.Changes { - l = e.Size() - n += 1 + l + sovSync(uint64(l)) - } - } - if len(m.SnapshotPath) > 0 { - for _, s := range m.SnapshotPath { - l = len(s) - n += 1 + l + sovSync(uint64(l)) - } - } - return n -} - func sovSync(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2324,7 +1268,7 @@ func (m *System) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Handshake == nil { - m.Handshake = &SystemHandshake{} + m.Handshake = &System_Handshake{} } if err := m.Handshake.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -2360,7 +1304,7 @@ func (m *System) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Ping == nil { - m.Ping = &SystemPing{} + m.Ping = &System_Ping{} } if err := m.Ping.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -2396,7 +1340,7 @@ func (m *System) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Ack == nil { - m.Ack = &SystemAck{} + m.Ack = &System_Ack{} } if err := m.Ack.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -2423,7 +1367,7 @@ func (m *System) Unmarshal(dAtA []byte) error { } return nil } -func (m *SystemHandshake) Unmarshal(dAtA []byte) error { +func (m *System_Handshake) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2505,7 +1449,7 @@ func (m *SystemHandshake) Unmarshal(dAtA []byte) error { } return nil } -func (m *SystemPing) Unmarshal(dAtA []byte) error { +func (m *System_Ping) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2574,7 +1518,7 @@ func (m *SystemPing) Unmarshal(dAtA []byte) error { } return nil } -func (m *SystemAck) Unmarshal(dAtA []byte) error { +func (m *System_Ack) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2633,7 +1577,7 @@ func (m *SystemAck) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Error == nil { - m.Error = &SystemError{} + m.Error = &System_Error{} } if err := m.Error.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -2660,7 +1604,7 @@ func (m *SystemAck) Unmarshal(dAtA []byte) error { } return nil } -func (m *SystemError) Unmarshal(dAtA []byte) error { +func (m *System_Error) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2703,7 +1647,7 @@ func (m *SystemError) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Code |= SystemErrorCode(b&0x7F) << shift + m.Code |= System_Error_Code(b&0x7F) << shift if b < 0x80 { break } @@ -2761,960 +1705,6 @@ func (m *SystemError) Unmarshal(dAtA []byte) error { } return nil } -func (m *Sync) 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 ErrIntOverflowSync - } - 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: Sync: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Sync: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SpaceId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSync - } - 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 ErrInvalidLengthSync - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SpaceId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSync - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSync - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Message == nil { - m.Message = &SyncContentValue{} - } - if err := m.Message.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TreeHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSync - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSync - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.TreeHeader == nil { - m.TreeHeader = &aclpb.Header{} - } - if err := m.TreeHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TreeId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSync - } - 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 ErrInvalidLengthSync - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TreeId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSync(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSync - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SyncContentValue) 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 ErrIntOverflowSync - } - 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: ContentValue: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ContentValue: 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 ErrIntOverflowSync - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSync - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &SyncHeadUpdate{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Value = &SyncContentValueValueOfHeadUpdate{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 ErrIntOverflowSync - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSync - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &SyncFullRequest{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Value = &SyncContentValueValueOfFullSyncRequest{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 ErrIntOverflowSync - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSync - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &SyncFullResponse{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Value = &SyncContentValueValueOfFullSyncResponse{v} - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AclList", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSync - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSync - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &SyncACLList{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Value = &SyncContentValueValueOfAclList{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSync(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSync - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SyncACLList) 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 ErrIntOverflowSync - } - 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: ACLList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ACLList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Records", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSync - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSync - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Records = append(m.Records, &aclpb.RawRecord{}) - if err := m.Records[len(m.Records)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSync(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSync - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SyncHeadUpdate) 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 ErrIntOverflowSync - } - 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: HeadUpdate: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HeadUpdate: 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 ErrIntOverflowSync - } - 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 ErrInvalidLengthSync - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSync - } - 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 ErrIntOverflowSync - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSync - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Changes = append(m.Changes, &aclpb.RawChange{}) - 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 ErrIntOverflowSync - } - 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 ErrInvalidLengthSync - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SnapshotPath = append(m.SnapshotPath, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSync(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSync - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SyncFull) 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 ErrIntOverflowSync - } - 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: Full: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Full: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipSync(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSync - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SyncFullRequest) 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 ErrIntOverflowSync - } - 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: Request: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Request: 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 ErrIntOverflowSync - } - 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 ErrInvalidLengthSync - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSync - } - 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 ErrIntOverflowSync - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSync - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Changes = append(m.Changes, &aclpb.RawChange{}) - 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 ErrIntOverflowSync - } - 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 ErrInvalidLengthSync - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SnapshotPath = append(m.SnapshotPath, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSync(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSync - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SyncFullResponse) 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 ErrIntOverflowSync - } - 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: Response: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Response: 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 ErrIntOverflowSync - } - 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 ErrInvalidLengthSync - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSync - } - 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 ErrIntOverflowSync - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSync - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Changes = append(m.Changes, &aclpb.RawChange{}) - 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 ErrIntOverflowSync - } - 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 ErrInvalidLengthSync - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSync - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SnapshotPath = append(m.SnapshotPath, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSync(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSync - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipSync(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0