From e743e34849c3d46074203c10f0addbd60fbef99b Mon Sep 17 00:00:00 2001 From: mcrakhman Date: Mon, 12 Sep 2022 21:06:20 +0200 Subject: [PATCH] WIP proto refactoring --- Makefile | 13 +- .../spacesyncproto/protos/spacesync.proto | 44 +- .../spacesyncproto/spacesync.pb.go | 1625 ++++++- pkg/acl/account/accountdata.go | 2 +- pkg/acl/aclchanges/aclpb/aclchanges.pb.go | 3779 +++++++++++------ .../aclchanges/aclpb/protos/aclchanges.proto | 249 +- pkg/acl/list/aclstate.go | 352 +- pkg/acl/list/aclstatebuilder.go | 4 +- pkg/acl/list/changebuilder.go | 98 +- pkg/acl/list/list.go | 28 +- pkg/acl/list/list_test.go | 8 +- pkg/acl/list/record.go | 33 +- pkg/acl/storage/inmemory.go | 32 +- pkg/acl/storage/liststorage.go | 6 +- pkg/acl/storage/provider.go | 8 +- pkg/acl/storage/treestorage.go | 4 +- .../acllistbuilder/liststoragebuilder.go | 40 +- .../liststoragebuildergraph_nix.go | 4 +- .../testutils/testchanges/proto/test.pb.go | 164 +- pkg/acl/tree/change.go | 10 +- pkg/acl/tree/changebuilder.go | 142 +- pkg/acl/tree/changevalidator.go | 2 +- pkg/acl/tree/objecttree.go | 101 +- pkg/acl/tree/objecttree_test.go | 21 +- pkg/acl/tree/objecttreefactory.go | 161 + pkg/acl/tree/rawloader.go | 16 +- pkg/acl/tree/signablecontent.go | 5 +- pkg/acl/tree/tests/benches_test.go | 91 + pkg/acl/tree/treebuilder.go | 2 +- pkg/acl/tree/treestorage.go | 91 - service/storage/service.go | 2 +- syncproto/proto/sync.proto | 41 - syncproto/sync.pb.go | 2042 +-------- 33 files changed, 5022 insertions(+), 4198 deletions(-) create mode 100644 pkg/acl/tree/objecttreefactory.go create mode 100644 pkg/acl/tree/tests/benches_test.go delete mode 100644 pkg/acl/tree/treestorage.go diff --git a/Makefile b/Makefile index 2480115f..b004f35e 100644 --- a/Makefile +++ b/Makefile @@ -13,27 +13,24 @@ endif export PATH=$(GOPATH)/bin:$(shell echo $$PATH) # TODO: folders were changed, so we should update Makefile and protos generation -protos: +proto: @echo 'Generating protobuf packages (Go)...' # Uncomment if needed @$(eval ROOT_PKG := pkg) @$(eval GOGO_START := GOGO_NO_UNDERSCORE=1 GOGO_EXPORT_ONEOF_INTERFACE=1) - @$(eval P_TREE_STORAGE_PATH_PB := $(ROOT_PKG)/acl/treestorage/treepb) @$(eval P_ACL_CHANGES_PATH_PB := $(ROOT_PKG)/acl/aclchanges/aclpb) - @$(eval P_PLAINTEXT_CHANGES_PATH_PB := $(ROOT_PKG)/acl/testutils/testchanges/testchangepb) @$(eval P_SYNC_CHANGES_PATH_PB := syncproto) + @$(eval P_TEST_CHANGES_PATH_PB := $(ROOT_PKG)/acl/testutils/testchanges) @$(eval P_TIMESTAMP := Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types) @$(eval P_STRUCT := Mgoogle/protobuf/struct.proto=github.com/gogo/protobuf/types) @$(eval P_ACL_CHANGES := M$(P_ACL_CHANGES_PATH_PB)/protos/aclchanges.proto=github.com/anytypeio/go-anytype-infrastructure-experiments/$(P_ACL_CHANGES_PATH_PB)) - @$(eval P_TREE_CHANGES := M$(P_TREE_STORAGE_PATH_PB)/protos/tree.proto=github.com/anytypeio/go-anytype-infrastructure-experiments/$(P_TREE_STORAGE_PATH_PB)) # use if needed $(eval PKGMAP := $$(P_TIMESTAMP),$$(P_STRUCT)) $(GOGO_START) protoc --gogofaster_out=:. $(P_ACL_CHANGES_PATH_PB)/protos/*.proto; mv $(P_ACL_CHANGES_PATH_PB)/protos/*.go $(P_ACL_CHANGES_PATH_PB) - $(GOGO_START) protoc --gogofaster_out=:. $(P_TREE_STORAGE_PATH_PB)/protos/*.proto; mv $(P_TREE_STORAGE_PATH_PB)/protos/*.go $(P_TREE_STORAGE_PATH_PB) - $(GOGO_START) protoc --gogofaster_out=:. $(P_PLAINTEXT_CHANGES_PATH_PB)/protos/*.proto; mv $(P_PLAINTEXT_CHANGES_PATH_PB)/protos/*.go $(P_PLAINTEXT_CHANGES_PATH_PB) - $(eval PKGMAP := $$(P_ACL_CHANGES),$$(P_TREE_CHANGES)) + $(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 - protoc --gogofaster_out=$(PKGMAP):. --go-drpc_out=protolib=github.com/gogo/protobuf:. common/commonspace/spacesyncproto/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 a6d2fca5..ecd124b1 100644 --- a/pkg/acl/aclchanges/aclpb/aclchanges.pb.go +++ b/pkg/acl/aclchanges/aclpb/aclchanges.pb.go @@ -22,55 +22,80 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type ACLChange_UserPermissions int32 +type ACLUserPermissions int32 const ( - ACLChange_Admin ACLChange_UserPermissions = 0 - ACLChange_Writer ACLChange_UserPermissions = 1 - ACLChange_Reader ACLChange_UserPermissions = 2 - ACLChange_Removed ACLChange_UserPermissions = 3 + ACLUserPermissions_Admin ACLUserPermissions = 0 + ACLUserPermissions_Writer ACLUserPermissions = 1 + ACLUserPermissions_Reader ACLUserPermissions = 2 + ACLUserPermissions_Removed ACLUserPermissions = 3 ) -var ACLChange_UserPermissions_name = map[int32]string{ +var ACLUserPermissions_name = map[int32]string{ 0: "Admin", 1: "Writer", 2: "Reader", 3: "Removed", } -var ACLChange_UserPermissions_value = map[string]int32{ +var ACLUserPermissions_value = map[string]int32{ "Admin": 0, "Writer": 1, "Reader": 2, "Removed": 3, } -func (x ACLChange_UserPermissions) String() string { - return proto.EnumName(ACLChange_UserPermissions_name, int32(x)) +func (x ACLUserPermissions) String() string { + return proto.EnumName(ACLUserPermissions_name, int32(x)) } -func (ACLChange_UserPermissions) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{1, 0} +func (ACLUserPermissions) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_37a022c841a51877, []int{0} } -type RawChange struct { +type TreeHeaderType int32 + +const ( + TreeHeaderType_Object TreeHeaderType = 0 + TreeHeaderType_Space TreeHeaderType = 1 +) + +var TreeHeaderType_name = map[int32]string{ + 0: "Object", + 1: "Space", +} + +var TreeHeaderType_value = map[string]int32{ + "Object": 0, + "Space": 1, +} + +func (x TreeHeaderType) String() string { + return proto.EnumName(TreeHeaderType_name, int32(x)) +} + +func (TreeHeaderType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_37a022c841a51877, []int{1} +} + +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 *RawChange) Reset() { *m = RawChange{} } -func (m *RawChange) String() string { return proto.CompactTextString(m) } -func (*RawChange) ProtoMessage() {} -func (*RawChange) Descriptor() ([]byte, []int) { +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 *RawChange) XXX_Unmarshal(b []byte) error { +func (m *RawACLRecord) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *RawChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *RawACLRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_RawChange.Marshal(b, m, deterministic) + return xxx_messageInfo_RawACLRecord.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -80,64 +105,62 @@ func (m *RawChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *RawChange) XXX_Merge(src proto.Message) { - xxx_messageInfo_RawChange.Merge(m, src) +func (m *RawACLRecord) XXX_Merge(src proto.Message) { + xxx_messageInfo_RawACLRecord.Merge(m, src) } -func (m *RawChange) XXX_Size() int { +func (m *RawACLRecord) XXX_Size() int { return m.Size() } -func (m *RawChange) XXX_DiscardUnknown() { - xxx_messageInfo_RawChange.DiscardUnknown(m) +func (m *RawACLRecord) XXX_DiscardUnknown() { + xxx_messageInfo_RawACLRecord.DiscardUnknown(m) } -var xxx_messageInfo_RawChange proto.InternalMessageInfo +var xxx_messageInfo_RawACLRecord proto.InternalMessageInfo -func (m *RawChange) GetPayload() []byte { +func (m *RawACLRecord) GetPayload() []byte { if m != nil { return m.Payload } return nil } -func (m *RawChange) GetSignature() []byte { +func (m *RawACLRecord) GetSignature() []byte { if m != nil { return m.Signature } return nil } -func (m *RawChange) 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 *ACLChange_ACLData `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"` +type ACLContentValue struct { + // Types that are valid to be assigned to Value: + // *ACLContentValue_UserAdd + // *ACLContentValue_UserRemove + // *ACLContentValue_UserPermissionChange + // *ACLContentValue_UserInvite + // *ACLContentValue_UserJoin + // *ACLContentValue_UserConfirm + Value isACLContentValue_Value `protobuf_oneof:"value"` } -func (m *ACLChange) Reset() { *m = ACLChange{} } -func (m *ACLChange) String() string { return proto.CompactTextString(m) } -func (*ACLChange) ProtoMessage() {} -func (*ACLChange) Descriptor() ([]byte, []int) { +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 *ACLChange) XXX_Unmarshal(b []byte) error { +func (m *ACLContentValue) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ACLChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ACLContentValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ACLChange.Marshal(b, m, deterministic) + return xxx_messageInfo_ACLContentValue.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -147,229 +170,127 @@ func (m *ACLChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *ACLChange) XXX_Merge(src proto.Message) { - xxx_messageInfo_ACLChange.Merge(m, src) +func (m *ACLContentValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_ACLContentValue.Merge(m, src) } -func (m *ACLChange) XXX_Size() int { +func (m *ACLContentValue) XXX_Size() int { return m.Size() } -func (m *ACLChange) XXX_DiscardUnknown() { - xxx_messageInfo_ACLChange.DiscardUnknown(m) +func (m *ACLContentValue) XXX_DiscardUnknown() { + xxx_messageInfo_ACLContentValue.DiscardUnknown(m) } -var xxx_messageInfo_ACLChange proto.InternalMessageInfo +var xxx_messageInfo_ACLContentValue 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() *ACLChange_ACLData { - 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 ACLChange_ACLContentValue struct { - // Types that are valid to be assigned to Value: - // - // *ACLChange_ACLContentValue_UserAdd - // *ACLChange_ACLContentValue_UserRemove - // *ACLChange_ACLContentValue_UserPermissionChange - // *ACLChange_ACLContentValue_UserInvite - // *ACLChange_ACLContentValue_UserJoin - // *ACLChange_ACLContentValue_UserConfirm - Value isACLChange_ACLContentValue_Value `protobuf_oneof:"value"` -} - -func (m *ACLChange_ACLContentValue) Reset() { *m = ACLChange_ACLContentValue{} } -func (m *ACLChange_ACLContentValue) String() string { return proto.CompactTextString(m) } -func (*ACLChange_ACLContentValue) ProtoMessage() {} -func (*ACLChange_ACLContentValue) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{1, 0} -} -func (m *ACLChange_ACLContentValue) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ACLChange_ACLContentValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ACLChange_ACLContentValue.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_ACLContentValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_ACLChange_ACLContentValue.Merge(m, src) -} -func (m *ACLChange_ACLContentValue) XXX_Size() int { - return m.Size() -} -func (m *ACLChange_ACLContentValue) XXX_DiscardUnknown() { - xxx_messageInfo_ACLChange_ACLContentValue.DiscardUnknown(m) -} - -var xxx_messageInfo_ACLChange_ACLContentValue proto.InternalMessageInfo - -type isACLChange_ACLContentValue_Value interface { - isACLChange_ACLContentValue_Value() +type isACLContentValue_Value interface { + isACLContentValue_Value() MarshalTo([]byte) (int, error) Size() int } -type ACLChange_ACLContentValue_UserAdd struct { - UserAdd *ACLChange_UserAdd `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 ACLChange_ACLContentValue_UserRemove struct { - UserRemove *ACLChange_UserRemove `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 ACLChange_ACLContentValue_UserPermissionChange struct { - UserPermissionChange *ACLChange_UserPermissionChange `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 ACLChange_ACLContentValue_UserInvite struct { - UserInvite *ACLChange_UserInvite `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 ACLChange_ACLContentValue_UserJoin struct { - UserJoin *ACLChange_UserJoin `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 ACLChange_ACLContentValue_UserConfirm struct { - UserConfirm *ACLChange_UserConfirm `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 (*ACLChange_ACLContentValue_UserAdd) isACLChange_ACLContentValue_Value() {} -func (*ACLChange_ACLContentValue_UserRemove) isACLChange_ACLContentValue_Value() {} -func (*ACLChange_ACLContentValue_UserPermissionChange) isACLChange_ACLContentValue_Value() {} -func (*ACLChange_ACLContentValue_UserInvite) isACLChange_ACLContentValue_Value() {} -func (*ACLChange_ACLContentValue_UserJoin) isACLChange_ACLContentValue_Value() {} -func (*ACLChange_ACLContentValue_UserConfirm) isACLChange_ACLContentValue_Value() {} +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 *ACLChange_ACLContentValue) GetValue() isACLChange_ACLContentValue_Value { +func (m *ACLContentValue) GetValue() isACLContentValue_Value { if m != nil { return m.Value } return nil } -func (m *ACLChange_ACLContentValue) GetUserAdd() *ACLChange_UserAdd { - if x, ok := m.GetValue().(*ACLChange_ACLContentValue_UserAdd); ok { +func (m *ACLContentValue) GetUserAdd() *ACLUserAdd { + if x, ok := m.GetValue().(*ACLContentValue_UserAdd); ok { return x.UserAdd } return nil } -func (m *ACLChange_ACLContentValue) GetUserRemove() *ACLChange_UserRemove { - if x, ok := m.GetValue().(*ACLChange_ACLContentValue_UserRemove); ok { +func (m *ACLContentValue) GetUserRemove() *ACLUserRemove { + if x, ok := m.GetValue().(*ACLContentValue_UserRemove); ok { return x.UserRemove } return nil } -func (m *ACLChange_ACLContentValue) GetUserPermissionChange() *ACLChange_UserPermissionChange { - if x, ok := m.GetValue().(*ACLChange_ACLContentValue_UserPermissionChange); ok { +func (m *ACLContentValue) GetUserPermissionChange() *ACLUserPermissionChange { + if x, ok := m.GetValue().(*ACLContentValue_UserPermissionChange); ok { return x.UserPermissionChange } return nil } -func (m *ACLChange_ACLContentValue) GetUserInvite() *ACLChange_UserInvite { - if x, ok := m.GetValue().(*ACLChange_ACLContentValue_UserInvite); ok { +func (m *ACLContentValue) GetUserInvite() *ACLUserInvite { + if x, ok := m.GetValue().(*ACLContentValue_UserInvite); ok { return x.UserInvite } return nil } -func (m *ACLChange_ACLContentValue) GetUserJoin() *ACLChange_UserJoin { - if x, ok := m.GetValue().(*ACLChange_ACLContentValue_UserJoin); ok { +func (m *ACLContentValue) GetUserJoin() *ACLUserJoin { + if x, ok := m.GetValue().(*ACLContentValue_UserJoin); ok { return x.UserJoin } return nil } -func (m *ACLChange_ACLContentValue) GetUserConfirm() *ACLChange_UserConfirm { - if x, ok := m.GetValue().(*ACLChange_ACLContentValue_UserConfirm); 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 (*ACLChange_ACLContentValue) XXX_OneofWrappers() []interface{} { +func (*ACLContentValue) XXX_OneofWrappers() []interface{} { return []interface{}{ - (*ACLChange_ACLContentValue_UserAdd)(nil), - (*ACLChange_ACLContentValue_UserRemove)(nil), - (*ACLChange_ACLContentValue_UserPermissionChange)(nil), - (*ACLChange_ACLContentValue_UserInvite)(nil), - (*ACLChange_ACLContentValue_UserJoin)(nil), - (*ACLChange_ACLContentValue_UserConfirm)(nil), + (*ACLContentValue_UserAdd)(nil), + (*ACLContentValue_UserRemove)(nil), + (*ACLContentValue_UserPermissionChange)(nil), + (*ACLContentValue_UserInvite)(nil), + (*ACLContentValue_UserJoin)(nil), + (*ACLContentValue_UserConfirm)(nil), } } -type ACLChange_ACLData struct { - AclSnapshot *ACLChange_ACLSnapshot `protobuf:"bytes,1,opt,name=aclSnapshot,proto3" json:"aclSnapshot,omitempty"` - AclContent []*ACLChange_ACLContentValue `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 *ACLChange_ACLData) Reset() { *m = ACLChange_ACLData{} } -func (m *ACLChange_ACLData) String() string { return proto.CompactTextString(m) } -func (*ACLChange_ACLData) ProtoMessage() {} -func (*ACLChange_ACLData) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{1, 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 *ACLChange_ACLData) XXX_Unmarshal(b []byte) error { +func (m *ACLData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ACLChange_ACLData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ACLData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ACLChange_ACLData.Marshal(b, m, deterministic) + return xxx_messageInfo_ACLData.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -379,49 +300,43 @@ func (m *ACLChange_ACLData) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } -func (m *ACLChange_ACLData) XXX_Merge(src proto.Message) { - xxx_messageInfo_ACLChange_ACLData.Merge(m, src) +func (m *ACLData) XXX_Merge(src proto.Message) { + xxx_messageInfo_ACLData.Merge(m, src) } -func (m *ACLChange_ACLData) XXX_Size() int { +func (m *ACLData) XXX_Size() int { return m.Size() } -func (m *ACLChange_ACLData) XXX_DiscardUnknown() { - xxx_messageInfo_ACLChange_ACLData.DiscardUnknown(m) +func (m *ACLData) XXX_DiscardUnknown() { + xxx_messageInfo_ACLData.DiscardUnknown(m) } -var xxx_messageInfo_ACLChange_ACLData proto.InternalMessageInfo +var xxx_messageInfo_ACLData proto.InternalMessageInfo -func (m *ACLChange_ACLData) GetAclSnapshot() *ACLChange_ACLSnapshot { - if m != nil { - return m.AclSnapshot - } - return nil -} - -func (m *ACLChange_ACLData) GetAclContent() []*ACLChange_ACLContentValue { +func (m *ACLData) GetAclContent() []*ACLContentValue { if m != nil { return m.AclContent } return nil } -type ACLChange_ACLSnapshot struct { - // We don't need ACLState as a separate message now, because we simplified the snapshot model - AclState *ACLChange_ACLState `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 *ACLChange_ACLSnapshot) Reset() { *m = ACLChange_ACLSnapshot{} } -func (m *ACLChange_ACLSnapshot) String() string { return proto.CompactTextString(m) } -func (*ACLChange_ACLSnapshot) ProtoMessage() {} -func (*ACLChange_ACLSnapshot) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{1, 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 *ACLChange_ACLSnapshot) XXX_Unmarshal(b []byte) error { +func (m *ACLState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ACLChange_ACLSnapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ACLState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ACLChange_ACLSnapshot.Marshal(b, m, deterministic) + return xxx_messageInfo_ACLState.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -431,105 +346,59 @@ func (m *ACLChange_ACLSnapshot) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *ACLChange_ACLSnapshot) XXX_Merge(src proto.Message) { - xxx_messageInfo_ACLChange_ACLSnapshot.Merge(m, src) +func (m *ACLState) XXX_Merge(src proto.Message) { + xxx_messageInfo_ACLState.Merge(m, src) } -func (m *ACLChange_ACLSnapshot) XXX_Size() int { +func (m *ACLState) XXX_Size() int { return m.Size() } -func (m *ACLChange_ACLSnapshot) XXX_DiscardUnknown() { - xxx_messageInfo_ACLChange_ACLSnapshot.DiscardUnknown(m) +func (m *ACLState) XXX_DiscardUnknown() { + xxx_messageInfo_ACLState.DiscardUnknown(m) } -var xxx_messageInfo_ACLChange_ACLSnapshot proto.InternalMessageInfo +var xxx_messageInfo_ACLState proto.InternalMessageInfo -func (m *ACLChange_ACLSnapshot) GetAclState() *ACLChange_ACLState { - if m != nil { - return m.AclState - } - return nil -} - -type ACLChange_ACLState struct { - ReadKeyHashes []uint64 `protobuf:"varint,1,rep,packed,name=readKeyHashes,proto3" json:"readKeyHashes,omitempty"` - UserStates []*ACLChange_UserState `protobuf:"bytes,2,rep,name=userStates,proto3" json:"userStates,omitempty"` - Invites map[string]*ACLChange_UserInvite `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 *ACLChange_ACLState) Reset() { *m = ACLChange_ACLState{} } -func (m *ACLChange_ACLState) String() string { return proto.CompactTextString(m) } -func (*ACLChange_ACLState) ProtoMessage() {} -func (*ACLChange_ACLState) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{1, 3} -} -func (m *ACLChange_ACLState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ACLChange_ACLState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ACLChange_ACLState.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_ACLState) XXX_Merge(src proto.Message) { - xxx_messageInfo_ACLChange_ACLState.Merge(m, src) -} -func (m *ACLChange_ACLState) XXX_Size() int { - return m.Size() -} -func (m *ACLChange_ACLState) XXX_DiscardUnknown() { - xxx_messageInfo_ACLChange_ACLState.DiscardUnknown(m) -} - -var xxx_messageInfo_ACLChange_ACLState proto.InternalMessageInfo - -func (m *ACLChange_ACLState) GetReadKeyHashes() []uint64 { +func (m *ACLState) GetReadKeyHashes() []uint64 { if m != nil { return m.ReadKeyHashes } return nil } -func (m *ACLChange_ACLState) GetUserStates() []*ACLChange_UserState { +func (m *ACLState) GetUserStates() []*ACLUserState { if m != nil { return m.UserStates } return nil } -func (m *ACLChange_ACLState) GetInvites() map[string]*ACLChange_UserInvite { +func (m *ACLState) GetInvites() map[string]*ACLUserInvite { if m != nil { return m.Invites } return nil } -type ACLChange_UserState 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 ACLChange_UserPermissions `protobuf:"varint,4,opt,name=permissions,proto3,enum=acl.ACLChange_UserPermissions" 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 *ACLChange_UserState) Reset() { *m = ACLChange_UserState{} } -func (m *ACLChange_UserState) String() string { return proto.CompactTextString(m) } -func (*ACLChange_UserState) ProtoMessage() {} -func (*ACLChange_UserState) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{1, 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 *ACLChange_UserState) XXX_Unmarshal(b []byte) error { +func (m *ACLUserState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ACLChange_UserState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ACLUserState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ACLChange_UserState.Marshal(b, m, deterministic) + return xxx_messageInfo_ACLUserState.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -539,47 +408,47 @@ func (m *ACLChange_UserState) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *ACLChange_UserState) XXX_Merge(src proto.Message) { - xxx_messageInfo_ACLChange_UserState.Merge(m, src) +func (m *ACLUserState) XXX_Merge(src proto.Message) { + xxx_messageInfo_ACLUserState.Merge(m, src) } -func (m *ACLChange_UserState) XXX_Size() int { +func (m *ACLUserState) XXX_Size() int { return m.Size() } -func (m *ACLChange_UserState) XXX_DiscardUnknown() { - xxx_messageInfo_ACLChange_UserState.DiscardUnknown(m) +func (m *ACLUserState) XXX_DiscardUnknown() { + xxx_messageInfo_ACLUserState.DiscardUnknown(m) } -var xxx_messageInfo_ACLChange_UserState proto.InternalMessageInfo +var xxx_messageInfo_ACLUserState proto.InternalMessageInfo -func (m *ACLChange_UserState) GetIdentity() string { +func (m *ACLUserState) GetIdentity() []byte { if m != nil { return m.Identity } - return "" + return nil } -func (m *ACLChange_UserState) GetEncryptionKey() []byte { +func (m *ACLUserState) GetEncryptionKey() []byte { if m != nil { return m.EncryptionKey } return nil } -func (m *ACLChange_UserState) GetEncryptedReadKeys() [][]byte { +func (m *ACLUserState) GetEncryptedReadKeys() [][]byte { if m != nil { return m.EncryptedReadKeys } return nil } -func (m *ACLChange_UserState) GetPermissions() ACLChange_UserPermissions { +func (m *ACLUserState) GetPermissions() ACLUserPermissions { if m != nil { return m.Permissions } - return ACLChange_Admin + return ACLUserPermissions_Admin } -func (m *ACLChange_UserState) GetIsConfirmed() bool { +func (m *ACLUserState) GetIsConfirmed() bool { if m != nil { return m.IsConfirmed } @@ -587,25 +456,25 @@ func (m *ACLChange_UserState) GetIsConfirmed() bool { } // we already know identity and encryptionKey -type ACLChange_UserAdd 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 ACLChange_UserPermissions `protobuf:"varint,4,opt,name=permissions,proto3,enum=acl.ACLChange_UserPermissions" 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 *ACLChange_UserAdd) Reset() { *m = ACLChange_UserAdd{} } -func (m *ACLChange_UserAdd) String() string { return proto.CompactTextString(m) } -func (*ACLChange_UserAdd) ProtoMessage() {} -func (*ACLChange_UserAdd) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{1, 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 *ACLChange_UserAdd) XXX_Unmarshal(b []byte) error { +func (m *ACLUserAdd) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ACLChange_UserAdd) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ACLUserAdd) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ACLChange_UserAdd.Marshal(b, m, deterministic) + return xxx_messageInfo_ACLUserAdd.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -615,64 +484,64 @@ func (m *ACLChange_UserAdd) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } -func (m *ACLChange_UserAdd) XXX_Merge(src proto.Message) { - xxx_messageInfo_ACLChange_UserAdd.Merge(m, src) +func (m *ACLUserAdd) XXX_Merge(src proto.Message) { + xxx_messageInfo_ACLUserAdd.Merge(m, src) } -func (m *ACLChange_UserAdd) XXX_Size() int { +func (m *ACLUserAdd) XXX_Size() int { return m.Size() } -func (m *ACLChange_UserAdd) XXX_DiscardUnknown() { - xxx_messageInfo_ACLChange_UserAdd.DiscardUnknown(m) +func (m *ACLUserAdd) XXX_DiscardUnknown() { + xxx_messageInfo_ACLUserAdd.DiscardUnknown(m) } -var xxx_messageInfo_ACLChange_UserAdd proto.InternalMessageInfo +var xxx_messageInfo_ACLUserAdd proto.InternalMessageInfo -func (m *ACLChange_UserAdd) GetIdentity() string { +func (m *ACLUserAdd) GetIdentity() []byte { if m != nil { return m.Identity } - return "" + return nil } -func (m *ACLChange_UserAdd) GetEncryptionKey() []byte { +func (m *ACLUserAdd) GetEncryptionKey() []byte { if m != nil { return m.EncryptionKey } return nil } -func (m *ACLChange_UserAdd) GetEncryptedReadKeys() [][]byte { +func (m *ACLUserAdd) GetEncryptedReadKeys() [][]byte { if m != nil { return m.EncryptedReadKeys } return nil } -func (m *ACLChange_UserAdd) GetPermissions() ACLChange_UserPermissions { +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 ACLChange_UserConfirm 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 *ACLChange_UserConfirm) Reset() { *m = ACLChange_UserConfirm{} } -func (m *ACLChange_UserConfirm) String() string { return proto.CompactTextString(m) } -func (*ACLChange_UserConfirm) ProtoMessage() {} -func (*ACLChange_UserConfirm) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{1, 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 *ACLChange_UserConfirm) XXX_Unmarshal(b []byte) error { +func (m *ACLUserConfirm) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ACLChange_UserConfirm) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ACLUserConfirm) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ACLChange_UserConfirm.Marshal(b, m, deterministic) + return xxx_messageInfo_ACLUserConfirm.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -682,52 +551,52 @@ func (m *ACLChange_UserConfirm) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *ACLChange_UserConfirm) XXX_Merge(src proto.Message) { - xxx_messageInfo_ACLChange_UserConfirm.Merge(m, src) +func (m *ACLUserConfirm) XXX_Merge(src proto.Message) { + xxx_messageInfo_ACLUserConfirm.Merge(m, src) } -func (m *ACLChange_UserConfirm) XXX_Size() int { +func (m *ACLUserConfirm) XXX_Size() int { return m.Size() } -func (m *ACLChange_UserConfirm) XXX_DiscardUnknown() { - xxx_messageInfo_ACLChange_UserConfirm.DiscardUnknown(m) +func (m *ACLUserConfirm) XXX_DiscardUnknown() { + xxx_messageInfo_ACLUserConfirm.DiscardUnknown(m) } -var xxx_messageInfo_ACLChange_UserConfirm proto.InternalMessageInfo +var xxx_messageInfo_ACLUserConfirm proto.InternalMessageInfo -func (m *ACLChange_UserConfirm) GetIdentity() string { +func (m *ACLUserConfirm) GetIdentity() []byte { if m != nil { return m.Identity } - return "" + return nil } -func (m *ACLChange_UserConfirm) GetUserAddId() string { +func (m *ACLUserConfirm) GetUserAddId() string { if m != nil { return m.UserAddId } return "" } -type ACLChange_UserInvite 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 ACLChange_UserPermissions `protobuf:"varint,4,opt,name=permissions,proto3,enum=acl.ACLChange_UserPermissions" 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 *ACLChange_UserInvite) Reset() { *m = ACLChange_UserInvite{} } -func (m *ACLChange_UserInvite) String() string { return proto.CompactTextString(m) } -func (*ACLChange_UserInvite) ProtoMessage() {} -func (*ACLChange_UserInvite) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{1, 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 *ACLChange_UserInvite) XXX_Unmarshal(b []byte) error { +func (m *ACLUserInvite) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ACLChange_UserInvite) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ACLUserInvite) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ACLChange_UserInvite.Marshal(b, m, deterministic) + return xxx_messageInfo_ACLUserInvite.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -737,73 +606,73 @@ func (m *ACLChange_UserInvite) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } -func (m *ACLChange_UserInvite) XXX_Merge(src proto.Message) { - xxx_messageInfo_ACLChange_UserInvite.Merge(m, src) +func (m *ACLUserInvite) XXX_Merge(src proto.Message) { + xxx_messageInfo_ACLUserInvite.Merge(m, src) } -func (m *ACLChange_UserInvite) XXX_Size() int { +func (m *ACLUserInvite) XXX_Size() int { return m.Size() } -func (m *ACLChange_UserInvite) XXX_DiscardUnknown() { - xxx_messageInfo_ACLChange_UserInvite.DiscardUnknown(m) +func (m *ACLUserInvite) XXX_DiscardUnknown() { + xxx_messageInfo_ACLUserInvite.DiscardUnknown(m) } -var xxx_messageInfo_ACLChange_UserInvite proto.InternalMessageInfo +var xxx_messageInfo_ACLUserInvite proto.InternalMessageInfo -func (m *ACLChange_UserInvite) GetAcceptPublicKey() []byte { +func (m *ACLUserInvite) GetAcceptPublicKey() []byte { if m != nil { return m.AcceptPublicKey } return nil } -func (m *ACLChange_UserInvite) GetEncryptPublicKey() []byte { +func (m *ACLUserInvite) GetEncryptPublicKey() []byte { if m != nil { return m.EncryptPublicKey } return nil } -func (m *ACLChange_UserInvite) GetEncryptedReadKeys() [][]byte { +func (m *ACLUserInvite) GetEncryptedReadKeys() [][]byte { if m != nil { return m.EncryptedReadKeys } return nil } -func (m *ACLChange_UserInvite) GetPermissions() ACLChange_UserPermissions { +func (m *ACLUserInvite) GetPermissions() ACLUserPermissions { if m != nil { return m.Permissions } - return ACLChange_Admin + return ACLUserPermissions_Admin } -func (m *ACLChange_UserInvite) GetInviteId() string { +func (m *ACLUserInvite) GetInviteId() string { if m != nil { return m.InviteId } return "" } -type ACLChange_UserJoin 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 *ACLChange_UserJoin) Reset() { *m = ACLChange_UserJoin{} } -func (m *ACLChange_UserJoin) String() string { return proto.CompactTextString(m) } -func (*ACLChange_UserJoin) ProtoMessage() {} -func (*ACLChange_UserJoin) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{1, 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 *ACLChange_UserJoin) XXX_Unmarshal(b []byte) error { +func (m *ACLUserJoin) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ACLChange_UserJoin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ACLUserJoin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ACLChange_UserJoin.Marshal(b, m, deterministic) + return xxx_messageInfo_ACLUserJoin.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -813,70 +682,70 @@ func (m *ACLChange_UserJoin) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *ACLChange_UserJoin) XXX_Merge(src proto.Message) { - xxx_messageInfo_ACLChange_UserJoin.Merge(m, src) +func (m *ACLUserJoin) XXX_Merge(src proto.Message) { + xxx_messageInfo_ACLUserJoin.Merge(m, src) } -func (m *ACLChange_UserJoin) XXX_Size() int { +func (m *ACLUserJoin) XXX_Size() int { return m.Size() } -func (m *ACLChange_UserJoin) XXX_DiscardUnknown() { - xxx_messageInfo_ACLChange_UserJoin.DiscardUnknown(m) +func (m *ACLUserJoin) XXX_DiscardUnknown() { + xxx_messageInfo_ACLUserJoin.DiscardUnknown(m) } -var xxx_messageInfo_ACLChange_UserJoin proto.InternalMessageInfo +var xxx_messageInfo_ACLUserJoin proto.InternalMessageInfo -func (m *ACLChange_UserJoin) GetIdentity() string { +func (m *ACLUserJoin) GetIdentity() []byte { if m != nil { return m.Identity } - return "" + return nil } -func (m *ACLChange_UserJoin) GetEncryptionKey() []byte { +func (m *ACLUserJoin) GetEncryptionKey() []byte { if m != nil { return m.EncryptionKey } return nil } -func (m *ACLChange_UserJoin) GetAcceptSignature() []byte { +func (m *ACLUserJoin) GetAcceptSignature() []byte { if m != nil { return m.AcceptSignature } return nil } -func (m *ACLChange_UserJoin) GetUserInviteId() string { +func (m *ACLUserJoin) GetUserInviteId() string { if m != nil { return m.UserInviteId } return "" } -func (m *ACLChange_UserJoin) GetEncryptedReadKeys() [][]byte { +func (m *ACLUserJoin) GetEncryptedReadKeys() [][]byte { if m != nil { return m.EncryptedReadKeys } return nil } -type ACLChange_UserRemove struct { - Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` - ReadKeyReplaces []*ACLChange_ReadKeyReplace `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 *ACLChange_UserRemove) Reset() { *m = ACLChange_UserRemove{} } -func (m *ACLChange_UserRemove) String() string { return proto.CompactTextString(m) } -func (*ACLChange_UserRemove) ProtoMessage() {} -func (*ACLChange_UserRemove) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{1, 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 *ACLChange_UserRemove) XXX_Unmarshal(b []byte) error { +func (m *ACLUserRemove) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ACLChange_UserRemove) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ACLUserRemove) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ACLChange_UserRemove.Marshal(b, m, deterministic) + return xxx_messageInfo_ACLUserRemove.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -886,50 +755,50 @@ func (m *ACLChange_UserRemove) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } -func (m *ACLChange_UserRemove) XXX_Merge(src proto.Message) { - xxx_messageInfo_ACLChange_UserRemove.Merge(m, src) +func (m *ACLUserRemove) XXX_Merge(src proto.Message) { + xxx_messageInfo_ACLUserRemove.Merge(m, src) } -func (m *ACLChange_UserRemove) XXX_Size() int { +func (m *ACLUserRemove) XXX_Size() int { return m.Size() } -func (m *ACLChange_UserRemove) XXX_DiscardUnknown() { - xxx_messageInfo_ACLChange_UserRemove.DiscardUnknown(m) +func (m *ACLUserRemove) XXX_DiscardUnknown() { + xxx_messageInfo_ACLUserRemove.DiscardUnknown(m) } -var xxx_messageInfo_ACLChange_UserRemove proto.InternalMessageInfo +var xxx_messageInfo_ACLUserRemove proto.InternalMessageInfo -func (m *ACLChange_UserRemove) GetIdentity() string { +func (m *ACLUserRemove) GetIdentity() []byte { if m != nil { return m.Identity } - return "" + return nil } -func (m *ACLChange_UserRemove) GetReadKeyReplaces() []*ACLChange_ReadKeyReplace { +func (m *ACLUserRemove) GetReadKeyReplaces() []*ACLReadKeyReplace { if m != nil { return m.ReadKeyReplaces } return nil } -type ACLChange_ReadKeyReplace 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 *ACLChange_ReadKeyReplace) Reset() { *m = ACLChange_ReadKeyReplace{} } -func (m *ACLChange_ReadKeyReplace) String() string { return proto.CompactTextString(m) } -func (*ACLChange_ReadKeyReplace) ProtoMessage() {} -func (*ACLChange_ReadKeyReplace) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{1, 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 *ACLChange_ReadKeyReplace) XXX_Unmarshal(b []byte) error { +func (m *ACLReadKeyReplace) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ACLChange_ReadKeyReplace) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ACLReadKeyReplace) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ACLChange_ReadKeyReplace.Marshal(b, m, deterministic) + return xxx_messageInfo_ACLReadKeyReplace.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -939,56 +808,56 @@ func (m *ACLChange_ReadKeyReplace) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } -func (m *ACLChange_ReadKeyReplace) XXX_Merge(src proto.Message) { - xxx_messageInfo_ACLChange_ReadKeyReplace.Merge(m, src) +func (m *ACLReadKeyReplace) XXX_Merge(src proto.Message) { + xxx_messageInfo_ACLReadKeyReplace.Merge(m, src) } -func (m *ACLChange_ReadKeyReplace) XXX_Size() int { +func (m *ACLReadKeyReplace) XXX_Size() int { return m.Size() } -func (m *ACLChange_ReadKeyReplace) XXX_DiscardUnknown() { - xxx_messageInfo_ACLChange_ReadKeyReplace.DiscardUnknown(m) +func (m *ACLReadKeyReplace) XXX_DiscardUnknown() { + xxx_messageInfo_ACLReadKeyReplace.DiscardUnknown(m) } -var xxx_messageInfo_ACLChange_ReadKeyReplace proto.InternalMessageInfo +var xxx_messageInfo_ACLReadKeyReplace proto.InternalMessageInfo -func (m *ACLChange_ReadKeyReplace) GetIdentity() string { +func (m *ACLReadKeyReplace) GetIdentity() []byte { if m != nil { return m.Identity } - return "" + return nil } -func (m *ACLChange_ReadKeyReplace) GetEncryptionKey() []byte { +func (m *ACLReadKeyReplace) GetEncryptionKey() []byte { if m != nil { return m.EncryptionKey } return nil } -func (m *ACLChange_ReadKeyReplace) GetEncryptedReadKey() []byte { +func (m *ACLReadKeyReplace) GetEncryptedReadKey() []byte { if m != nil { return m.EncryptedReadKey } return nil } -type ACLChange_UserPermissionChange struct { - Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` - Permissions ACLChange_UserPermissions `protobuf:"varint,2,opt,name=permissions,proto3,enum=acl.ACLChange_UserPermissions" 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 *ACLChange_UserPermissionChange) Reset() { *m = ACLChange_UserPermissionChange{} } -func (m *ACLChange_UserPermissionChange) String() string { return proto.CompactTextString(m) } -func (*ACLChange_UserPermissionChange) ProtoMessage() {} -func (*ACLChange_UserPermissionChange) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{1, 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 *ACLChange_UserPermissionChange) XXX_Unmarshal(b []byte) error { +func (m *ACLUserPermissionChange) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ACLChange_UserPermissionChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ACLUserPermissionChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ACLChange_UserPermissionChange.Marshal(b, m, deterministic) + return xxx_messageInfo_ACLUserPermissionChange.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -998,49 +867,462 @@ func (m *ACLChange_UserPermissionChange) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } -func (m *ACLChange_UserPermissionChange) XXX_Merge(src proto.Message) { - xxx_messageInfo_ACLChange_UserPermissionChange.Merge(m, src) +func (m *ACLUserPermissionChange) XXX_Merge(src proto.Message) { + xxx_messageInfo_ACLUserPermissionChange.Merge(m, src) } -func (m *ACLChange_UserPermissionChange) XXX_Size() int { +func (m *ACLUserPermissionChange) XXX_Size() int { return m.Size() } -func (m *ACLChange_UserPermissionChange) XXX_DiscardUnknown() { - xxx_messageInfo_ACLChange_UserPermissionChange.DiscardUnknown(m) +func (m *ACLUserPermissionChange) XXX_DiscardUnknown() { + xxx_messageInfo_ACLUserPermissionChange.DiscardUnknown(m) } -var xxx_messageInfo_ACLChange_UserPermissionChange proto.InternalMessageInfo +var xxx_messageInfo_ACLUserPermissionChange proto.InternalMessageInfo -func (m *ACLChange_UserPermissionChange) GetIdentity() string { +func (m *ACLUserPermissionChange) GetIdentity() []byte { if m != nil { return m.Identity } + return nil +} + +func (m *ACLUserPermissionChange) GetPermissions() ACLUserPermissions { + if m != nil { + return m.Permissions + } + return ACLUserPermissions_Admin +} + +type ACLRecord struct { + PrevId string `protobuf:"bytes,1,opt,name=prevId,proto3" json:"prevId,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 *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 *ACLRecord) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ACLRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ACLRecord.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 *ACLRecord) XXX_Merge(src proto.Message) { + xxx_messageInfo_ACLRecord.Merge(m, src) +} +func (m *ACLRecord) XXX_Size() int { + return m.Size() +} +func (m *ACLRecord) XXX_DiscardUnknown() { + xxx_messageInfo_ACLRecord.DiscardUnknown(m) +} + +var xxx_messageInfo_ACLRecord proto.InternalMessageInfo + +func (m *ACLRecord) GetPrevId() string { + if m != nil { + return m.PrevId + } return "" } -func (m *ACLChange_UserPermissionChange) GetPermissions() ACLChange_UserPermissions { +func (m *ACLRecord) GetIdentity() []byte { if m != nil { - return m.Permissions + return m.Identity } - return ACLChange_Admin + return nil +} + +func (m *ACLRecord) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +func (m *ACLRecord) GetCurrentReadKeyHash() uint64 { + if m != nil { + return m.CurrentReadKeyHash + } + return 0 +} + +func (m *ACLRecord) GetTimestamp() int64 { + if m != nil { + return m.Timestamp + } + return 0 +} + +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 *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 *ACLHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ACLHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ACLHeader.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 *ACLHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_ACLHeader.Merge(m, src) +} +func (m *ACLHeader) XXX_Size() int { + return m.Size() +} +func (m *ACLHeader) XXX_DiscardUnknown() { + xxx_messageInfo_ACLHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_ACLHeader proto.InternalMessageInfo + +func (m *ACLHeader) GetFirstId() string { + if m != nil { + return m.FirstId + } + return "" +} + +func (m *ACLHeader) GetIdentity() []byte { + if m != nil { + 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 "" +} + +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.TreeHeadIds + } + return nil +} + +func (m *TreeChange) GetAclHeadId() string { + if m != nil { + return m.AclHeadId + } + return "" +} + +func (m *TreeChange) GetSnapshotBaseId() string { + if m != nil { + return m.SnapshotBaseId + } + 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.ACLChange_UserPermissions", ACLChange_UserPermissions_name, ACLChange_UserPermissions_value) - proto.RegisterType((*RawChange)(nil), "acl.RawChange") - proto.RegisterType((*ACLChange)(nil), "acl.ACLChange") - proto.RegisterType((*ACLChange_ACLContentValue)(nil), "acl.ACLChange.ACLContentValue") - proto.RegisterType((*ACLChange_ACLData)(nil), "acl.ACLChange.ACLData") - proto.RegisterType((*ACLChange_ACLSnapshot)(nil), "acl.ACLChange.ACLSnapshot") - proto.RegisterType((*ACLChange_ACLState)(nil), "acl.ACLChange.ACLState") - proto.RegisterMapType((map[string]*ACLChange_UserInvite)(nil), "acl.ACLChange.ACLState.InvitesEntry") - proto.RegisterType((*ACLChange_UserState)(nil), "acl.ACLChange.UserState") - proto.RegisterType((*ACLChange_UserAdd)(nil), "acl.ACLChange.UserAdd") - proto.RegisterType((*ACLChange_UserConfirm)(nil), "acl.ACLChange.UserConfirm") - proto.RegisterType((*ACLChange_UserInvite)(nil), "acl.ACLChange.UserInvite") - proto.RegisterType((*ACLChange_UserJoin)(nil), "acl.ACLChange.UserJoin") - proto.RegisterType((*ACLChange_UserRemove)(nil), "acl.ACLChange.UserRemove") - proto.RegisterType((*ACLChange_ReadKeyReplace)(nil), "acl.ACLChange.ReadKeyReplace") - proto.RegisterType((*ACLChange_UserPermissionChange)(nil), "acl.ACLChange.UserPermissionChange") + 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() { @@ -1048,70 +1330,78 @@ func init() { } var fileDescriptor_37a022c841a51877 = []byte{ - // 948 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0x4f, 0x6f, 0xe3, 0x44, - 0x14, 0xf7, 0xc4, 0x4d, 0x1d, 0x3f, 0x87, 0x36, 0x0c, 0x2b, 0xd6, 0x58, 0x4b, 0x88, 0xca, 0x0a, - 0x45, 0x08, 0xa5, 0xab, 0xac, 0x90, 0x56, 0x80, 0x2a, 0xda, 0x82, 0x36, 0xa1, 0x1c, 0x56, 0x53, - 0x2d, 0x08, 0x6e, 0x53, 0x7b, 0x68, 0xad, 0x75, 0x6c, 0xe3, 0x99, 0x14, 0xe5, 0x82, 0xc4, 0x89, - 0x2b, 0x67, 0xbe, 0x0a, 0x5f, 0x60, 0x8f, 0x7b, 0xe4, 0x06, 0x6a, 0xef, 0x5c, 0xf8, 0x02, 0x68, - 0xfe, 0xd8, 0x71, 0x12, 0x6f, 0x24, 0xa4, 0x15, 0x12, 0x87, 0x4a, 0x33, 0xbf, 0xf7, 0x7b, 0xd3, - 0xf7, 0xde, 0xef, 0xbd, 0x17, 0xc3, 0x83, 0xfc, 0xd9, 0xe5, 0x21, 0x0d, 0x13, 0xf9, 0x17, 0x5e, - 0xd1, 0xf4, 0x92, 0x71, 0x79, 0xcc, 0x2f, 0x0e, 0xf3, 0x22, 0x13, 0x19, 0xaf, 0xe1, 0x23, 0x85, - 0x60, 0x9b, 0x86, 0xc9, 0xc1, 0x39, 0xb8, 0x84, 0xfe, 0x70, 0xaa, 0x0c, 0xd8, 0x07, 0x27, 0xa7, - 0x8b, 0x24, 0xa3, 0x91, 0x8f, 0x06, 0x68, 0xd8, 0x25, 0xe5, 0x15, 0xdf, 0x03, 0x97, 0xc7, 0x97, - 0x29, 0x15, 0xf3, 0x82, 0xf9, 0x2d, 0x65, 0x5b, 0x02, 0x78, 0x0f, 0x5a, 0x71, 0xe4, 0xdb, 0x03, - 0x34, 0x74, 0x49, 0x2b, 0x8e, 0x0e, 0xfe, 0x7e, 0x03, 0xdc, 0xe3, 0xd3, 0x2f, 0xcd, 0xab, 0x03, - 0xf0, 0x44, 0xc1, 0xd8, 0x84, 0xd1, 0x68, 0x1a, 0x71, 0x1f, 0x0d, 0xec, 0xa1, 0x4b, 0xea, 0x10, - 0xee, 0x03, 0xd0, 0x30, 0x29, 0x09, 0x2d, 0x45, 0xa8, 0x21, 0xf8, 0x3d, 0xd8, 0xe3, 0x29, 0xcd, - 0xf9, 0x55, 0x26, 0x4e, 0x28, 0x67, 0xd3, 0xf2, 0x7f, 0xad, 0xa1, 0xf8, 0x01, 0x38, 0x34, 0x4c, - 0x3e, 0xa3, 0x82, 0xfa, 0x3b, 0x03, 0x34, 0xf4, 0xc6, 0x6f, 0x8e, 0x68, 0x98, 0x8c, 0xaa, 0x50, - 0xe4, 0x49, 0x5a, 0x49, 0x49, 0x93, 0xb1, 0x99, 0xa2, 0x28, 0xaf, 0xb6, 0xca, 0xac, 0x0e, 0xe1, - 0x11, 0xe0, 0x70, 0x5e, 0x14, 0x2c, 0x15, 0x84, 0xd1, 0xe8, 0x8c, 0x2d, 0x26, 0x94, 0x5f, 0xf9, - 0xbb, 0x03, 0x34, 0xdc, 0x21, 0x0d, 0x16, 0x59, 0x29, 0x11, 0xcf, 0x18, 0x17, 0x74, 0x96, 0xfb, - 0xce, 0x00, 0x0d, 0x6d, 0xb2, 0x04, 0x70, 0x00, 0x9d, 0x38, 0x62, 0xa9, 0x88, 0xc5, 0xc2, 0xef, - 0xa8, 0x1c, 0xaa, 0x7b, 0xf0, 0xab, 0x0d, 0xfb, 0x32, 0xd4, 0x2c, 0x15, 0x2c, 0x15, 0x5f, 0xd1, - 0x64, 0xce, 0xf0, 0x18, 0x9c, 0x39, 0x67, 0xc5, 0x71, 0xa4, 0x15, 0xd9, 0xcc, 0xe8, 0xa9, 0xb6, - 0x4e, 0x2c, 0x52, 0x12, 0xf1, 0xc7, 0x00, 0xf2, 0x48, 0xd8, 0x2c, 0xbb, 0xd6, 0x62, 0x79, 0xe3, - 0xb7, 0x1a, 0xdc, 0x34, 0x61, 0x62, 0x91, 0x1a, 0x1d, 0x7f, 0x03, 0x77, 0xe4, 0xed, 0x09, 0x2b, - 0x66, 0x31, 0xe7, 0x71, 0x96, 0x6a, 0x07, 0x55, 0x70, 0x6f, 0xfc, 0x6e, 0xc3, 0x33, 0xeb, 0xd4, - 0x89, 0x45, 0x1a, 0x9f, 0x28, 0xe3, 0x9a, 0xa6, 0xd7, 0xb1, 0x60, 0x46, 0xa0, 0xa6, 0xb8, 0x34, - 0xa1, 0x8c, 0x4b, 0xdf, 0xf0, 0x87, 0xd0, 0x91, 0xb7, 0x2f, 0xb2, 0x38, 0x55, 0x2a, 0x79, 0xe3, - 0xbb, 0x0d, 0xae, 0xd2, 0x3c, 0xb1, 0x48, 0x45, 0xc5, 0x47, 0xe0, 0xc9, 0xf3, 0x69, 0x96, 0x7e, - 0x17, 0x17, 0x33, 0x25, 0x9b, 0x37, 0x0e, 0x1a, 0x3c, 0x0d, 0x63, 0x62, 0x91, 0xba, 0xc3, 0x89, - 0x03, 0xed, 0x6b, 0x29, 0x44, 0xf0, 0x33, 0x02, 0xc7, 0x74, 0x0f, 0xfe, 0x04, 0x3c, 0x1a, 0x26, - 0xe7, 0xa6, 0xf7, 0x8c, 0x30, 0xc1, 0x66, 0xab, 0x95, 0x0c, 0x52, 0xa7, 0xe3, 0x23, 0xd5, 0xec, - 0x46, 0x65, 0xd5, 0xec, 0xde, 0xb8, 0xbf, 0xe9, 0x5c, 0x6f, 0x03, 0x52, 0xf3, 0x08, 0x4e, 0xc0, - 0xab, 0xbd, 0x8d, 0x1f, 0x42, 0x47, 0xbe, 0x2e, 0xa8, 0x60, 0x26, 0x92, 0xbb, 0x0d, 0x91, 0x48, - 0x33, 0xa9, 0x88, 0xc1, 0x4f, 0x2d, 0xe8, 0x94, 0x30, 0xbe, 0x0f, 0xaf, 0x15, 0xcb, 0x06, 0x66, - 0x7a, 0x42, 0x77, 0xc8, 0x2a, 0x88, 0x1f, 0x69, 0xf5, 0x94, 0x0b, 0x37, 0x61, 0xfb, 0x0d, 0x85, - 0xd4, 0xff, 0xaa, 0xc6, 0xc5, 0x47, 0xe0, 0xc4, 0x4a, 0x44, 0xee, 0xdb, 0xca, 0xed, 0xfe, 0x4b, - 0x02, 0x1c, 0x69, 0xad, 0xf9, 0xe7, 0xa9, 0x28, 0x16, 0xa4, 0x74, 0x0a, 0x9e, 0x42, 0xb7, 0x6e, - 0xc0, 0x3d, 0xb0, 0x9f, 0xb1, 0x85, 0x4a, 0xd6, 0x25, 0xf2, 0x88, 0x0f, 0x8d, 0x4a, 0x5b, 0x9a, - 0x5d, 0xbf, 0x40, 0x34, 0xef, 0xa3, 0xd6, 0x23, 0x14, 0xfc, 0x81, 0xc0, 0xad, 0x02, 0x5e, 0x19, - 0x4c, 0xb4, 0x3a, 0x98, 0xb2, 0x40, 0x2c, 0x0d, 0x8b, 0x45, 0x2e, 0xe2, 0x2c, 0x3d, 0x63, 0x0b, - 0xb3, 0x00, 0x57, 0x41, 0xfc, 0x01, 0xbc, 0x6e, 0x00, 0x16, 0x99, 0x85, 0xa0, 0x13, 0xee, 0x92, - 0x4d, 0x03, 0xfe, 0x14, 0xbc, 0xbc, 0x1a, 0x10, 0xae, 0xa6, 0x61, 0x6f, 0xa3, 0x0d, 0x56, 0xc7, - 0x8b, 0x93, 0xba, 0x8b, 0x5c, 0x5d, 0x53, 0x6e, 0xfa, 0x94, 0x45, 0x6a, 0x28, 0x3a, 0xa4, 0x0e, - 0x05, 0xbf, 0x21, 0x70, 0xcc, 0x7e, 0xf8, 0xff, 0xe5, 0x17, 0x3c, 0x06, 0xaf, 0x36, 0x98, 0x5b, - 0x13, 0xb8, 0x07, 0xae, 0x59, 0x7e, 0xd3, 0x48, 0x05, 0xef, 0x92, 0x25, 0x10, 0xfc, 0x85, 0x00, - 0x96, 0x2d, 0x80, 0x87, 0xb0, 0x4f, 0xc3, 0x90, 0xe5, 0xe2, 0xc9, 0xfc, 0x22, 0x89, 0xc3, 0x33, - 0xd3, 0x4a, 0x5d, 0xb2, 0x0e, 0xe3, 0xf7, 0xa1, 0x67, 0x12, 0x5b, 0x52, 0x75, 0x69, 0x36, 0xf0, - 0xff, 0x5c, 0xfd, 0x00, 0x3a, 0x3a, 0x9f, 0xa9, 0x96, 0xde, 0x25, 0xd5, 0x3d, 0x78, 0x8e, 0xa0, - 0x53, 0x6e, 0xc3, 0x57, 0x20, 0x7c, 0x55, 0xb0, 0xf3, 0xea, 0x0b, 0xc0, 0xae, 0x17, 0xac, 0x82, - 0xf1, 0x01, 0x74, 0x97, 0x2b, 0x7b, 0x1a, 0xa9, 0xbc, 0x5c, 0xb2, 0x82, 0x35, 0x17, 0xaa, 0xfd, - 0x92, 0x42, 0x05, 0xdf, 0x6b, 0xe9, 0xcc, 0x8f, 0xd3, 0xb6, 0x5c, 0x1e, 0xc3, 0xbe, 0x59, 0x58, - 0x84, 0xe5, 0x09, 0x0d, 0xab, 0x6d, 0xf3, 0xf6, 0x5a, 0x59, 0xc9, 0x0a, 0x8b, 0xac, 0x7b, 0x05, - 0x3f, 0xc2, 0xde, 0x2a, 0xe5, 0x15, 0x94, 0x70, 0xd9, 0x49, 0x55, 0x6e, 0xa6, 0x86, 0x1b, 0x78, - 0x20, 0xe0, 0x4e, 0xd3, 0xcf, 0xea, 0xd6, 0x28, 0xd6, 0xfa, 0xa9, 0xf5, 0xaf, 0xfb, 0xe9, 0xe0, - 0x18, 0xf6, 0xd7, 0xec, 0xd8, 0x85, 0xf6, 0x71, 0x34, 0x8b, 0xd3, 0x9e, 0x85, 0x01, 0x76, 0xbf, - 0x2e, 0x62, 0xc1, 0x8a, 0x1e, 0x92, 0x67, 0x19, 0x2a, 0x2b, 0x7a, 0x2d, 0xec, 0x81, 0xa3, 0xa5, - 0x89, 0x7a, 0xf6, 0xc9, 0x3b, 0xcf, 0x6f, 0xfa, 0xe8, 0xc5, 0x4d, 0x1f, 0xfd, 0x79, 0xd3, 0x47, - 0xbf, 0xdc, 0xf6, 0xad, 0x17, 0xb7, 0x7d, 0xeb, 0xf7, 0xdb, 0xbe, 0xf5, 0x6d, 0x5b, 0x7d, 0x88, - 0x5e, 0xec, 0xaa, 0xef, 0xce, 0x87, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x2a, 0xe8, 0x23, 0x71, - 0xab, 0x0a, 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]) @@ -1121,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 @@ -1155,7 +1445,7 @@ func (m *RawChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ACLChange) 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]) @@ -1165,96 +1455,12 @@ func (m *ACLChange) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ACLChange) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLContentValue) 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 *ACLChange_ACLContentValue) 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_ACLContentValue) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ACLChange_ACLContentValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLContentValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1271,12 +1477,12 @@ func (m *ACLChange_ACLContentValue) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } -func (m *ACLChange_ACLContentValue_UserAdd) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLContentValue_UserAdd) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChange_ACLContentValue_UserAdd) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLContentValue_UserAdd) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) if m.UserAdd != nil { { @@ -1292,12 +1498,12 @@ func (m *ACLChange_ACLContentValue_UserAdd) MarshalToSizedBuffer(dAtA []byte) (i } return len(dAtA) - i, nil } -func (m *ACLChange_ACLContentValue_UserRemove) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLContentValue_UserRemove) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChange_ACLContentValue_UserRemove) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLContentValue_UserRemove) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) if m.UserRemove != nil { { @@ -1313,12 +1519,12 @@ func (m *ACLChange_ACLContentValue_UserRemove) MarshalToSizedBuffer(dAtA []byte) } return len(dAtA) - i, nil } -func (m *ACLChange_ACLContentValue_UserPermissionChange) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLContentValue_UserPermissionChange) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChange_ACLContentValue_UserPermissionChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLContentValue_UserPermissionChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) if m.UserPermissionChange != nil { { @@ -1334,12 +1540,12 @@ func (m *ACLChange_ACLContentValue_UserPermissionChange) MarshalToSizedBuffer(dA } return len(dAtA) - i, nil } -func (m *ACLChange_ACLContentValue_UserInvite) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLContentValue_UserInvite) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChange_ACLContentValue_UserInvite) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLContentValue_UserInvite) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) if m.UserInvite != nil { { @@ -1355,12 +1561,12 @@ func (m *ACLChange_ACLContentValue_UserInvite) MarshalToSizedBuffer(dAtA []byte) } return len(dAtA) - i, nil } -func (m *ACLChange_ACLContentValue_UserJoin) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLContentValue_UserJoin) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChange_ACLContentValue_UserJoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLContentValue_UserJoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) if m.UserJoin != nil { { @@ -1376,12 +1582,12 @@ func (m *ACLChange_ACLContentValue_UserJoin) MarshalToSizedBuffer(dAtA []byte) ( } return len(dAtA) - i, nil } -func (m *ACLChange_ACLContentValue_UserConfirm) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLContentValue_UserConfirm) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChange_ACLContentValue_UserConfirm) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLContentValue_UserConfirm) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) if m.UserConfirm != nil { { @@ -1397,7 +1603,7 @@ func (m *ACLChange_ACLContentValue_UserConfirm) MarshalToSizedBuffer(dAtA []byte } return len(dAtA) - i, nil } -func (m *ACLChange_ACLData) 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]) @@ -1407,12 +1613,12 @@ func (m *ACLChange_ACLData) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ACLChange_ACLData) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLData) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChange_ACLData) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLData) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1428,25 +1634,13 @@ func (m *ACLChange_ACLData) 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 *ACLChange_ACLSnapshot) 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]) @@ -1456,47 +1650,12 @@ func (m *ACLChange_ACLSnapshot) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ACLChange_ACLSnapshot) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLState) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChange_ACLSnapshot) 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 *ACLChange_ACLState) 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_ACLState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ACLChange_ACLState) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1542,27 +1701,27 @@ func (m *ACLChange_ACLState) 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 *ACLChange_UserState) 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]) @@ -1572,12 +1731,12 @@ func (m *ACLChange_UserState) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ACLChange_UserState) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLUserState) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChange_UserState) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLUserState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1623,7 +1782,7 @@ func (m *ACLChange_UserState) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ACLChange_UserAdd) 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]) @@ -1633,12 +1792,12 @@ func (m *ACLChange_UserAdd) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ACLChange_UserAdd) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLUserAdd) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChange_UserAdd) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLUserAdd) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1674,7 +1833,7 @@ func (m *ACLChange_UserAdd) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ACLChange_UserConfirm) 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]) @@ -1684,12 +1843,12 @@ func (m *ACLChange_UserConfirm) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ACLChange_UserConfirm) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLUserConfirm) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChange_UserConfirm) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLUserConfirm) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1711,7 +1870,7 @@ func (m *ACLChange_UserConfirm) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ACLChange_UserInvite) 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]) @@ -1721,12 +1880,12 @@ func (m *ACLChange_UserInvite) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ACLChange_UserInvite) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLUserInvite) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChange_UserInvite) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLUserInvite) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1769,7 +1928,7 @@ func (m *ACLChange_UserInvite) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ACLChange_UserJoin) 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]) @@ -1779,12 +1938,12 @@ func (m *ACLChange_UserJoin) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ACLChange_UserJoin) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLUserJoin) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChange_UserJoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLUserJoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1829,7 +1988,7 @@ func (m *ACLChange_UserJoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ACLChange_UserRemove) 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]) @@ -1839,12 +1998,12 @@ func (m *ACLChange_UserRemove) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ACLChange_UserRemove) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLUserRemove) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChange_UserRemove) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLUserRemove) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1873,7 +2032,7 @@ func (m *ACLChange_UserRemove) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ACLChange_ReadKeyReplace) 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]) @@ -1883,12 +2042,12 @@ func (m *ACLChange_ReadKeyReplace) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ACLChange_ReadKeyReplace) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLReadKeyReplace) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChange_ReadKeyReplace) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLReadKeyReplace) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1917,7 +2076,7 @@ func (m *ACLChange_ReadKeyReplace) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *ACLChange_UserPermissionChange) 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]) @@ -1927,12 +2086,12 @@ func (m *ACLChange_UserPermissionChange) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ACLChange_UserPermissionChange) MarshalTo(dAtA []byte) (int, error) { +func (m *ACLUserPermissionChange) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ACLChange_UserPermissionChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ACLUserPermissionChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1952,6 +2111,307 @@ func (m *ACLChange_UserPermissionChange) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } +func (m *ACLRecord) 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 *ACLRecord) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +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 + _ = l + if m.IsSnapshot { + i-- + if m.IsSnapshot { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x40 + } + 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] = 0x3a + } + if m.Timestamp != 0 { + i = encodeVarintAclchanges(dAtA, i, uint64(m.Timestamp)) + i-- + dAtA[i] = 0x30 + } + if m.CurrentReadKeyHash != 0 { + i = encodeVarintAclchanges(dAtA, i, uint64(m.CurrentReadKeyHash)) + i-- + dAtA[i] = 0x28 + } + 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] = 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.AclHeadId) > 0 { + i -= len(m.AclHeadId) + copy(dAtA[i:], m.AclHeadId) + i = encodeVarintAclchanges(dAtA, i, uint64(len(m.AclHeadId))) + 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 *TreeHeader) 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 *TreeHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TreeHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + 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] = 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] = 0x22 + } + if m.TreeHeaderType != 0 { + i = encodeVarintAclchanges(dAtA, i, uint64(m.TreeHeaderType)) + i-- + dAtA[i] = 0x18 + } + 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 + } + 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 encodeVarintAclchanges(dAtA []byte, offset int, v uint64) int { offset -= sovAclchanges(v) base := offset @@ -1963,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 } @@ -1984,50 +2444,7 @@ func (m *RawChange) Size() (n int) { 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 *ACLChange_ACLContentValue) Size() (n int) { +func (m *ACLContentValue) Size() (n int) { if m == nil { return 0 } @@ -2039,7 +2456,7 @@ func (m *ACLChange_ACLContentValue) Size() (n int) { return n } -func (m *ACLChange_ACLContentValue_UserAdd) Size() (n int) { +func (m *ACLContentValue_UserAdd) Size() (n int) { if m == nil { return 0 } @@ -2051,7 +2468,7 @@ func (m *ACLChange_ACLContentValue_UserAdd) Size() (n int) { } return n } -func (m *ACLChange_ACLContentValue_UserRemove) Size() (n int) { +func (m *ACLContentValue_UserRemove) Size() (n int) { if m == nil { return 0 } @@ -2063,7 +2480,7 @@ func (m *ACLChange_ACLContentValue_UserRemove) Size() (n int) { } return n } -func (m *ACLChange_ACLContentValue_UserPermissionChange) Size() (n int) { +func (m *ACLContentValue_UserPermissionChange) Size() (n int) { if m == nil { return 0 } @@ -2075,7 +2492,7 @@ func (m *ACLChange_ACLContentValue_UserPermissionChange) Size() (n int) { } return n } -func (m *ACLChange_ACLContentValue_UserInvite) Size() (n int) { +func (m *ACLContentValue_UserInvite) Size() (n int) { if m == nil { return 0 } @@ -2087,7 +2504,7 @@ func (m *ACLChange_ACLContentValue_UserInvite) Size() (n int) { } return n } -func (m *ACLChange_ACLContentValue_UserJoin) Size() (n int) { +func (m *ACLContentValue_UserJoin) Size() (n int) { if m == nil { return 0 } @@ -2099,7 +2516,7 @@ func (m *ACLChange_ACLContentValue_UserJoin) Size() (n int) { } return n } -func (m *ACLChange_ACLContentValue_UserConfirm) Size() (n int) { +func (m *ACLContentValue_UserConfirm) Size() (n int) { if m == nil { return 0 } @@ -2111,16 +2528,12 @@ func (m *ACLChange_ACLContentValue_UserConfirm) Size() (n int) { } return n } -func (m *ACLChange_ACLData) 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() @@ -2130,20 +2543,7 @@ func (m *ACLChange_ACLData) Size() (n int) { return n } -func (m *ACLChange_ACLSnapshot) 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 *ACLChange_ACLState) Size() (n int) { +func (m *ACLState) Size() (n int) { if m == nil { return 0 } @@ -2178,7 +2578,7 @@ func (m *ACLChange_ACLState) Size() (n int) { return n } -func (m *ACLChange_UserState) Size() (n int) { +func (m *ACLUserState) Size() (n int) { if m == nil { return 0 } @@ -2207,7 +2607,7 @@ func (m *ACLChange_UserState) Size() (n int) { return n } -func (m *ACLChange_UserAdd) Size() (n int) { +func (m *ACLUserAdd) Size() (n int) { if m == nil { return 0 } @@ -2233,7 +2633,7 @@ func (m *ACLChange_UserAdd) Size() (n int) { return n } -func (m *ACLChange_UserConfirm) Size() (n int) { +func (m *ACLUserConfirm) Size() (n int) { if m == nil { return 0 } @@ -2250,7 +2650,7 @@ func (m *ACLChange_UserConfirm) Size() (n int) { return n } -func (m *ACLChange_UserInvite) Size() (n int) { +func (m *ACLUserInvite) Size() (n int) { if m == nil { return 0 } @@ -2280,7 +2680,7 @@ func (m *ACLChange_UserInvite) Size() (n int) { return n } -func (m *ACLChange_UserJoin) Size() (n int) { +func (m *ACLUserJoin) Size() (n int) { if m == nil { return 0 } @@ -2311,7 +2711,7 @@ func (m *ACLChange_UserJoin) Size() (n int) { return n } -func (m *ACLChange_UserRemove) Size() (n int) { +func (m *ACLUserRemove) Size() (n int) { if m == nil { return 0 } @@ -2330,7 +2730,7 @@ func (m *ACLChange_UserRemove) Size() (n int) { return n } -func (m *ACLChange_ReadKeyReplace) Size() (n int) { +func (m *ACLReadKeyReplace) Size() (n int) { if m == nil { return 0 } @@ -2351,7 +2751,7 @@ func (m *ACLChange_ReadKeyReplace) Size() (n int) { return n } -func (m *ACLChange_UserPermissionChange) Size() (n int) { +func (m *ACLUserPermissionChange) Size() (n int) { if m == nil { return 0 } @@ -2367,13 +2767,159 @@ func (m *ACLChange_UserPermissionChange) Size() (n int) { return n } +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 + } + var l int + _ = l + if len(m.TreeHeadIds) > 0 { + for _, s := range m.TreeHeadIds { + l = len(s) + n += 1 + l + sovAclchanges(uint64(l)) + } + } + l = len(m.AclHeadId) + if l > 0 { + n += 1 + l + sovAclchanges(uint64(l)) + } + l = len(m.SnapshotBaseId) + if l > 0 { + 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)) + } + if m.IsSnapshot { + n += 2 + } + return n +} + +func (m *TreeHeader) 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.AclId) + if l > 0 { + n += 1 + l + sovAclchanges(uint64(l)) + } + if m.TreeHeaderType != 0 { + n += 1 + sovAclchanges(uint64(m.TreeHeaderType)) + } + 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)) + } + return n +} + func sovAclchanges(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } 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 { @@ -2396,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: @@ -2523,293 +3069,7 @@ func (m *RawChange) Unmarshal(dAtA []byte) error { } 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 = &ACLChange_ACLData{} - } - 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 *ACLChange_ACLContentValue) Unmarshal(dAtA []byte) error { +func (m *ACLContentValue) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2867,11 +3127,11 @@ func (m *ACLChange_ACLContentValue) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &ACLChange_UserAdd{} + v := &ACLUserAdd{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Value = &ACLChange_ACLContentValue_UserAdd{v} + m.Value = &ACLContentValue_UserAdd{v} iNdEx = postIndex case 2: if wireType != 2 { @@ -2902,11 +3162,11 @@ func (m *ACLChange_ACLContentValue) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &ACLChange_UserRemove{} + v := &ACLUserRemove{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Value = &ACLChange_ACLContentValue_UserRemove{v} + m.Value = &ACLContentValue_UserRemove{v} iNdEx = postIndex case 3: if wireType != 2 { @@ -2937,11 +3197,11 @@ func (m *ACLChange_ACLContentValue) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &ACLChange_UserPermissionChange{} + v := &ACLUserPermissionChange{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Value = &ACLChange_ACLContentValue_UserPermissionChange{v} + m.Value = &ACLContentValue_UserPermissionChange{v} iNdEx = postIndex case 4: if wireType != 2 { @@ -2972,11 +3232,11 @@ func (m *ACLChange_ACLContentValue) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &ACLChange_UserInvite{} + v := &ACLUserInvite{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Value = &ACLChange_ACLContentValue_UserInvite{v} + m.Value = &ACLContentValue_UserInvite{v} iNdEx = postIndex case 5: if wireType != 2 { @@ -3007,11 +3267,11 @@ func (m *ACLChange_ACLContentValue) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &ACLChange_UserJoin{} + v := &ACLUserJoin{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Value = &ACLChange_ACLContentValue_UserJoin{v} + m.Value = &ACLContentValue_UserJoin{v} iNdEx = postIndex case 6: if wireType != 2 { @@ -3042,11 +3302,11 @@ func (m *ACLChange_ACLContentValue) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &ACLChange_UserConfirm{} + v := &ACLUserConfirm{} if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Value = &ACLChange_ACLContentValue_UserConfirm{v} + m.Value = &ACLContentValue_UserConfirm{v} iNdEx = postIndex default: iNdEx = preIndex @@ -3069,7 +3329,7 @@ func (m *ACLChange_ACLContentValue) Unmarshal(dAtA []byte) error { } return nil } -func (m *ACLChange_ACLData) Unmarshal(dAtA []byte) error { +func (m *ACLData) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3099,42 +3359,6 @@ func (m *ACLChange_ACLData) 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 = &ACLChange_ACLSnapshot{} - } - 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) } @@ -3163,7 +3387,7 @@ func (m *ACLChange_ACLData) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.AclContent = append(m.AclContent, &ACLChange_ACLContentValue{}) + m.AclContent = append(m.AclContent, &ACLContentValue{}) if err := m.AclContent[len(m.AclContent)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -3189,93 +3413,7 @@ func (m *ACLChange_ACLData) Unmarshal(dAtA []byte) error { } return nil } -func (m *ACLChange_ACLSnapshot) 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 = &ACLChange_ACLState{} - } - 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 *ACLChange_ACLState) Unmarshal(dAtA []byte) error { +func (m *ACLState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3409,7 +3547,7 @@ func (m *ACLChange_ACLState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.UserStates = append(m.UserStates, &ACLChange_UserState{}) + m.UserStates = append(m.UserStates, &ACLUserState{}) if err := m.UserStates[len(m.UserStates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -3444,10 +3582,10 @@ func (m *ACLChange_ACLState) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Invites == nil { - m.Invites = make(map[string]*ACLChange_UserInvite) + m.Invites = make(map[string]*ACLUserInvite) } var mapkey string - var mapvalue *ACLChange_UserInvite + var mapvalue *ACLUserInvite for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 @@ -3521,7 +3659,7 @@ func (m *ACLChange_ACLState) Unmarshal(dAtA []byte) error { if postmsgIndex > l { return io.ErrUnexpectedEOF } - mapvalue = &ACLChange_UserInvite{} + mapvalue = &ACLUserInvite{} if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { return err } @@ -3564,7 +3702,7 @@ func (m *ACLChange_ACLState) Unmarshal(dAtA []byte) error { } return nil } -func (m *ACLChange_UserState) Unmarshal(dAtA []byte) error { +func (m *ACLUserState) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3587,17 +3725,17 @@ func (m *ACLChange_UserState) 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 @@ -3607,23 +3745,25 @@ func (m *ACLChange_UserState) 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 { @@ -3705,7 +3845,7 @@ func (m *ACLChange_UserState) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Permissions |= ACLChange_UserPermissions(b&0x7F) << shift + m.Permissions |= ACLUserPermissions(b&0x7F) << shift if b < 0x80 { break } @@ -3751,7 +3891,7 @@ func (m *ACLChange_UserState) Unmarshal(dAtA []byte) error { } return nil } -func (m *ACLChange_UserAdd) Unmarshal(dAtA []byte) error { +func (m *ACLUserAdd) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3774,17 +3914,17 @@ func (m *ACLChange_UserAdd) 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 @@ -3794,23 +3934,25 @@ func (m *ACLChange_UserAdd) 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 { @@ -3892,7 +4034,7 @@ func (m *ACLChange_UserAdd) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Permissions |= ACLChange_UserPermissions(b&0x7F) << shift + m.Permissions |= ACLUserPermissions(b&0x7F) << shift if b < 0x80 { break } @@ -3918,7 +4060,7 @@ func (m *ACLChange_UserAdd) Unmarshal(dAtA []byte) error { } return nil } -func (m *ACLChange_UserConfirm) Unmarshal(dAtA []byte) error { +func (m *ACLUserConfirm) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3941,17 +4083,17 @@ func (m *ACLChange_UserConfirm) 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 @@ -3961,23 +4103,25 @@ func (m *ACLChange_UserConfirm) 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 { @@ -4032,7 +4176,7 @@ func (m *ACLChange_UserConfirm) Unmarshal(dAtA []byte) error { } return nil } -func (m *ACLChange_UserInvite) Unmarshal(dAtA []byte) error { +func (m *ACLUserInvite) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4055,10 +4199,10 @@ func (m *ACLChange_UserInvite) 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: @@ -4175,7 +4319,7 @@ func (m *ACLChange_UserInvite) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Permissions |= ACLChange_UserPermissions(b&0x7F) << shift + m.Permissions |= ACLUserPermissions(b&0x7F) << shift if b < 0x80 { break } @@ -4233,7 +4377,7 @@ func (m *ACLChange_UserInvite) Unmarshal(dAtA []byte) error { } return nil } -func (m *ACLChange_UserJoin) Unmarshal(dAtA []byte) error { +func (m *ACLUserJoin) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4256,17 +4400,17 @@ func (m *ACLChange_UserJoin) 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 @@ -4276,23 +4420,25 @@ func (m *ACLChange_UserJoin) 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 { @@ -4447,7 +4593,7 @@ func (m *ACLChange_UserJoin) Unmarshal(dAtA []byte) error { } return nil } -func (m *ACLChange_UserRemove) Unmarshal(dAtA []byte) error { +func (m *ACLUserRemove) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4470,17 +4616,17 @@ func (m *ACLChange_UserRemove) 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 @@ -4490,23 +4636,25 @@ func (m *ACLChange_UserRemove) 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 { @@ -4537,7 +4685,7 @@ func (m *ACLChange_UserRemove) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ReadKeyReplaces = append(m.ReadKeyReplaces, &ACLChange_ReadKeyReplace{}) + m.ReadKeyReplaces = append(m.ReadKeyReplaces, &ACLReadKeyReplace{}) if err := m.ReadKeyReplaces[len(m.ReadKeyReplaces)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -4563,7 +4711,7 @@ func (m *ACLChange_UserRemove) Unmarshal(dAtA []byte) error { } return nil } -func (m *ACLChange_ReadKeyReplace) Unmarshal(dAtA []byte) error { +func (m *ACLReadKeyReplace) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4586,17 +4734,17 @@ func (m *ACLChange_ReadKeyReplace) 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 @@ -4606,23 +4754,25 @@ func (m *ACLChange_ReadKeyReplace) 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 { @@ -4713,7 +4863,7 @@ func (m *ACLChange_ReadKeyReplace) Unmarshal(dAtA []byte) error { } return nil } -func (m *ACLChange_UserPermissionChange) Unmarshal(dAtA []byte) error { +func (m *ACLUserPermissionChange) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4736,16 +4886,119 @@ func (m *ACLChange_UserPermissionChange) 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 { @@ -4772,13 +5025,13 @@ func (m *ACLChange_UserPermissionChange) 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 @@ -4788,11 +5041,921 @@ func (m *ACLChange_UserPermissionChange) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Permissions |= ACLChange_UserPermissions(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 + } + } + 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 *ACLHeader) 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: ACLHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + 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: + 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 AclHeadId", 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.AclHeadId = 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 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 5: + 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 6: + 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 7: + 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 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsSnapshot", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAclchanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsSnapshot = bool(v != 0) + 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 *TreeHeader) 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: TreeHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TreeHeader: 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 AclId", 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.AclId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TreeHeaderType", wireType) + } + m.TreeHeaderType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAclchanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TreeHeaderType |= TreeHeaderType(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 + 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 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 + } + 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 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 d28d59b2..d7a849fb 100644 --- a/pkg/acl/list/aclstate.go +++ b/pkg/acl/list/aclstate.go @@ -1,135 +1,190 @@ -package acltree +package list import ( "bytes" "errors" "fmt" + "github.com/anytypeio/go-anytype-infrastructure-experiments/app/logger" "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/keys" "github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys/asymmetric/encryptionkey" "github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys/asymmetric/signingkey" "github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys/symmetric" + "github.com/gogo/protobuf/proto" + "go.uber.org/zap" "hash/fnv" ) +var log = logger.NewNamed("acllist").Sugar() + var ErrNoSuchUser = errors.New("no such user") var ErrFailedToDecrypt = errors.New("failed to decrypt key") var ErrUserRemoved = errors.New("user was removed from the document") var ErrDocumentForbidden = errors.New("your user was forbidden access to the document") var ErrUserAlreadyExists = errors.New("user already exists") +var ErrNoSuchRecord = errors.New("no such record") +var ErrInsufficientPermissions = errors.New("insufficient permissions") +var ErrNoReadKey = errors.New("acl state doesn't have a read key") +var ErrInvalidSignature = errors.New("signature is invalid") -type ACLState struct { - currentReadKeyHash uint64 - userReadKeys map[uint64]*symmetric.Key - userStates map[string]*aclpb.ACLChange_UserState - userInvites map[string]*aclpb.ACLChange_UserInvite - signingPubKeyDecoder signingkey.PubKeyDecoder - encryptionKey encryptionkey.PrivKey - identity string +type UserPermissionPair struct { + Identity string + Permission aclpb.ACLUserPermissions } -func newACLState( +type ACLState struct { + currentReadKeyHash uint64 + userReadKeys map[uint64]*symmetric.Key + userStates map[string]*aclpb.ACLUserState + userInvites map[string]*aclpb.ACLUserInvite + + signingPubKeyDecoder keys.Decoder + encryptionKey encryptionkey.PrivKey + + identity string + permissionsAtRecord map[string][]UserPermissionPair + + keychain *common.Keychain +} + +func newACLStateWithIdentity( identity string, encryptionKey encryptionkey.PrivKey, - signingPubKeyDecoder signingkey.PubKeyDecoder) *ACLState { + decoder keys.Decoder) *ACLState { return &ACLState{ identity: identity, encryptionKey: encryptionKey, userReadKeys: make(map[uint64]*symmetric.Key), - userStates: make(map[string]*aclpb.ACLChange_UserState), - userInvites: make(map[string]*aclpb.ACLChange_UserInvite), - signingPubKeyDecoder: signingPubKeyDecoder, + userStates: make(map[string]*aclpb.ACLUserState), + userInvites: make(map[string]*aclpb.ACLUserInvite), + signingPubKeyDecoder: decoder, + permissionsAtRecord: make(map[string][]UserPermissionPair), + keychain: common.NewKeychain(), } } -func newACLStateFromSnapshotChange( - snapshotChange *aclpb.ACLChange, - identity string, - encryptionKey encryptionkey.PrivKey, - signingPubKeyDecoder signingkey.PubKeyDecoder) (*ACLState, error) { - st := &ACLState{ - identity: identity, - encryptionKey: encryptionKey, +func newACLState(decoder keys.Decoder) *ACLState { + return &ACLState{ + signingPubKeyDecoder: decoder, userReadKeys: make(map[uint64]*symmetric.Key), - userStates: make(map[string]*aclpb.ACLChange_UserState), - userInvites: make(map[string]*aclpb.ACLChange_UserInvite), - signingPubKeyDecoder: signingPubKeyDecoder, + userStates: make(map[string]*aclpb.ACLUserState), + userInvites: make(map[string]*aclpb.ACLUserInvite), + permissionsAtRecord: make(map[string][]UserPermissionPair), + keychain: common.NewKeychain(), } - err := st.recreateFromSnapshotChange(snapshotChange) - if err != nil { - return nil, err - } - return st, nil } -func (st *ACLState) recreateFromSnapshotChange(snapshotChange *aclpb.ACLChange) error { - snapshot := snapshotChange.GetAclData().GetAclSnapshot() - if snapshot == nil { - return fmt.Errorf("could not create state from snapshot, because it is nil") - } - state := snapshot.AclState - for _, userState := range state.UserStates { - st.userStates[userState.Identity] = userState - } +func (st *ACLState) CurrentReadKeyHash() uint64 { + return st.currentReadKeyHash +} - userState, exists := st.userStates[st.identity] +func (st *ACLState) CurrentReadKey() (*symmetric.Key, error) { + key, exists := st.userReadKeys[st.currentReadKeyHash] if !exists { - return ErrNoSuchUser + return nil, ErrNoReadKey } - for _, key := range userState.EncryptedReadKeys { - key, hash, err := st.decryptReadKeyAndHash(key) - if err != nil { - return ErrFailedToDecrypt - } + return key, nil +} - st.userReadKeys[hash] = key +func (st *ACLState) UserReadKeys() map[uint64]*symmetric.Key { + return st.userReadKeys +} + +func (st *ACLState) PermissionsAtRecord(id string, identity string) (UserPermissionPair, error) { + permissions, ok := st.permissionsAtRecord[id] + if !ok { + log.Errorf("missing record at id %s", id) + return UserPermissionPair{}, ErrNoSuchRecord } - st.currentReadKeyHash = snapshotChange.CurrentReadKeyHash - if snapshot.GetAclState().GetInvites() != nil { - st.userInvites = snapshot.GetAclState().GetInvites() + + for _, perm := range permissions { + if perm.Identity == identity { + return perm, nil + } } + return UserPermissionPair{}, ErrNoSuchUser +} + +func (st *ACLState) applyRecord(record *aclpb.ACLRecord) (err error) { + aclData := &aclpb.ACLData{} + + err = proto.Unmarshal(record.Data, aclData) + if err != nil { + return + } + + err = st.applyChangeData(aclData, record.CurrentReadKeyHash, record.Identity) + if err != nil { + return + } + + st.currentReadKeyHash = record.CurrentReadKeyHash + return +} + +func (st *ACLState) applyChangeAndUpdate(recordWrapper *ACLRecord) (err error) { + var ( + change = recordWrapper.Content + aclData = &aclpb.ACLData{} + ) + + if recordWrapper.Model != nil { + aclData = recordWrapper.Model.(*aclpb.ACLData) + } else { + err = proto.Unmarshal(change.Data, aclData) + if err != nil { + return + } + recordWrapper.Model = aclData + } + + err = st.applyChangeData(aclData, recordWrapper.Content.CurrentReadKeyHash, recordWrapper.Content.Identity) + if err != nil { + return + } + + // getting all permissions for users at record + var permissions []UserPermissionPair + for _, state := range st.userStates { + permission := UserPermissionPair{ + Identity: string(state.Identity), + Permission: state.Permissions, + } + permissions = append(permissions, permission) + } + + st.permissionsAtRecord[recordWrapper.Id] = permissions return nil } -func (st *ACLState) makeSnapshot() *aclpb.ACLChange_ACLSnapshot { - var userStates []*aclpb.ACLChange_UserState - for _, st := range st.userStates { - userStates = append(userStates, st) - } - - return &aclpb.ACLChange_ACLSnapshot{AclState: &aclpb.ACLChange_ACLState{ - ReadKeyHashes: nil, - UserStates: userStates, // TODO: make states and invites in same format - Invites: st.userInvites, - }} -} - -func (st *ACLState) applyChange(change *aclpb.ACLChange) (err error) { +func (st *ACLState) applyChangeData(changeData *aclpb.ACLData, hash uint64, identity []byte) (err error) { defer func() { if err != nil { return } - st.currentReadKeyHash = change.CurrentReadKeyHash + st.currentReadKeyHash = hash }() // we can't check this for the user which is joining, because it will not be in our list // the same is for the first change to be added - skipIdentityCheck := st.isUserJoin(change) || (st.currentReadKeyHash == 0 && st.isUserAdd(change)) + 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[change.Identity]; !exists { + if _, exists := st.userStates[string(identity)]; !exists { err = ErrNoSuchUser return } - if !st.hasPermission(change.Identity, aclpb.ACLChange_Admin) { - err = fmt.Errorf("user %s must have admin permissions", change.Identity) + if !st.hasPermission(identity, aclpb.ACLUserPermissions_Admin) { + err = fmt.Errorf("user %s must have admin permissions", identity) return } } - for _, ch := range change.GetAclData().GetAclContent() { + for _, ch := range changeData.GetAclContent() { if err = st.applyChangeContent(ch); err != nil { - //log.Infof("error while applying changes: %v; ignore", err) + log.Info("error while applying changes: %v; ignore", zap.Error(err)) return err } } @@ -137,8 +192,7 @@ func (st *ACLState) applyChange(change *aclpb.ACLChange) (err error) { return nil } -// TODO: remove changeId, because it is not needed -func (st *ACLState) applyChangeContent(ch *aclpb.ACLChange_ACLContentValue) error { +func (st *ACLState) applyChangeContent(ch *aclpb.ACLContentValue) error { switch { case ch.GetUserPermissionChange() != nil: return st.applyUserPermissionChange(ch.GetUserPermissionChange()) @@ -157,27 +211,29 @@ func (st *ACLState) applyChangeContent(ch *aclpb.ACLChange_ACLContentValue) erro } } -func (st *ACLState) applyUserPermissionChange(ch *aclpb.ACLChange_UserPermissionChange) 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.ACLChange_UserInvite) error { +func (st *ACLState) applyUserInvite(ch *aclpb.ACLUserInvite) error { st.userInvites[ch.InviteId] = ch return nil } -func (st *ACLState) applyUserJoin(ch *aclpb.ACLChange_UserJoin) 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 } @@ -188,21 +244,16 @@ func (st *ACLState) applyUserJoin(ch *aclpb.ACLChange_UserJoin) 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.Verify(rawSignedId, signature) + res, err := verificationKey.(signingkey.PubKey).Verify(ch.Identity, signature) if err != nil { return fmt.Errorf("verification returned error: %w", err) } if !res { - return fmt.Errorf("signature is invalid") + return ErrInvalidSignature } // 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 { @@ -214,30 +265,31 @@ func (st *ACLState) applyUserJoin(ch *aclpb.ACLChange_UserJoin) error { } // adding user to the list - userState := &aclpb.ACLChange_UserState{ + 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.ACLChange_UserAdd) 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.ACLChange_UserState{ + 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 { @@ -251,26 +303,28 @@ func (st *ACLState) applyUserAdd(ch *aclpb.ACLChange_UserAdd) error { return nil } -func (st *ACLState) applyUserRemove(ch *aclpb.ACLChange_UserRemove) 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 @@ -283,12 +337,13 @@ func (st *ACLState) applyUserRemove(ch *aclpb.ACLChange_UserRemove) error { return nil } -func (st *ACLState) applyUserConfirm(ch *aclpb.ACLChange_UserConfirm) 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 } @@ -309,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.ACLChange_UserPermissions) 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 } @@ -318,94 +373,17 @@ func (st *ACLState) hasPermission(identity string, permission aclpb.ACLChange_Us return state.Permissions == permission } -func (st *ACLState) isUserJoin(ch *aclpb.ACLChange) bool { +func (st *ACLState) isUserJoin(data *aclpb.ACLData) bool { // if we have a UserJoin, then it should always be the first one applied - return ch.AclData.GetAclContent() != nil && ch.AclData.GetAclContent()[0].GetUserJoin() != nil + return data.GetAclContent() != nil && data.GetAclContent()[0].GetUserJoin() != nil } -func (st *ACLState) isUserAdd(ch *aclpb.ACLChange) 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 := ch.AclData.GetAclContent()[0].GetUserAdd() - return ch.AclData.GetAclContent() != nil && userAdd != nil && userAdd.GetIdentity() == ch.Identity + userAdd := data.GetAclContent()[0].GetUserAdd() + return data.GetAclContent() != nil && userAdd != nil && bytes.Compare(userAdd.GetIdentity(), identity) == 0 } -func (st *ACLState) getPermissionDecreasedUsers(ch *aclpb.ACLChange) (identities []*aclpb.ACLChange_UserPermissionChange) { - // this should be called after general checks are completed - if ch.GetAclData().GetAclContent() == nil { - return nil - } - - contents := ch.GetAclData().GetAclContent() - for _, c := range contents { - if c.GetUserPermissionChange() != nil { - content := c.GetUserPermissionChange() - - currentState := st.userStates[content.Identity] - // the comparison works in different direction :-) - if content.Permissions > currentState.Permissions { - identities = append(identities, &aclpb.ACLChange_UserPermissionChange{ - Identity: content.Identity, - Permissions: content.Permissions, - }) - } - } - if c.GetUserRemove() != nil { - content := c.GetUserRemove() - identities = append(identities, &aclpb.ACLChange_UserPermissionChange{ - Identity: content.Identity, - Permissions: aclpb.ACLChange_Removed, - }) - } - } - - return identities -} - -func (st *ACLState) equal(other *ACLState) bool { - if st == nil && other == nil { - return true - } - - if st == nil || other == nil { - return false - } - - if st.currentReadKeyHash != other.currentReadKeyHash { - return false - } - - if st.identity != other.identity { - return false - } - - if len(st.userStates) != len(other.userStates) { - return false - } - - for _, st := range st.userStates { - otherSt, exists := other.userStates[st.Identity] - if !exists { - return false - } - - if st.Permissions != otherSt.Permissions { - return false - } - - if bytes.Compare(st.EncryptionKey, otherSt.EncryptionKey) != 0 { - return false - } - } - - if len(st.userInvites) != len(other.userInvites) { - return false - } - - // TODO: add detailed user invites comparison + compare other stuff - return true -} - -func (st *ACLState) GetUserStates() map[string]*aclpb.ACLChange_UserState { - // TODO: we should provide better API that would not allow to change this map from the outside +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 5bfb145f..c6413cb0 100644 --- a/pkg/acl/list/changebuilder.go +++ b/pkg/acl/list/changebuilder.go @@ -1,4 +1,4 @@ -package acltree +package list import ( "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/account" @@ -14,39 +14,31 @@ import ( type MarshalledChange = []byte type ACLChangeBuilder interface { - UserAdd(identity string, encryptionKey encryptionkey.PubKey, permissions aclpb.ACLChange_UserPermissions) error - AddId(id string) // TODO: this is only for testing - SetMakeSnapshot(bool) // TODO: who should decide this? probably ACLTree so we can delete it + UserAdd(identity string, encryptionKey encryptionkey.PubKey, permissions aclpb.ACLUserPermissions) error + AddId(id string) // TODO: this is only for testing } -type ChangeBuilder interface { - ACLChangeBuilder - AddChangeContent(marshaler proto.Marshaler) // user code should be responsible for making regular snapshots -} - -type changeBuilder struct { +type aclChangeBuilder struct { aclState *ACLState - tree *Tree + list ACLList acc *account.AccountData - aclData *aclpb.ACLChange_ACLData - changeContent proto.Marshaler - id string - makeSnapshot bool - readKey *symmetric.Key - readKeyHash uint64 + aclData *aclpb.ACLData + id string + readKey *symmetric.Key + readKeyHash uint64 } -func newChangeBuilder() *changeBuilder { - return &changeBuilder{} +func newACLChangeBuilder() *aclChangeBuilder { + return &aclChangeBuilder{} } -func (c *changeBuilder) Init(state *ACLState, tree *Tree, acc *account.AccountData) { +func (c *aclChangeBuilder) Init(state *ACLState, list ACLList, acc *account.AccountData) { c.aclState = state - c.tree = tree + c.list = list c.acc = acc - c.aclData = &aclpb.ACLChange_ACLData{} + c.aclData = &aclpb.ACLData{} // setting read key for further encryption etc if state.currentReadKeyHash == 0 { c.readKey, _ = symmetric.NewRandom() @@ -60,15 +52,11 @@ func (c *changeBuilder) Init(state *ACLState, tree *Tree, acc *account.AccountDa } } -func (c *changeBuilder) AddId(id string) { +func (c *aclChangeBuilder) AddId(id string) { c.id = id } -func (c *changeBuilder) SetMakeSnapshot(b bool) { - c.makeSnapshot = b -} - -func (c *changeBuilder) UserAdd(identity string, encryptionKey encryptionkey.PubKey, permissions aclpb.ACLChange_UserPermissions) 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 { @@ -91,10 +79,10 @@ func (c *changeBuilder) UserAdd(identity string, encryptionKey encryptionkey.Pub if err != nil { return err } - ch := &aclpb.ACLChange_ACLContentValue{ - Value: &aclpb.ACLChange_ACLContent_Value_UserAdd{ - UserAdd: &aclpb.ACLChange_UserAdd{ - Identity: identity, + ch := &aclpb.ACLContentValue{ + Value: &aclpb.ACLContentValue_UserAdd{ + UserAdd: &aclpb.ACLUserAdd{ + Identity: []byte(identity), EncryptionKey: rawKey, EncryptedReadKeys: encryptedKeys, Permissions: permissions, @@ -105,41 +93,25 @@ func (c *changeBuilder) UserAdd(identity string, encryptionKey encryptionkey.Pub return nil } -func (c *changeBuilder) BuildAndApply() (*Change, []byte, error) { - aclChange := &aclpb.ACLChange{ - TreeHeadIds: c.tree.Heads(), - AclHeadIds: c.tree.ACLHeads(), - SnapshotBaseId: c.tree.RootId(), - AclData: c.aclData, +func (c *aclChangeBuilder) BuildAndApply() (*ACLRecord, []byte, error) { + aclRecord := &aclpb.ACLRecord{ + PrevId: c.list.Head().Id, CurrentReadKeyHash: c.readKeyHash, Timestamp: int64(time.Now().Nanosecond()), Identity: c.acc.Identity, } - err := c.aclState.applyChange(aclChange) + + marshalledData, err := proto.Marshal(c.aclData) + if err != nil { + return nil, nil, err + } + aclRecord.Data = marshalledData + err = c.aclState.applyRecord(aclRecord) if err != nil { return nil, nil, err } - if c.makeSnapshot { - c.aclData.AclSnapshot = c.aclState.makeSnapshot() - } - - var marshalled []byte - if c.changeContent != nil { - marshalled, err = c.changeContent.Marshal() - if err != nil { - return nil, nil, err - } - - encrypted, err := c.aclState.userReadKeys[c.aclState.currentReadKeyHash]. - Encrypt(marshalled) - if err != nil { - return nil, nil, err - } - aclChange.ChangesData = encrypted - } - - fullMarshalledChange, err := proto.Marshal(aclChange) + fullMarshalledChange, err := proto.Marshal(aclRecord) if err != nil { return nil, nil, err } @@ -151,13 +123,9 @@ func (c *changeBuilder) BuildAndApply() (*Change, []byte, error) { if err != nil { return nil, nil, err } - ch := NewChange(id, aclChange) - ch.DecryptedDocumentChange = marshalled + ch := NewRecord(id, aclRecord) + ch.Model = c.aclData ch.Sign = signature return ch, fullMarshalledChange, nil } - -func (c *changeBuilder) AddChangeContent(marshaler proto.Marshaler) { - c.changeContent = marshaler -} 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 cfec475b..e8e43c54 100644 --- a/pkg/acl/testutils/testchanges/proto/test.pb.go +++ b/pkg/acl/testutils/testchanges/proto/test.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: pkg/acl/testutils/testchanges/testchangepb/protos/testdocumentchanges.proto +// source: pkg/acl/testutils/testchanges/proto/test.proto -package testchangepb +package testchanges import ( fmt "fmt" @@ -29,7 +29,7 @@ func (m *PlainTextChange) Reset() { *m = PlainTextChange{} } func (m *PlainTextChange) String() string { return proto.CompactTextString(m) } func (*PlainTextChange) ProtoMessage() {} func (*PlainTextChange) Descriptor() ([]byte, []int) { - return fileDescriptor_c07268f9f08f2beb, []int{0} + return fileDescriptor_37f33c266ada4318, []int{0} } func (m *PlainTextChange) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -60,7 +60,6 @@ var xxx_messageInfo_PlainTextChange proto.InternalMessageInfo type PlainTextChange_Content struct { // Types that are valid to be assigned to Value: - // // *PlainTextChange_Content_TextAppend Value isPlainTextChange_Content_Value `protobuf_oneof:"value"` } @@ -69,7 +68,7 @@ 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_c07268f9f08f2beb, []int{0, 0} + return fileDescriptor_37f33c266ada4318, []int{0, 0} } func (m *PlainTextChange_Content) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -139,7 +138,7 @@ func (m *PlainTextChange_TextAppend) Reset() { *m = PlainTextChange_Text func (m *PlainTextChange_TextAppend) String() string { return proto.CompactTextString(m) } func (*PlainTextChange_TextAppend) ProtoMessage() {} func (*PlainTextChange_TextAppend) Descriptor() ([]byte, []int) { - return fileDescriptor_c07268f9f08f2beb, []int{0, 1} + return fileDescriptor_37f33c266ada4318, []int{0, 1} } func (m *PlainTextChange_TextAppend) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -183,7 +182,7 @@ func (m *PlainTextChange_Snapshot) Reset() { *m = PlainTextChange_Snapsh func (m *PlainTextChange_Snapshot) String() string { return proto.CompactTextString(m) } func (*PlainTextChange_Snapshot) ProtoMessage() {} func (*PlainTextChange_Snapshot) Descriptor() ([]byte, []int) { - return fileDescriptor_c07268f9f08f2beb, []int{0, 2} + return fileDescriptor_37f33c266ada4318, []int{0, 2} } func (m *PlainTextChange_Snapshot) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -228,7 +227,7 @@ 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_c07268f9f08f2beb, []int{0, 3} + return fileDescriptor_37f33c266ada4318, []int{0, 3} } func (m *PlainTextChange_Data) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -280,29 +279,28 @@ func init() { } func init() { - proto.RegisterFile("pkg/acl/testutils/testchanges/testchangepb/protos/testdocumentchanges.proto", fileDescriptor_c07268f9f08f2beb) + proto.RegisterFile("pkg/acl/testutils/testchanges/proto/test.proto", fileDescriptor_37f33c266ada4318) } -var fileDescriptor_c07268f9f08f2beb = []byte{ - // 278 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xf2, 0x2e, 0xc8, 0x4e, 0xd7, +var fileDescriptor_37f33c266ada4318 = []byte{ + // 266 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x2b, 0xc8, 0x4e, 0xd7, 0x4f, 0x4c, 0xce, 0xd1, 0x2f, 0x49, 0x2d, 0x2e, 0x29, 0x2d, 0xc9, 0xcc, 0x29, 0x06, 0xb3, 0x92, - 0x33, 0x12, 0xf3, 0xd2, 0x53, 0x91, 0xd9, 0x05, 0x49, 0xfa, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x10, - 0xb1, 0x94, 0xfc, 0xe4, 0xd2, 0xdc, 0xd4, 0x3c, 0x98, 0x3a, 0x3d, 0xb0, 0x94, 0x10, 0x7b, 0x62, - 0x5e, 0x65, 0x49, 0x65, 0x41, 0xaa, 0xd2, 0x26, 0x26, 0x2e, 0xfe, 0x80, 0x9c, 0xc4, 0xcc, 0xbc, - 0x90, 0xd4, 0x8a, 0x12, 0x67, 0xb0, 0x1a, 0xa9, 0x48, 0x2e, 0x76, 0xe7, 0xfc, 0xbc, 0x92, 0xd4, - 0xbc, 0x12, 0x21, 0x57, 0x2e, 0xae, 0x92, 0xd4, 0x8a, 0x12, 0xc7, 0x82, 0x82, 0xd4, 0xbc, 0x14, - 0x09, 0x46, 0x05, 0x46, 0x0d, 0x6e, 0x23, 0x65, 0x3d, 0xa8, 0x66, 0x3d, 0x34, 0x8d, 0x7a, 0x21, - 0x70, 0xa5, 0x1e, 0x0c, 0x41, 0x48, 0x1a, 0x9d, 0xd8, 0xb9, 0x58, 0xcb, 0x12, 0x73, 0x4a, 0x53, - 0xa5, 0x14, 0xb8, 0xb8, 0x10, 0x8a, 0x84, 0x84, 0xb8, 0x58, 0x40, 0x8a, 0xc0, 0xe6, 0x72, 0x06, - 0x81, 0xd9, 0x52, 0x72, 0x5c, 0x1c, 0xc1, 0x79, 0x89, 0x05, 0xc5, 0x19, 0xf9, 0x25, 0x58, 0xe5, - 0x1b, 0x19, 0xb9, 0x58, 0x5c, 0x12, 0x4b, 0x12, 0x85, 0xac, 0xb8, 0xd8, 0x93, 0x21, 0xae, 0x94, - 0x60, 0x54, 0x60, 0xd6, 0xe0, 0x36, 0x52, 0xc0, 0xe9, 0x2e, 0xa8, 0x6f, 0x82, 0x60, 0x1a, 0x84, - 0x6c, 0xb9, 0x38, 0x8a, 0xa1, 0x96, 0x48, 0x30, 0x81, 0x3d, 0xa5, 0x88, 0x53, 0x33, 0xcc, 0x35, - 0x41, 0x70, 0x2d, 0x4e, 0x6a, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, - 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xc5, - 0x83, 0x1c, 0x0d, 0x49, 0x6c, 0xe0, 0xc0, 0x36, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xfd, 0x73, - 0xe1, 0xf2, 0xbb, 0x01, 0x00, 0x00, + 0x33, 0x12, 0xf3, 0xd2, 0x53, 0x8b, 0xf5, 0x0b, 0x8a, 0xf2, 0x4b, 0xf2, 0xc1, 0x22, 0x7a, 0x60, + 0xa6, 0x10, 0x7b, 0x62, 0x5e, 0x65, 0x49, 0x65, 0x41, 0xaa, 0xd2, 0x26, 0x26, 0x2e, 0xfe, 0x80, + 0x9c, 0xc4, 0xcc, 0xbc, 0x90, 0xd4, 0x8a, 0x12, 0x67, 0xb0, 0x72, 0xa9, 0x48, 0x2e, 0x76, 0xe7, + 0xfc, 0xbc, 0x92, 0xd4, 0xbc, 0x12, 0x21, 0x57, 0x2e, 0xae, 0x92, 0xd4, 0x8a, 0x12, 0xc7, 0x82, + 0x82, 0xd4, 0xbc, 0x14, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x6e, 0x23, 0x65, 0x3d, 0xa8, 0x66, 0x3d, + 0x34, 0x8d, 0x7a, 0x21, 0x70, 0xa5, 0x1e, 0x0c, 0x41, 0x48, 0x1a, 0x9d, 0xd8, 0xb9, 0x58, 0xcb, + 0x12, 0x73, 0x4a, 0x53, 0xa5, 0x14, 0xb8, 0xb8, 0x10, 0x8a, 0x84, 0x84, 0xb8, 0x58, 0x40, 0x8a, + 0xc0, 0xe6, 0x72, 0x06, 0x81, 0xd9, 0x52, 0x72, 0x5c, 0x1c, 0xc1, 0x79, 0x89, 0x05, 0xc5, 0x19, + 0xf9, 0x25, 0x58, 0xe5, 0x1b, 0x19, 0xb9, 0x58, 0x5c, 0x12, 0x4b, 0x12, 0x85, 0xac, 0xb8, 0xd8, + 0x93, 0x21, 0xae, 0x94, 0x60, 0x54, 0x60, 0xd6, 0xe0, 0x36, 0x52, 0xc0, 0xe9, 0x2e, 0xa8, 0x6f, + 0x82, 0x60, 0x1a, 0x84, 0x6c, 0xb9, 0x38, 0x8a, 0xa1, 0x96, 0x48, 0x30, 0x81, 0x3d, 0xa5, 0x88, + 0x53, 0x33, 0xcc, 0x35, 0x41, 0x70, 0x2d, 0x4e, 0xaa, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, + 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, + 0x2c, 0xc7, 0x10, 0xc5, 0x8d, 0x14, 0xea, 0x49, 0x6c, 0xe0, 0xb0, 0x36, 0x06, 0x04, 0x00, 0x00, + 0xff, 0xff, 0xf8, 0x8c, 0x6a, 0x1d, 0x9d, 0x01, 0x00, 0x00, } func (m *PlainTextChange) Marshal() (dAtA []byte, err error) { @@ -374,7 +372,7 @@ func (m *PlainTextChange_Content_TextAppend) MarshalToSizedBuffer(dAtA []byte) ( return 0, err } i -= size - i = encodeVarintTestdocumentchanges(dAtA, i, uint64(size)) + i = encodeVarintTest(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa @@ -404,7 +402,7 @@ func (m *PlainTextChange_TextAppend) MarshalToSizedBuffer(dAtA []byte) (int, err if len(m.Text) > 0 { i -= len(m.Text) copy(dAtA[i:], m.Text) - i = encodeVarintTestdocumentchanges(dAtA, i, uint64(len(m.Text))) + i = encodeVarintTest(dAtA, i, uint64(len(m.Text))) i-- dAtA[i] = 0xa } @@ -434,7 +432,7 @@ func (m *PlainTextChange_Snapshot) MarshalToSizedBuffer(dAtA []byte) (int, error if len(m.Text) > 0 { i -= len(m.Text) copy(dAtA[i:], m.Text) - i = encodeVarintTestdocumentchanges(dAtA, i, uint64(len(m.Text))) + i = encodeVarintTest(dAtA, i, uint64(len(m.Text))) i-- dAtA[i] = 0xa } @@ -468,7 +466,7 @@ func (m *PlainTextChange_Data) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintTestdocumentchanges(dAtA, i, uint64(size)) + i = encodeVarintTest(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 @@ -481,7 +479,7 @@ func (m *PlainTextChange_Data) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintTestdocumentchanges(dAtA, i, uint64(size)) + i = encodeVarintTest(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa @@ -490,8 +488,8 @@ func (m *PlainTextChange_Data) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func encodeVarintTestdocumentchanges(dAtA []byte, offset int, v uint64) int { - offset -= sovTestdocumentchanges(v) +func encodeVarintTest(dAtA []byte, offset int, v uint64) int { + offset -= sovTest(v) base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) @@ -530,7 +528,7 @@ func (m *PlainTextChange_Content_TextAppend) Size() (n int) { _ = l if m.TextAppend != nil { l = m.TextAppend.Size() - n += 1 + l + sovTestdocumentchanges(uint64(l)) + n += 1 + l + sovTest(uint64(l)) } return n } @@ -542,7 +540,7 @@ func (m *PlainTextChange_TextAppend) Size() (n int) { _ = l l = len(m.Text) if l > 0 { - n += 1 + l + sovTestdocumentchanges(uint64(l)) + n += 1 + l + sovTest(uint64(l)) } return n } @@ -555,7 +553,7 @@ func (m *PlainTextChange_Snapshot) Size() (n int) { _ = l l = len(m.Text) if l > 0 { - n += 1 + l + sovTestdocumentchanges(uint64(l)) + n += 1 + l + sovTest(uint64(l)) } return n } @@ -569,21 +567,21 @@ func (m *PlainTextChange_Data) Size() (n int) { if len(m.Content) > 0 { for _, e := range m.Content { l = e.Size() - n += 1 + l + sovTestdocumentchanges(uint64(l)) + n += 1 + l + sovTest(uint64(l)) } } if m.Snapshot != nil { l = m.Snapshot.Size() - n += 1 + l + sovTestdocumentchanges(uint64(l)) + n += 1 + l + sovTest(uint64(l)) } return n } -func sovTestdocumentchanges(x uint64) (n int) { +func sovTest(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } -func sozTestdocumentchanges(x uint64) (n int) { - return sovTestdocumentchanges(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +func sozTest(x uint64) (n int) { + return sovTest(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (m *PlainTextChange) Unmarshal(dAtA []byte) error { l := len(dAtA) @@ -593,7 +591,7 @@ func (m *PlainTextChange) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowTestdocumentchanges + return ErrIntOverflowTest } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -616,12 +614,12 @@ func (m *PlainTextChange) Unmarshal(dAtA []byte) error { switch fieldNum { default: iNdEx = preIndex - skippy, err := skipTestdocumentchanges(dAtA[iNdEx:]) + skippy, err := skipTest(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTestdocumentchanges + return ErrInvalidLengthTest } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -643,7 +641,7 @@ func (m *PlainTextChange_Content) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowTestdocumentchanges + return ErrIntOverflowTest } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -671,7 +669,7 @@ func (m *PlainTextChange_Content) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowTestdocumentchanges + return ErrIntOverflowTest } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -684,11 +682,11 @@ func (m *PlainTextChange_Content) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthTestdocumentchanges + return ErrInvalidLengthTest } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthTestdocumentchanges + return ErrInvalidLengthTest } if postIndex > l { return io.ErrUnexpectedEOF @@ -701,12 +699,12 @@ func (m *PlainTextChange_Content) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipTestdocumentchanges(dAtA[iNdEx:]) + skippy, err := skipTest(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTestdocumentchanges + return ErrInvalidLengthTest } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -728,7 +726,7 @@ func (m *PlainTextChange_TextAppend) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowTestdocumentchanges + return ErrIntOverflowTest } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -756,7 +754,7 @@ func (m *PlainTextChange_TextAppend) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowTestdocumentchanges + return ErrIntOverflowTest } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -770,11 +768,11 @@ func (m *PlainTextChange_TextAppend) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthTestdocumentchanges + return ErrInvalidLengthTest } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLengthTestdocumentchanges + return ErrInvalidLengthTest } if postIndex > l { return io.ErrUnexpectedEOF @@ -783,12 +781,12 @@ func (m *PlainTextChange_TextAppend) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipTestdocumentchanges(dAtA[iNdEx:]) + skippy, err := skipTest(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTestdocumentchanges + return ErrInvalidLengthTest } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -810,7 +808,7 @@ func (m *PlainTextChange_Snapshot) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowTestdocumentchanges + return ErrIntOverflowTest } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -838,7 +836,7 @@ func (m *PlainTextChange_Snapshot) Unmarshal(dAtA []byte) error { var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowTestdocumentchanges + return ErrIntOverflowTest } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -852,11 +850,11 @@ func (m *PlainTextChange_Snapshot) Unmarshal(dAtA []byte) error { } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthTestdocumentchanges + return ErrInvalidLengthTest } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLengthTestdocumentchanges + return ErrInvalidLengthTest } if postIndex > l { return io.ErrUnexpectedEOF @@ -865,12 +863,12 @@ func (m *PlainTextChange_Snapshot) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipTestdocumentchanges(dAtA[iNdEx:]) + skippy, err := skipTest(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTestdocumentchanges + return ErrInvalidLengthTest } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -892,7 +890,7 @@ func (m *PlainTextChange_Data) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowTestdocumentchanges + return ErrIntOverflowTest } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -920,7 +918,7 @@ func (m *PlainTextChange_Data) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowTestdocumentchanges + return ErrIntOverflowTest } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -933,11 +931,11 @@ func (m *PlainTextChange_Data) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthTestdocumentchanges + return ErrInvalidLengthTest } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthTestdocumentchanges + return ErrInvalidLengthTest } if postIndex > l { return io.ErrUnexpectedEOF @@ -954,7 +952,7 @@ func (m *PlainTextChange_Data) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowTestdocumentchanges + return ErrIntOverflowTest } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -967,11 +965,11 @@ func (m *PlainTextChange_Data) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthTestdocumentchanges + return ErrInvalidLengthTest } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthTestdocumentchanges + return ErrInvalidLengthTest } if postIndex > l { return io.ErrUnexpectedEOF @@ -985,12 +983,12 @@ func (m *PlainTextChange_Data) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipTestdocumentchanges(dAtA[iNdEx:]) + skippy, err := skipTest(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTestdocumentchanges + return ErrInvalidLengthTest } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -1004,7 +1002,7 @@ func (m *PlainTextChange_Data) Unmarshal(dAtA []byte) error { } return nil } -func skipTestdocumentchanges(dAtA []byte) (n int, err error) { +func skipTest(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 depth := 0 @@ -1012,7 +1010,7 @@ func skipTestdocumentchanges(dAtA []byte) (n int, err error) { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowTestdocumentchanges + return 0, ErrIntOverflowTest } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -1029,7 +1027,7 @@ func skipTestdocumentchanges(dAtA []byte) (n int, err error) { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowTestdocumentchanges + return 0, ErrIntOverflowTest } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -1045,7 +1043,7 @@ func skipTestdocumentchanges(dAtA []byte) (n int, err error) { var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowTestdocumentchanges + return 0, ErrIntOverflowTest } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -1058,14 +1056,14 @@ func skipTestdocumentchanges(dAtA []byte) (n int, err error) { } } if length < 0 { - return 0, ErrInvalidLengthTestdocumentchanges + return 0, ErrInvalidLengthTest } iNdEx += length case 3: depth++ case 4: if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTestdocumentchanges + return 0, ErrUnexpectedEndOfGroupTest } depth-- case 5: @@ -1074,7 +1072,7 @@ func skipTestdocumentchanges(dAtA []byte) (n int, err error) { return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } if iNdEx < 0 { - return 0, ErrInvalidLengthTestdocumentchanges + return 0, ErrInvalidLengthTest } if depth == 0 { return iNdEx, nil @@ -1084,7 +1082,7 @@ func skipTestdocumentchanges(dAtA []byte) (n int, err error) { } var ( - ErrInvalidLengthTestdocumentchanges = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTestdocumentchanges = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTestdocumentchanges = fmt.Errorf("proto: unexpected end of group") + ErrInvalidLengthTest = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTest = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTest = fmt.Errorf("proto: unexpected end of group") ) 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 c8b96a52..a5f6a385 100644 --- a/service/storage/service.go +++ b/service/storage/service.go @@ -21,7 +21,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 27be43c9..ce47947f 100644 --- a/syncproto/proto/sync.proto +++ b/syncproto/proto/sync.proto @@ -48,44 +48,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 8fe415ab..20a189a1 100644 --- a/syncproto/sync.pb.go +++ b/syncproto/sync.pb.go @@ -5,8 +5,7 @@ package syncproto import ( fmt "fmt" - aclpb "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/aclchanges/aclpb" - treepb "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/treestorage/treepb" + _ "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/aclchanges/aclpb" proto "github.com/gogo/protobuf/proto" io "io" math "math" @@ -449,421 +448,6 @@ func (m *System_Error) GetDescription() string { return "" } -type Sync struct { - SpaceId string `protobuf:"bytes,1,opt,name=spaceId,proto3" json:"spaceId,omitempty"` - Message *Sync_ContentValue `protobuf:"bytes,2,opt,name=message,proto3" json:"message,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() *Sync_ContentValue { - if m != nil { - return m.Message - } - return nil -} - -type Sync_ContentValue struct { - // Types that are valid to be assigned to Value: - // *Sync_ContentValue_HeadUpdate - // *Sync_ContentValue_FullSyncRequest - // *Sync_ContentValue_FullSyncResponse - Value isSync_ContentValue_Value `protobuf_oneof:"value"` -} - -func (m *Sync_ContentValue) Reset() { *m = Sync_ContentValue{} } -func (m *Sync_ContentValue) String() string { return proto.CompactTextString(m) } -func (*Sync_ContentValue) ProtoMessage() {} -func (*Sync_ContentValue) Descriptor() ([]byte, []int) { - return fileDescriptor_4b28dfdd48a89166, []int{3, 0} -} -func (m *Sync_ContentValue) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Sync_ContentValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Sync_ContentValue.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_ContentValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_Sync_ContentValue.Merge(m, src) -} -func (m *Sync_ContentValue) XXX_Size() int { - return m.Size() -} -func (m *Sync_ContentValue) XXX_DiscardUnknown() { - xxx_messageInfo_Sync_ContentValue.DiscardUnknown(m) -} - -var xxx_messageInfo_Sync_ContentValue proto.InternalMessageInfo - -type isSync_ContentValue_Value interface { - isSync_ContentValue_Value() - MarshalTo([]byte) (int, error) - Size() int -} - -type Sync_ContentValue_HeadUpdate struct { - HeadUpdate *Sync_HeadUpdate `protobuf:"bytes,1,opt,name=headUpdate,proto3,oneof" json:"headUpdate,omitempty"` -} -type Sync_ContentValue_FullSyncRequest struct { - FullSyncRequest *Sync_Full_Request `protobuf:"bytes,2,opt,name=fullSyncRequest,proto3,oneof" json:"fullSyncRequest,omitempty"` -} -type Sync_ContentValue_FullSyncResponse struct { - FullSyncResponse *Sync_Full_Response `protobuf:"bytes,3,opt,name=fullSyncResponse,proto3,oneof" json:"fullSyncResponse,omitempty"` -} - -func (*Sync_ContentValue_HeadUpdate) isSync_ContentValue_Value() {} -func (*Sync_ContentValue_FullSyncRequest) isSync_ContentValue_Value() {} -func (*Sync_ContentValue_FullSyncResponse) isSync_ContentValue_Value() {} - -func (m *Sync_ContentValue) GetValue() isSync_ContentValue_Value { - if m != nil { - return m.Value - } - return nil -} - -func (m *Sync_ContentValue) GetHeadUpdate() *Sync_HeadUpdate { - if x, ok := m.GetValue().(*Sync_ContentValue_HeadUpdate); ok { - return x.HeadUpdate - } - return nil -} - -func (m *Sync_ContentValue) GetFullSyncRequest() *Sync_Full_Request { - if x, ok := m.GetValue().(*Sync_ContentValue_FullSyncRequest); ok { - return x.FullSyncRequest - } - return nil -} - -func (m *Sync_ContentValue) GetFullSyncResponse() *Sync_Full_Response { - if x, ok := m.GetValue().(*Sync_ContentValue_FullSyncResponse); ok { - return x.FullSyncResponse - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*Sync_ContentValue) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*Sync_ContentValue_HeadUpdate)(nil), - (*Sync_ContentValue_FullSyncRequest)(nil), - (*Sync_ContentValue_FullSyncResponse)(nil), - } -} - -type Sync_HeadUpdate 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"` - TreeId string `protobuf:"bytes,3,opt,name=treeId,proto3" json:"treeId,omitempty"` - SnapshotPath []string `protobuf:"bytes,4,rep,name=snapshotPath,proto3" json:"snapshotPath,omitempty"` - TreeHeader *treepb.TreeHeader `protobuf:"bytes,5,opt,name=treeHeader,proto3" json:"treeHeader,omitempty"` -} - -func (m *Sync_HeadUpdate) Reset() { *m = Sync_HeadUpdate{} } -func (m *Sync_HeadUpdate) String() string { return proto.CompactTextString(m) } -func (*Sync_HeadUpdate) ProtoMessage() {} -func (*Sync_HeadUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_4b28dfdd48a89166, []int{3, 1} -} -func (m *Sync_HeadUpdate) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Sync_HeadUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Sync_HeadUpdate.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_HeadUpdate) XXX_Merge(src proto.Message) { - xxx_messageInfo_Sync_HeadUpdate.Merge(m, src) -} -func (m *Sync_HeadUpdate) XXX_Size() int { - return m.Size() -} -func (m *Sync_HeadUpdate) XXX_DiscardUnknown() { - xxx_messageInfo_Sync_HeadUpdate.DiscardUnknown(m) -} - -var xxx_messageInfo_Sync_HeadUpdate proto.InternalMessageInfo - -func (m *Sync_HeadUpdate) GetHeads() []string { - if m != nil { - return m.Heads - } - return nil -} - -func (m *Sync_HeadUpdate) GetChanges() []*aclpb.RawChange { - if m != nil { - return m.Changes - } - return nil -} - -func (m *Sync_HeadUpdate) GetTreeId() string { - if m != nil { - return m.TreeId - } - return "" -} - -func (m *Sync_HeadUpdate) GetSnapshotPath() []string { - if m != nil { - return m.SnapshotPath - } - return nil -} - -func (m *Sync_HeadUpdate) GetTreeHeader() *treepb.TreeHeader { - if m != nil { - return m.TreeHeader - } - return nil -} - -type Sync_Full struct { -} - -func (m *Sync_Full) Reset() { *m = Sync_Full{} } -func (m *Sync_Full) String() string { return proto.CompactTextString(m) } -func (*Sync_Full) ProtoMessage() {} -func (*Sync_Full) Descriptor() ([]byte, []int) { - return fileDescriptor_4b28dfdd48a89166, []int{3, 2} -} -func (m *Sync_Full) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Sync_Full) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Sync_Full.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_Full) XXX_Merge(src proto.Message) { - xxx_messageInfo_Sync_Full.Merge(m, src) -} -func (m *Sync_Full) XXX_Size() int { - return m.Size() -} -func (m *Sync_Full) XXX_DiscardUnknown() { - xxx_messageInfo_Sync_Full.DiscardUnknown(m) -} - -var xxx_messageInfo_Sync_Full proto.InternalMessageInfo - -// here with send the request with all changes we have (we already know sender's snapshot path) -type Sync_Full_Request 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"` - TreeId string `protobuf:"bytes,3,opt,name=treeId,proto3" json:"treeId,omitempty"` - SnapshotPath []string `protobuf:"bytes,4,rep,name=snapshotPath,proto3" json:"snapshotPath,omitempty"` - TreeHeader *treepb.TreeHeader `protobuf:"bytes,5,opt,name=treeHeader,proto3" json:"treeHeader,omitempty"` -} - -func (m *Sync_Full_Request) Reset() { *m = Sync_Full_Request{} } -func (m *Sync_Full_Request) String() string { return proto.CompactTextString(m) } -func (*Sync_Full_Request) ProtoMessage() {} -func (*Sync_Full_Request) Descriptor() ([]byte, []int) { - return fileDescriptor_4b28dfdd48a89166, []int{3, 2, 0} -} -func (m *Sync_Full_Request) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Sync_Full_Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Sync_Full_Request.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_Full_Request) XXX_Merge(src proto.Message) { - xxx_messageInfo_Sync_Full_Request.Merge(m, src) -} -func (m *Sync_Full_Request) XXX_Size() int { - return m.Size() -} -func (m *Sync_Full_Request) XXX_DiscardUnknown() { - xxx_messageInfo_Sync_Full_Request.DiscardUnknown(m) -} - -var xxx_messageInfo_Sync_Full_Request proto.InternalMessageInfo - -func (m *Sync_Full_Request) GetHeads() []string { - if m != nil { - return m.Heads - } - return nil -} - -func (m *Sync_Full_Request) GetChanges() []*aclpb.RawChange { - if m != nil { - return m.Changes - } - return nil -} - -func (m *Sync_Full_Request) GetTreeId() string { - if m != nil { - return m.TreeId - } - return "" -} - -func (m *Sync_Full_Request) GetSnapshotPath() []string { - if m != nil { - return m.SnapshotPath - } - return nil -} - -func (m *Sync_Full_Request) GetTreeHeader() *treepb.TreeHeader { - if m != nil { - return m.TreeHeader - } - return nil -} - -type Sync_Full_Response 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"` - TreeId string `protobuf:"bytes,3,opt,name=treeId,proto3" json:"treeId,omitempty"` - SnapshotPath []string `protobuf:"bytes,4,rep,name=snapshotPath,proto3" json:"snapshotPath,omitempty"` - TreeHeader *treepb.TreeHeader `protobuf:"bytes,5,opt,name=treeHeader,proto3" json:"treeHeader,omitempty"` -} - -func (m *Sync_Full_Response) Reset() { *m = Sync_Full_Response{} } -func (m *Sync_Full_Response) String() string { return proto.CompactTextString(m) } -func (*Sync_Full_Response) ProtoMessage() {} -func (*Sync_Full_Response) Descriptor() ([]byte, []int) { - return fileDescriptor_4b28dfdd48a89166, []int{3, 2, 1} -} -func (m *Sync_Full_Response) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Sync_Full_Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Sync_Full_Response.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_Full_Response) XXX_Merge(src proto.Message) { - xxx_messageInfo_Sync_Full_Response.Merge(m, src) -} -func (m *Sync_Full_Response) XXX_Size() int { - return m.Size() -} -func (m *Sync_Full_Response) XXX_DiscardUnknown() { - xxx_messageInfo_Sync_Full_Response.DiscardUnknown(m) -} - -var xxx_messageInfo_Sync_Full_Response proto.InternalMessageInfo - -func (m *Sync_Full_Response) GetHeads() []string { - if m != nil { - return m.Heads - } - return nil -} - -func (m *Sync_Full_Response) GetChanges() []*aclpb.RawChange { - if m != nil { - return m.Changes - } - return nil -} - -func (m *Sync_Full_Response) GetTreeId() string { - if m != nil { - return m.TreeId - } - return "" -} - -func (m *Sync_Full_Response) GetSnapshotPath() []string { - if m != nil { - return m.SnapshotPath - } - return nil -} - -func (m *Sync_Full_Response) GetTreeHeader() *treepb.TreeHeader { - if m != nil { - return m.TreeHeader - } - return nil -} - func init() { proto.RegisterEnum("anytype.MessageType", MessageType_name, MessageType_value) proto.RegisterEnum("anytype.System_Error_Code", System_Error_Code_name, System_Error_Code_value) @@ -874,68 +458,46 @@ func init() { proto.RegisterType((*System_Ping)(nil), "anytype.System.Ping") proto.RegisterType((*System_Ack)(nil), "anytype.System.Ack") proto.RegisterType((*System_Error)(nil), "anytype.System.Error") - proto.RegisterType((*Sync)(nil), "anytype.Sync") - proto.RegisterType((*Sync_ContentValue)(nil), "anytype.Sync.ContentValue") - proto.RegisterType((*Sync_HeadUpdate)(nil), "anytype.Sync.HeadUpdate") - proto.RegisterType((*Sync_Full)(nil), "anytype.Sync.Full") - proto.RegisterType((*Sync_Full_Request)(nil), "anytype.Sync.Full.Request") - proto.RegisterType((*Sync_Full_Response)(nil), "anytype.Sync.Full.Response") } func init() { proto.RegisterFile("syncproto/proto/sync.proto", fileDescriptor_4b28dfdd48a89166) } var fileDescriptor_4b28dfdd48a89166 = []byte{ - // 799 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0xd1, 0x6e, 0xe3, 0x44, - 0x14, 0xf5, 0x24, 0x4e, 0xbc, 0xbe, 0xae, 0x5a, 0x33, 0xdb, 0x45, 0xc6, 0xac, 0x22, 0x2b, 0x02, - 0x61, 0x01, 0x72, 0x57, 0x81, 0x15, 0x12, 0x6f, 0xbb, 0xa1, 0x55, 0x22, 0x20, 0x89, 0x26, 0x49, - 0x91, 0x78, 0x59, 0x4d, 0xed, 0xd9, 0x24, 0x8a, 0x3b, 0x36, 0x1e, 0x07, 0xc8, 0x5f, 0xec, 0x37, - 0xf0, 0x0d, 0x48, 0x20, 0xbe, 0x80, 0xc7, 0x7d, 0xe4, 0x11, 0xb5, 0x12, 0x1f, 0x01, 0x2f, 0x68, - 0xc6, 0x76, 0xe2, 0x66, 0xfb, 0x03, 0xfb, 0xd0, 0x66, 0xee, 0xb9, 0xe7, 0x5c, 0x9f, 0x1b, 0xdf, - 0xb9, 0x01, 0x57, 0x6c, 0x79, 0x98, 0x66, 0x49, 0x9e, 0x9c, 0x15, 0xff, 0x65, 0x1c, 0xa8, 0x23, - 0x36, 0x28, 0xdf, 0xe6, 0xdb, 0x94, 0xb9, 0x4f, 0xd2, 0xf5, 0xe2, 0x8c, 0x86, 0xb1, 0xfc, 0x0b, - 0x97, 0x94, 0x2f, 0x98, 0x90, 0xc7, 0xf4, 0xaa, 0xd0, 0x88, 0x1a, 0x5e, 0x48, 0xdd, 0x4f, 0x2b, - 0x45, 0x9e, 0x31, 0x26, 0xf2, 0x24, 0xa3, 0x0b, 0xa6, 0xce, 0x7b, 0x8d, 0x8c, 0x0a, 0x76, 0xf7, - 0x02, 0x8c, 0x6f, 0x99, 0x10, 0x74, 0xc1, 0xf0, 0x47, 0xd0, 0x5e, 0x32, 0x1a, 0xb1, 0xcc, 0x41, - 0x1e, 0xf2, 0xad, 0xde, 0x49, 0x50, 0x9a, 0x08, 0x06, 0x0a, 0x26, 0x65, 0x1a, 0x63, 0xd0, 0x23, - 0x9a, 0x53, 0xa7, 0xe1, 0x21, 0xff, 0x88, 0xa8, 0x73, 0xf7, 0x17, 0x04, 0xed, 0x82, 0x86, 0x1d, - 0x30, 0xf2, 0x8c, 0x86, 0x6c, 0x18, 0xa9, 0x42, 0x47, 0xa4, 0x0a, 0xf1, 0x63, 0x30, 0x33, 0xf6, - 0xc3, 0x86, 0x89, 0x7c, 0x18, 0x29, 0xb5, 0x4e, 0xf6, 0x80, 0xd4, 0x65, 0x2c, 0x8d, 0xb7, 0xc3, - 0xc8, 0x69, 0xaa, 0x5c, 0x15, 0x62, 0x1f, 0x74, 0xe9, 0xc3, 0xd1, 0x3d, 0xe4, 0x1f, 0xf7, 0x4e, - 0x77, 0xbe, 0x4a, 0xe7, 0xb3, 0x6d, 0xca, 0x88, 0x62, 0xc8, 0x27, 0x44, 0xec, 0x6a, 0xb3, 0x18, - 0xf2, 0x97, 0x89, 0xd3, 0xf2, 0x90, 0x6f, 0x92, 0x3d, 0xd0, 0xfd, 0xb5, 0x09, 0xed, 0xe9, 0x56, - 0xe4, 0xec, 0x1a, 0x7f, 0x01, 0xe6, 0x92, 0xf2, 0x48, 0x2c, 0xe9, 0x9a, 0x95, 0xfd, 0xbe, 0xb7, - 0xab, 0x5b, 0x70, 0x82, 0x41, 0x45, 0x20, 0x7b, 0xae, 0xf4, 0x92, 0xae, 0xf8, 0x42, 0xd9, 0xb7, - 0x6a, 0x5e, 0x4a, 0xcd, 0x64, 0xc5, 0x17, 0x44, 0x31, 0xf0, 0x87, 0xd0, 0xa4, 0xe1, 0x5a, 0xf5, - 0x62, 0xf5, 0x1e, 0x1e, 0x12, 0x9f, 0x85, 0x6b, 0x22, 0xf3, 0xee, 0x53, 0x30, 0x07, 0xb5, 0xea, - 0x27, 0xea, 0xbd, 0x84, 0x49, 0x7c, 0xc9, 0x32, 0xb1, 0x4a, 0xb8, 0x32, 0x67, 0x92, 0x43, 0xd8, - 0xed, 0x82, 0x2e, 0x9f, 0x85, 0x5d, 0x78, 0xb0, 0xe1, 0xab, 0x9f, 0x67, 0xab, 0xeb, 0xa2, 0x0f, - 0x9d, 0xec, 0x62, 0xb7, 0x07, 0xcd, 0x67, 0xe1, 0x1a, 0x7f, 0x02, 0x2d, 0x96, 0x65, 0x49, 0x56, - 0x7a, 0x7e, 0x74, 0x68, 0xe5, 0x5c, 0x26, 0x49, 0xc1, 0x71, 0x5f, 0x21, 0x68, 0x29, 0x00, 0x07, - 0xa0, 0x87, 0x49, 0x54, 0x54, 0x3d, 0xee, 0xb9, 0xf7, 0xaa, 0x82, 0x7e, 0x12, 0x31, 0xa2, 0x78, - 0xd8, 0x03, 0x2b, 0x62, 0x22, 0xcc, 0x56, 0x69, 0x2e, 0x7d, 0x37, 0x94, 0xef, 0x3a, 0xd4, 0x7d, - 0x0a, 0xba, 0xe4, 0x63, 0x0b, 0x8c, 0xf9, 0xe8, 0xeb, 0xd1, 0xf8, 0xbb, 0x91, 0xad, 0x61, 0x0f, - 0x1e, 0xcf, 0x47, 0xd3, 0xf9, 0x64, 0x32, 0x26, 0xb3, 0xf3, 0xaf, 0x5e, 0x4c, 0xc8, 0x78, 0x36, - 0xee, 0x8f, 0xbf, 0x79, 0x71, 0x79, 0x4e, 0xa6, 0xc3, 0xf1, 0xc8, 0x86, 0xee, 0xbf, 0x6d, 0xd0, - 0xa7, 0x5b, 0x1e, 0xca, 0x09, 0x11, 0xe9, 0x7e, 0xb2, 0x4c, 0x52, 0x85, 0xf8, 0x73, 0x30, 0xae, - 0x8b, 0x61, 0x28, 0x9b, 0xac, 0xdb, 0xe5, 0x61, 0xd0, 0x4f, 0x78, 0xce, 0x78, 0x7e, 0x49, 0xe3, - 0x0d, 0x23, 0x15, 0xd5, 0xfd, 0x07, 0xc1, 0x51, 0x3d, 0x83, 0xbf, 0x04, 0x90, 0x33, 0x3e, 0x4f, - 0x23, 0x9a, 0x57, 0x63, 0xe1, 0xdc, 0xad, 0x34, 0xd8, 0xe5, 0x07, 0x1a, 0xa9, 0xb1, 0xf1, 0x05, - 0x9c, 0xbc, 0xdc, 0xc4, 0xb1, 0x24, 0x91, 0x62, 0xa6, 0xef, 0xb7, 0x72, 0xb1, 0x89, 0xe3, 0xa0, - 0x64, 0x0c, 0x34, 0x72, 0x28, 0xc2, 0x43, 0xb0, 0xf7, 0x90, 0x48, 0x13, 0x2e, 0x58, 0x39, 0x43, - 0xef, 0xdf, 0x5b, 0xa8, 0xa0, 0x0c, 0x34, 0xf2, 0x86, 0xec, 0xb9, 0x01, 0xad, 0x1f, 0x65, 0x5f, - 0xee, 0x1f, 0x08, 0x60, 0x6f, 0x1c, 0x9f, 0x42, 0x4b, 0x1a, 0x17, 0x0e, 0xf2, 0x9a, 0xbe, 0x49, - 0x8a, 0x00, 0xfb, 0x60, 0x94, 0x9b, 0xc4, 0x69, 0x78, 0x4d, 0xdf, 0xea, 0x1d, 0x07, 0x34, 0x8c, - 0x03, 0x42, 0x7f, 0xea, 0x2b, 0x98, 0x54, 0x69, 0xfc, 0x2e, 0xb4, 0xe5, 0x0a, 0x29, 0x2f, 0xaa, - 0x49, 0xca, 0x08, 0x77, 0xe1, 0x48, 0x70, 0x9a, 0x8a, 0x65, 0x92, 0x4f, 0x68, 0xbe, 0x74, 0x74, - 0x55, 0xfe, 0x0e, 0x86, 0x9f, 0x00, 0x48, 0x76, 0xb1, 0x2b, 0xd4, 0x15, 0xb5, 0x7a, 0x76, 0xa0, - 0x36, 0xd2, 0x6c, 0x87, 0x93, 0x1a, 0xc7, 0xfd, 0xaf, 0x01, 0xba, 0xec, 0xd5, 0xfd, 0x0d, 0x81, - 0x51, 0x7d, 0x4b, 0x6f, 0x57, 0x0b, 0xbf, 0x23, 0x78, 0x50, 0xbd, 0x95, 0xb7, 0xcb, 0xfa, 0xc7, - 0x63, 0xb0, 0x6a, 0x6b, 0x16, 0x3f, 0x82, 0x77, 0x6a, 0x61, 0xb1, 0x0a, 0x6c, 0x0d, 0x9f, 0x82, - 0x5d, 0x87, 0xe5, 0xad, 0xb4, 0x11, 0x7e, 0x08, 0x27, 0x77, 0xc8, 0x3c, 0xb4, 0x1b, 0xcf, 0x3f, - 0xf8, 0xf3, 0xa6, 0x83, 0x5e, 0xdf, 0x74, 0xd0, 0xdf, 0x37, 0x1d, 0xf4, 0xea, 0xb6, 0xa3, 0xbd, - 0xbe, 0xed, 0x68, 0x7f, 0xdd, 0x76, 0xb4, 0xef, 0xe1, 0x6c, 0xf7, 0x8b, 0x78, 0xd5, 0x56, 0x1f, - 0x9f, 0xfd, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x71, 0xf4, 0xb0, 0xb9, 0x25, 0x07, 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) { @@ -1219,388 +781,6 @@ func (m *System_Error) 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 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 *Sync_ContentValue) 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_ContentValue) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Sync_ContentValue) 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 *Sync_ContentValue_HeadUpdate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Sync_ContentValue_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 = encodeVarintSync(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *Sync_ContentValue_FullSyncRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Sync_ContentValue_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 = encodeVarintSync(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *Sync_ContentValue_FullSyncResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Sync_ContentValue_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 = encodeVarintSync(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} -func (m *Sync_HeadUpdate) 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_HeadUpdate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Sync_HeadUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - 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] = 0x2a - } - 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] = 0x22 - } - } - 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] = 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 *Sync_Full) 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_Full) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Sync_Full) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *Sync_Full_Request) 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_Full_Request) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Sync_Full_Request) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - 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] = 0x2a - } - 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] = 0x22 - } - } - 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] = 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 *Sync_Full_Response) 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_Full_Response) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Sync_Full_Response) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - 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] = 0x2a - } - 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] = 0x22 - } - } - 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] = 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 @@ -1730,185 +910,6 @@ func (m *System_Error) 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)) - } - return n -} - -func (m *Sync_ContentValue) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Value != nil { - n += m.Value.Size() - } - return n -} - -func (m *Sync_ContentValue_HeadUpdate) 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 *Sync_ContentValue_FullSyncRequest) 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 *Sync_ContentValue_FullSyncResponse) 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 *Sync_HeadUpdate) 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)) - } - } - l = len(m.TreeId) - if l > 0 { - 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)) - } - } - if m.TreeHeader != nil { - l = m.TreeHeader.Size() - n += 1 + l + sovSync(uint64(l)) - } - return n -} - -func (m *Sync_Full) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *Sync_Full_Request) 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)) - } - } - l = len(m.TreeId) - if l > 0 { - 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)) - } - } - if m.TreeHeader != nil { - l = m.TreeHeader.Size() - n += 1 + l + sovSync(uint64(l)) - } - return n -} - -func (m *Sync_Full_Response) 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)) - } - } - l = len(m.TreeId) - if l > 0 { - 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)) - } - } - if m.TreeHeader != nil { - l = m.TreeHeader.Size() - n += 1 + l + sovSync(uint64(l)) - } - return n -} - func sovSync(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2704,977 +1705,6 @@ func (m *System_Error) 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 = &Sync_ContentValue{} - } - if err := m.Message.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 *Sync_ContentValue) 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 := &Sync_HeadUpdate{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Value = &Sync_ContentValue_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 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 := &Sync_Full_Request{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Value = &Sync_ContentValue_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 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 := &Sync_Full_Response{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Value = &Sync_ContentValue_FullSyncResponse{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 *Sync_HeadUpdate) 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 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 - case 4: - 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 - case 5: - 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 = &treepb.TreeHeader{} - } - if err := m.TreeHeader.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 *Sync_Full) 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 *Sync_Full_Request) 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 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 - case 4: - 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 - case 5: - 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 = &treepb.TreeHeader{} - } - if err := m.TreeHeader.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 *Sync_Full_Response) 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 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 - case 4: - 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 - case 5: - 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 = &treepb.TreeHeader{} - } - if err := m.TreeHeader.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 skipSync(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0