node acl service (wip), fixes
This commit is contained in:
parent
c33e944ec4
commit
7a2d366bdd
@ -77,8 +77,8 @@ func createListStorage(spaceId string, db *badger.DB, txn *badger.Txn, root *acl
|
||||
return
|
||||
}
|
||||
|
||||
func (l *listStorage) ID() (string, error) {
|
||||
return l.id, nil
|
||||
func (l *listStorage) Id() string {
|
||||
return l.id
|
||||
}
|
||||
|
||||
func (l *listStorage) Root() (*aclrecordproto.RawACLRecordWithId, error) {
|
||||
|
||||
@ -3,7 +3,7 @@ package storage
|
||||
import (
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto"
|
||||
spacestorage "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/storage"
|
||||
storage2 "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage"
|
||||
storage "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage"
|
||||
"github.com/dgraph-io/badger/v3"
|
||||
"sync"
|
||||
)
|
||||
@ -12,7 +12,7 @@ type spaceStorage struct {
|
||||
spaceId string
|
||||
objDb *badger.DB
|
||||
keys spaceKeys
|
||||
aclStorage storage2.ListStorage
|
||||
aclStorage storage.ListStorage
|
||||
header *spacesyncproto.RawSpaceHeaderWithId
|
||||
mx sync.Mutex
|
||||
}
|
||||
@ -77,15 +77,15 @@ func createSpaceStorage(db *badger.DB, payload spacestorage.SpaceStorageCreatePa
|
||||
return
|
||||
}
|
||||
|
||||
func (s *spaceStorage) ID() (string, error) {
|
||||
return s.spaceId, nil
|
||||
func (s *spaceStorage) Id() string {
|
||||
return s.spaceId
|
||||
}
|
||||
|
||||
func (s *spaceStorage) TreeStorage(id string) (storage2.TreeStorage, error) {
|
||||
func (s *spaceStorage) TreeStorage(id string) (storage.TreeStorage, error) {
|
||||
return newTreeStorage(s.objDb, s.spaceId, id)
|
||||
}
|
||||
|
||||
func (s *spaceStorage) CreateTreeStorage(payload storage2.TreeStorageCreatePayload) (ts storage2.TreeStorage, err error) {
|
||||
func (s *spaceStorage) CreateTreeStorage(payload storage.TreeStorageCreatePayload) (ts storage.TreeStorage, err error) {
|
||||
// we have mutex here, so we prevent overwriting the heads of a tree on concurrent creation
|
||||
s.mx.Lock()
|
||||
defer s.mx.Unlock()
|
||||
@ -93,7 +93,7 @@ func (s *spaceStorage) CreateTreeStorage(payload storage2.TreeStorageCreatePaylo
|
||||
return createTreeStorage(s.objDb, s.spaceId, payload)
|
||||
}
|
||||
|
||||
func (s *spaceStorage) ACLStorage() (storage2.ListStorage, error) {
|
||||
func (s *spaceStorage) ACLStorage() (storage.ListStorage, error) {
|
||||
return s.aclStorage, nil
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ package storage
|
||||
|
||||
import (
|
||||
"context"
|
||||
storage2 "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/treechangeproto"
|
||||
"github.com/dgraph-io/badger/v3"
|
||||
)
|
||||
@ -14,7 +14,7 @@ type treeStorage struct {
|
||||
root *treechangeproto.RawTreeChangeWithId
|
||||
}
|
||||
|
||||
func newTreeStorage(db *badger.DB, spaceId, treeId string) (ts storage2.TreeStorage, err error) {
|
||||
func newTreeStorage(db *badger.DB, spaceId, treeId string) (ts storage.TreeStorage, err error) {
|
||||
keys := newTreeKeys(spaceId, treeId)
|
||||
err = db.View(func(txn *badger.Txn) error {
|
||||
_, err := txn.Get(keys.RootIdKey())
|
||||
@ -43,14 +43,14 @@ func newTreeStorage(db *badger.DB, spaceId, treeId string) (ts storage2.TreeStor
|
||||
return
|
||||
}
|
||||
|
||||
func createTreeStorage(db *badger.DB, spaceId string, payload storage2.TreeStorageCreatePayload) (ts storage2.TreeStorage, err error) {
|
||||
func createTreeStorage(db *badger.DB, spaceId string, payload storage.TreeStorageCreatePayload) (ts storage.TreeStorage, err error) {
|
||||
keys := newTreeKeys(spaceId, payload.TreeId)
|
||||
if hasDB(db, keys.RootIdKey()) {
|
||||
err = storage2.ErrTreeExists
|
||||
err = storage.ErrTreeExists
|
||||
return
|
||||
}
|
||||
err = db.Update(func(txn *badger.Txn) error {
|
||||
heads := storage2.CreateHeadsPayload(payload.Heads)
|
||||
heads := storage.CreateHeadsPayload(payload.Heads)
|
||||
|
||||
for _, ch := range payload.Changes {
|
||||
err = txn.Set(keys.RawChangeKey(ch.Id), ch.GetRawChange())
|
||||
@ -85,8 +85,8 @@ func createTreeStorage(db *badger.DB, spaceId string, payload storage2.TreeStora
|
||||
return
|
||||
}
|
||||
|
||||
func (t *treeStorage) ID() (string, error) {
|
||||
return t.id, nil
|
||||
func (t *treeStorage) Id() string {
|
||||
return t.id
|
||||
}
|
||||
|
||||
func (t *treeStorage) Root() (raw *treechangeproto.RawTreeChangeWithId, err error) {
|
||||
@ -97,16 +97,16 @@ func (t *treeStorage) Heads() (heads []string, err error) {
|
||||
headsBytes, err := getDB(t.db, t.keys.HeadsKey())
|
||||
if err != nil {
|
||||
if err == badger.ErrKeyNotFound {
|
||||
err = storage2.ErrUnknownTreeId
|
||||
err = storage.ErrUnknownTreeId
|
||||
}
|
||||
return
|
||||
}
|
||||
heads = storage2.ParseHeads(headsBytes)
|
||||
heads = storage.ParseHeads(headsBytes)
|
||||
return
|
||||
}
|
||||
|
||||
func (t *treeStorage) SetHeads(heads []string) (err error) {
|
||||
payload := storage2.CreateHeadsPayload(heads)
|
||||
payload := storage.CreateHeadsPayload(heads)
|
||||
return putDB(t.db, t.keys.HeadsKey(), payload)
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ func (t *treeStorage) GetRawChange(ctx context.Context, id string) (raw *treecha
|
||||
res, err := getDB(t.db, t.keys.RawChangeKey(id))
|
||||
if err != nil {
|
||||
if err == badger.ErrKeyNotFound {
|
||||
err = storage2.ErrUnknownTreeId
|
||||
err = storage.ErrUnknownTreeId
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ import (
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/storage"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/syncservice"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/treegetter"
|
||||
config2 "github.com/anytypeio/go-anytype-infrastructure-experiments/common/config"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/config"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/pool"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/nodeconf"
|
||||
)
|
||||
@ -30,7 +30,7 @@ type Service interface {
|
||||
}
|
||||
|
||||
type service struct {
|
||||
config config2.Space
|
||||
config config.Space
|
||||
account account.Service
|
||||
configurationService nodeconf.Service
|
||||
storageProvider storage.SpaceStorageProvider
|
||||
@ -39,7 +39,7 @@ type service struct {
|
||||
}
|
||||
|
||||
func (s *service) Init(a *app.App) (err error) {
|
||||
s.config = a.MustComponent(config2.CName).(*config2.Config).Space
|
||||
s.config = a.MustComponent(config.CName).(*config.Config).Space
|
||||
s.account = a.MustComponent(account.CName).(account.Service)
|
||||
s.storageProvider = a.MustComponent(storage.CName).(storage.SpaceStorageProvider)
|
||||
s.configurationService = a.MustComponent(nodeconf.CName).(nodeconf.Service)
|
||||
@ -52,9 +52,7 @@ func (s *service) Name() (name string) {
|
||||
return CName
|
||||
}
|
||||
|
||||
func (s *service) CreateSpace(
|
||||
ctx context.Context,
|
||||
payload SpaceCreatePayload) (id string, err error) {
|
||||
func (s *service) CreateSpace(ctx context.Context, payload SpaceCreatePayload) (id string, err error) {
|
||||
storageCreate, err := storagePayloadForSpaceCreate(payload)
|
||||
if err != nil {
|
||||
return
|
||||
@ -64,12 +62,10 @@ func (s *service) CreateSpace(
|
||||
return
|
||||
}
|
||||
|
||||
return store.ID()
|
||||
return store.Id(), nil
|
||||
}
|
||||
|
||||
func (s *service) DeriveSpace(
|
||||
ctx context.Context,
|
||||
payload SpaceDerivePayload) (id string, err error) {
|
||||
func (s *service) DeriveSpace(ctx context.Context, payload SpaceDerivePayload) (id string, err error) {
|
||||
storageCreate, err := storagePayloadForSpaceDerive(payload)
|
||||
if err != nil {
|
||||
return
|
||||
@ -79,7 +75,7 @@ func (s *service) DeriveSpace(
|
||||
return
|
||||
}
|
||||
|
||||
return store.ID()
|
||||
return store.Id(), nil
|
||||
}
|
||||
|
||||
func (s *service) GetSpace(ctx context.Context, id string) (Space, error) {
|
||||
|
||||
@ -162,19 +162,18 @@ func (mr *MockSpaceStorageMockRecorder) CreateTreeStorage(arg0 interface{}) *gom
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTreeStorage", reflect.TypeOf((*MockSpaceStorage)(nil).CreateTreeStorage), arg0)
|
||||
}
|
||||
|
||||
// ID mocks base method.
|
||||
func (m *MockSpaceStorage) ID() (string, error) {
|
||||
// Id mocks base method.
|
||||
func (m *MockSpaceStorage) Id() string {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ID")
|
||||
ret := m.ctrl.Call(m, "Id")
|
||||
ret0, _ := ret[0].(string)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
return ret0
|
||||
}
|
||||
|
||||
// ID indicates an expected call of ID.
|
||||
func (mr *MockSpaceStorageMockRecorder) ID() *gomock.Call {
|
||||
// Id indicates an expected call of Id.
|
||||
func (mr *MockSpaceStorageMockRecorder) Id() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ID", reflect.TypeOf((*MockSpaceStorage)(nil).ID))
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Id", reflect.TypeOf((*MockSpaceStorage)(nil).Id))
|
||||
}
|
||||
|
||||
// SpaceHeader mocks base method.
|
||||
|
||||
@ -6,7 +6,7 @@ import (
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/aclrecordproto"
|
||||
storage2 "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage"
|
||||
)
|
||||
|
||||
const CName = "commonspace.storage"
|
||||
@ -15,9 +15,9 @@ var ErrSpaceStorageExists = errors.New("space storage exists")
|
||||
var ErrSpaceStorageMissing = errors.New("space storage missing")
|
||||
|
||||
type SpaceStorage interface {
|
||||
storage2.Storage
|
||||
storage2.Provider
|
||||
ACLStorage() (storage2.ListStorage, error)
|
||||
storage.Provider
|
||||
Id() string
|
||||
ACLStorage() (storage.ListStorage, error)
|
||||
SpaceHeader() (*spacesyncproto.RawSpaceHeaderWithId, error)
|
||||
StoredIds() ([]string, error)
|
||||
Close() error
|
||||
|
||||
@ -6,7 +6,6 @@ package mock_synctree
|
||||
|
||||
import (
|
||||
reflect "reflect"
|
||||
time "time"
|
||||
|
||||
tree "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/tree"
|
||||
treechangeproto "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/treechangeproto"
|
||||
@ -122,20 +121,6 @@ func (mr *MockSyncClientMockRecorder) CreateNewTreeRequest() *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateNewTreeRequest", reflect.TypeOf((*MockSyncClient)(nil).CreateNewTreeRequest))
|
||||
}
|
||||
|
||||
// LastUsage mocks base method.
|
||||
func (m *MockSyncClient) LastUsage() time.Time {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "LastUsage")
|
||||
ret0, _ := ret[0].(time.Time)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// LastUsage indicates an expected call of LastUsage.
|
||||
func (mr *MockSyncClientMockRecorder) LastUsage() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LastUsage", reflect.TypeOf((*MockSyncClient)(nil).LastUsage))
|
||||
}
|
||||
|
||||
// SendAsync mocks base method.
|
||||
func (m *MockSyncClient) SendAsync(arg0 string, arg1 *treechangeproto.TreeSyncMessage, arg2 string) error {
|
||||
m.ctrl.T.Helper()
|
||||
|
||||
@ -103,8 +103,10 @@ func (m *RawACLRecord) GetSignature() []byte {
|
||||
}
|
||||
|
||||
type RawACLRecordWithId struct {
|
||||
Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
|
||||
Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
|
||||
Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
|
||||
AcceptorIdentity []byte `protobuf:"bytes,3,opt,name=acceptorIdentity,proto3" json:"acceptorIdentity,omitempty"`
|
||||
AcceptorSignature []byte `protobuf:"bytes,4,opt,name=acceptorSignature,proto3" json:"acceptorSignature,omitempty"`
|
||||
}
|
||||
|
||||
func (m *RawACLRecordWithId) Reset() { *m = RawACLRecordWithId{} }
|
||||
@ -154,6 +156,20 @@ func (m *RawACLRecordWithId) GetId() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *RawACLRecordWithId) GetAcceptorIdentity() []byte {
|
||||
if m != nil {
|
||||
return m.AcceptorIdentity
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *RawACLRecordWithId) GetAcceptorSignature() []byte {
|
||||
if m != nil {
|
||||
return m.AcceptorSignature
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
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"`
|
||||
@ -680,11 +696,13 @@ func (m *ACLUserAdd) GetPermissions() ACLUserPermissions {
|
||||
}
|
||||
|
||||
type ACLUserInvite struct {
|
||||
AcceptPublicKey []byte `protobuf:"bytes,1,opt,name=acceptPublicKey,proto3" json:"acceptPublicKey,omitempty"`
|
||||
AcceptPublicKey []byte `protobuf:"bytes,1,opt,name=acceptPublicKey,proto3" json:"acceptPublicKey,omitempty"`
|
||||
// TODO: change to read key
|
||||
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=aclrecord.ACLUserPermissions" json:"permissions,omitempty"`
|
||||
InviteId string `protobuf:"bytes,5,opt,name=inviteId,proto3" json:"inviteId,omitempty"`
|
||||
// TODO: either derive inviteId from pub keys or think if it is possible to just use ACL record id
|
||||
InviteId string `protobuf:"bytes,5,opt,name=inviteId,proto3" json:"inviteId,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ACLUserInvite) Reset() { *m = ACLUserInvite{} }
|
||||
@ -995,6 +1013,168 @@ func (m *ACLUserPermissionChange) GetPermissions() ACLUserPermissions {
|
||||
return ACLUserPermissions_Admin
|
||||
}
|
||||
|
||||
type ACLSyncMessage struct {
|
||||
Content *ACLSyncContentValue `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ACLSyncMessage) Reset() { *m = ACLSyncMessage{} }
|
||||
func (m *ACLSyncMessage) String() string { return proto.CompactTextString(m) }
|
||||
func (*ACLSyncMessage) ProtoMessage() {}
|
||||
func (*ACLSyncMessage) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_14abe0d1b4206d54, []int{14}
|
||||
}
|
||||
func (m *ACLSyncMessage) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *ACLSyncMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_ACLSyncMessage.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 *ACLSyncMessage) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ACLSyncMessage.Merge(m, src)
|
||||
}
|
||||
func (m *ACLSyncMessage) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *ACLSyncMessage) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ACLSyncMessage.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ACLSyncMessage proto.InternalMessageInfo
|
||||
|
||||
func (m *ACLSyncMessage) GetContent() *ACLSyncContentValue {
|
||||
if m != nil {
|
||||
return m.Content
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ACLSyncContentValue provides different types for acl sync
|
||||
type ACLSyncContentValue struct {
|
||||
// Types that are valid to be assigned to Value:
|
||||
//
|
||||
// *ACLSyncContentValue_AddRecords
|
||||
Value isACLSyncContentValue_Value `protobuf_oneof:"value"`
|
||||
}
|
||||
|
||||
func (m *ACLSyncContentValue) Reset() { *m = ACLSyncContentValue{} }
|
||||
func (m *ACLSyncContentValue) String() string { return proto.CompactTextString(m) }
|
||||
func (*ACLSyncContentValue) ProtoMessage() {}
|
||||
func (*ACLSyncContentValue) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_14abe0d1b4206d54, []int{15}
|
||||
}
|
||||
func (m *ACLSyncContentValue) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *ACLSyncContentValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_ACLSyncContentValue.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 *ACLSyncContentValue) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ACLSyncContentValue.Merge(m, src)
|
||||
}
|
||||
func (m *ACLSyncContentValue) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *ACLSyncContentValue) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ACLSyncContentValue.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ACLSyncContentValue proto.InternalMessageInfo
|
||||
|
||||
type isACLSyncContentValue_Value interface {
|
||||
isACLSyncContentValue_Value()
|
||||
MarshalTo([]byte) (int, error)
|
||||
Size() int
|
||||
}
|
||||
|
||||
type ACLSyncContentValue_AddRecords struct {
|
||||
AddRecords *ACLAddRecords `protobuf:"bytes,1,opt,name=addRecords,proto3,oneof" json:"addRecords,omitempty"`
|
||||
}
|
||||
|
||||
func (*ACLSyncContentValue_AddRecords) isACLSyncContentValue_Value() {}
|
||||
|
||||
func (m *ACLSyncContentValue) GetValue() isACLSyncContentValue_Value {
|
||||
if m != nil {
|
||||
return m.Value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ACLSyncContentValue) GetAddRecords() *ACLAddRecords {
|
||||
if x, ok := m.GetValue().(*ACLSyncContentValue_AddRecords); ok {
|
||||
return x.AddRecords
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// XXX_OneofWrappers is for the internal use of the proto package.
|
||||
func (*ACLSyncContentValue) XXX_OneofWrappers() []interface{} {
|
||||
return []interface{}{
|
||||
(*ACLSyncContentValue_AddRecords)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
type ACLAddRecords struct {
|
||||
Records []*RawACLRecordWithId `protobuf:"bytes,1,rep,name=records,proto3" json:"records,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ACLAddRecords) Reset() { *m = ACLAddRecords{} }
|
||||
func (m *ACLAddRecords) String() string { return proto.CompactTextString(m) }
|
||||
func (*ACLAddRecords) ProtoMessage() {}
|
||||
func (*ACLAddRecords) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_14abe0d1b4206d54, []int{16}
|
||||
}
|
||||
func (m *ACLAddRecords) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *ACLAddRecords) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_ACLAddRecords.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 *ACLAddRecords) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ACLAddRecords.Merge(m, src)
|
||||
}
|
||||
func (m *ACLAddRecords) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *ACLAddRecords) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ACLAddRecords.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ACLAddRecords proto.InternalMessageInfo
|
||||
|
||||
func (m *ACLAddRecords) GetRecords() []*RawACLRecordWithId {
|
||||
if m != nil {
|
||||
return m.Records
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterEnum("aclrecord.ACLUserPermissions", ACLUserPermissions_name, ACLUserPermissions_value)
|
||||
proto.RegisterType((*RawACLRecord)(nil), "aclrecord.RawACLRecord")
|
||||
@ -1012,6 +1192,9 @@ func init() {
|
||||
proto.RegisterType((*ACLUserRemove)(nil), "aclrecord.ACLUserRemove")
|
||||
proto.RegisterType((*ACLReadKeyReplace)(nil), "aclrecord.ACLReadKeyReplace")
|
||||
proto.RegisterType((*ACLUserPermissionChange)(nil), "aclrecord.ACLUserPermissionChange")
|
||||
proto.RegisterType((*ACLSyncMessage)(nil), "aclrecord.ACLSyncMessage")
|
||||
proto.RegisterType((*ACLSyncContentValue)(nil), "aclrecord.ACLSyncContentValue")
|
||||
proto.RegisterType((*ACLAddRecords)(nil), "aclrecord.ACLAddRecords")
|
||||
}
|
||||
|
||||
func init() {
|
||||
@ -1019,61 +1202,67 @@ func init() {
|
||||
}
|
||||
|
||||
var fileDescriptor_14abe0d1b4206d54 = []byte{
|
||||
// 859 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4f, 0x6f, 0x1b, 0x45,
|
||||
0x14, 0xdf, 0x59, 0x3b, 0x71, 0xf6, 0xd9, 0x6d, 0xdc, 0x11, 0xa4, 0xab, 0xa8, 0x58, 0xd6, 0x8a,
|
||||
0x83, 0x55, 0x81, 0x0b, 0x06, 0xa9, 0x28, 0x07, 0x90, 0x6b, 0x5a, 0xd9, 0x24, 0x87, 0x6a, 0x02,
|
||||
0x14, 0x71, 0x9b, 0xee, 0x8e, 0x92, 0x51, 0xed, 0xdd, 0xd5, 0xec, 0xd8, 0xc8, 0x47, 0xce, 0x5c,
|
||||
0xe0, 0x23, 0xf0, 0x41, 0x38, 0x71, 0xe1, 0xd8, 0x0b, 0x12, 0x47, 0x94, 0x7c, 0x01, 0xee, 0x5c,
|
||||
0xd0, 0xcc, 0xfe, 0xdf, 0xb5, 0x2d, 0x2a, 0x59, 0x3d, 0x24, 0xde, 0xf7, 0xde, 0xef, 0x3d, 0xff,
|
||||
0xe6, 0xf7, 0xde, 0xbc, 0x35, 0x7c, 0x18, 0xbe, 0xba, 0x7a, 0x44, 0xdd, 0xb9, 0xfa, 0x13, 0xcc,
|
||||
0x0d, 0x84, 0x17, 0x8a, 0x40, 0x06, 0x8f, 0xf4, 0xff, 0x28, 0xf7, 0x0e, 0xb5, 0x03, 0x5b, 0x99,
|
||||
0xc3, 0x79, 0x06, 0x1d, 0x42, 0x7f, 0x18, 0x4f, 0x2e, 0x88, 0xb6, 0xb1, 0x0d, 0xad, 0x90, 0xae,
|
||||
0xe7, 0x01, 0xf5, 0x6c, 0xd4, 0x47, 0x83, 0x0e, 0x49, 0x4d, 0xfc, 0x00, 0xac, 0x88, 0x5f, 0xf9,
|
||||
0x54, 0x2e, 0x05, 0xb3, 0x4d, 0x1d, 0xcb, 0x1d, 0xce, 0xe7, 0x80, 0x8b, 0x75, 0x5e, 0x70, 0x79,
|
||||
0x3d, 0xdb, 0x55, 0xed, 0x2e, 0x98, 0xdc, 0xd3, 0x65, 0x2c, 0x62, 0x72, 0xcf, 0xf9, 0x15, 0x81,
|
||||
0x95, 0xb3, 0x38, 0x81, 0xc3, 0x50, 0xb0, 0xd5, 0x2c, 0x4e, 0xb3, 0x48, 0x62, 0xe1, 0x53, 0x38,
|
||||
0xe2, 0x1e, 0xf3, 0x25, 0x97, 0xeb, 0x84, 0x42, 0x66, 0x63, 0x0c, 0x4d, 0x8f, 0x4a, 0x6a, 0x37,
|
||||
0xb4, 0x5f, 0x3f, 0xe3, 0x21, 0x60, 0x77, 0x29, 0x04, 0xf3, 0x25, 0x61, 0xd4, 0x3b, 0x67, 0xeb,
|
||||
0x29, 0x8d, 0xae, 0xed, 0x66, 0x1f, 0x0d, 0x9a, 0x64, 0x43, 0x44, 0x9d, 0x51, 0xf2, 0x05, 0x8b,
|
||||
0x24, 0x5d, 0x84, 0xf6, 0x41, 0x1f, 0x0d, 0x1a, 0x24, 0x77, 0x38, 0x3f, 0x99, 0xd0, 0x52, 0x1c,
|
||||
0x83, 0x40, 0x96, 0x98, 0xa0, 0x0a, 0x93, 0xf7, 0xe1, 0x0e, 0xf3, 0x5d, 0x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 0x7c, 0x99, 0xe8, 0x9a, 0x4f, 0x3e, 0xfa, 0xe3, 0xa6, 0x87, 0x5e,
|
||||
0xdf, 0xf4, 0xd0, 0xdf, 0x37, 0x3d, 0xf4, 0xf3, 0x6d, 0xcf, 0x78, 0x7d, 0xdb, 0x33, 0xfe, 0xba,
|
||||
0xed, 0x19, 0xdf, 0x9f, 0x6c, 0xfe, 0x85, 0xf7, 0xf2, 0x50, 0x7f, 0x7c, 0xf2, 0x5f, 0x00, 0x00,
|
||||
0x00, 0xff, 0xff, 0x0d, 0xd2, 0xee, 0x14, 0x02, 0x0a, 0x00, 0x00,
|
||||
// 959 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xcf, 0x6f, 0x1b, 0x45,
|
||||
0x14, 0xf6, 0xac, 0x9d, 0x38, 0x7e, 0x76, 0x13, 0x67, 0x80, 0xd4, 0x8a, 0x8a, 0x15, 0xad, 0x38,
|
||||
0x44, 0x55, 0x71, 0xc1, 0x20, 0xa5, 0xca, 0x05, 0xb9, 0xa6, 0x95, 0xdd, 0x04, 0xa9, 0x9a, 0x00,
|
||||
0x45, 0xbd, 0x4d, 0x77, 0x47, 0xc9, 0xa8, 0xf6, 0xee, 0x6a, 0x66, 0x6c, 0xe4, 0x23, 0x67, 0x2e,
|
||||
0x70, 0xe3, 0xca, 0x1f, 0xc2, 0x89, 0x0b, 0xc7, 0x5e, 0x90, 0x38, 0xa2, 0xe4, 0x1f, 0xe0, 0xce,
|
||||
0x05, 0xcd, 0xcc, 0xfe, 0x5e, 0x27, 0xa2, 0x52, 0xd4, 0x43, 0xe2, 0x9d, 0xf7, 0xbe, 0x79, 0xfb,
|
||||
0xbd, 0xef, 0xbd, 0x79, 0xb3, 0xf0, 0x71, 0xf4, 0xfa, 0xfc, 0x21, 0xf5, 0x66, 0xfa, 0x4f, 0x30,
|
||||
0x2f, 0x14, 0x7e, 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
0x34, 0x58, 0x72, 0x65, 0xbb, 0x76, 0x2d, 0x2b, 0xeb, 0x4f, 0x58, 0xd9, 0x15, 0xfe, 0x1c, 0xb6,
|
||||
0xf4, 0xea, 0x59, 0xc8, 0x03, 0x53, 0x8a, 0xf6, 0x70, 0xaf, 0xba, 0x53, 0x7b, 0x27, 0x35, 0x92,
|
||||
0x22, 0x1f, 0x37, 0x61, 0x63, 0xa9, 0x35, 0x74, 0x9f, 0x98, 0x26, 0xfb, 0x52, 0xb7, 0xef, 0x31,
|
||||
0x00, 0xf5, 0x66, 0xb1, 0xc2, 0x3d, 0x74, 0x50, 0x3f, 0x6c, 0x0f, 0xf7, 0x8b, 0xb1, 0xf2, 0xf2,
|
||||
0x93, 0x1c, 0xda, 0xfd, 0x17, 0xc1, 0xd6, 0x68, 0x7c, 0x7a, 0xa6, 0xa8, 0x62, 0xba, 0x23, 0x45,
|
||||
0x56, 0x58, 0x26, 0x4d, 0xac, 0x06, 0x29, 0x1a, 0xf1, 0x91, 0x4d, 0xda, 0x6c, 0x91, 0x3d, 0xc7,
|
||||
0xbc, 0xee, 0x6e, 0x95, 0xba, 0xf1, 0x93, 0x1c, 0x14, 0x1f, 0x43, 0x93, 0x9b, 0xdc, 0x65, 0xaf,
|
||||
0x6e, 0x76, 0x1d, 0x14, 0x77, 0x19, 0xd8, 0xc0, 0xca, 0x23, 0x9f, 0x04, 0x4a, 0xac, 0x48, 0xb2,
|
||||
0x61, 0xff, 0x6b, 0xe8, 0xe4, 0x1d, 0xb8, 0x0b, 0xf5, 0xd7, 0x6c, 0x15, 0x9f, 0x7b, 0xfd, 0x88,
|
||||
0x07, 0xb1, 0x32, 0xd7, 0x37, 0x87, 0x0d, 0x40, 0x2c, 0xec, 0xd8, 0x79, 0x84, 0xdc, 0x9f, 0x11,
|
||||
0x74, 0xf2, 0x74, 0x6f, 0xe1, 0xbc, 0x7e, 0x01, 0xed, 0x28, 0x6d, 0x13, 0x69, 0x7a, 0x6c, 0x7b,
|
||||
0xf8, 0xe1, 0x4d, 0x3d, 0x26, 0x49, 0x7e, 0x87, 0xfb, 0x1b, 0x02, 0xc8, 0xce, 0xc0, 0x2d, 0x30,
|
||||
0x7a, 0x00, 0xbb, 0xe5, 0x79, 0x60, 0x0b, 0xd0, 0x21, 0x55, 0x47, 0x99, 0x7f, 0xe3, 0xad, 0xf9,
|
||||
0xff, 0x83, 0xe0, 0x4e, 0x41, 0x70, 0x7c, 0x08, 0x3b, 0x76, 0x92, 0x3f, 0x5f, 0xbc, 0x9a, 0x71,
|
||||
0xef, 0x84, 0x25, 0x99, 0x94, 0xcd, 0xb9, 0x91, 0x96, 0x41, 0x9d, 0xc2, 0x48, 0xcb, 0xb0, 0xef,
|
||||
0x36, 0x2d, 0x53, 0x07, 0x93, 0xce, 0xd4, 0x8f, 0x27, 0x67, 0xba, 0x76, 0x7f, 0x47, 0xd0, 0xce,
|
||||
0x1d, 0xd8, 0x5b, 0xa8, 0x59, 0x2a, 0x59, 0x76, 0x27, 0xd6, 0xf3, 0x92, 0xa5, 0xe6, 0x02, 0xaf,
|
||||
0x46, 0x91, 0xd7, 0x7a, 0x89, 0x36, 0xae, 0x91, 0xc8, 0x95, 0x69, 0xdd, 0xe2, 0xb9, 0x79, 0x53,
|
||||
0x1a, 0x4f, 0x61, 0x27, 0x9e, 0x0a, 0x84, 0x45, 0x33, 0xea, 0xa5, 0x67, 0xfa, 0x5e, 0x51, 0x53,
|
||||
0x52, 0x00, 0x91, 0xf2, 0x26, 0xf7, 0x07, 0x04, 0xbb, 0x15, 0xd8, 0x2d, 0x08, 0xb8, 0xee, 0x72,
|
||||
0xac, 0xaf, 0xbf, 0x1c, 0xdd, 0x25, 0xdc, 0xbd, 0x66, 0xf0, 0xdf, 0x48, 0xa4, 0xd4, 0x52, 0xce,
|
||||
0x5b, 0x9f, 0x94, 0x67, 0xb0, 0xad, 0xa7, 0xde, 0x2a, 0xf0, 0xbe, 0x62, 0x52, 0xd2, 0x73, 0x86,
|
||||
0x1f, 0x41, 0xd3, 0x8b, 0xc7, 0xb8, 0x9d, 0x62, 0xfd, 0xd2, 0x84, 0x5c, 0x05, 0x5e, 0x61, 0x94,
|
||||
0x27, 0x70, 0xf7, 0x25, 0xbc, 0xb7, 0xc6, 0x6f, 0xae, 0x06, 0xdf, 0xb7, 0x9f, 0x4b, 0x32, 0xbe,
|
||||
0x6c, 0x4b, 0x93, 0x71, 0x94, 0xfa, 0xf5, 0x05, 0x95, 0xa1, 0xb3, 0xab, 0x66, 0x62, 0x1a, 0x23,
|
||||
0xc3, 0xe1, 0x23, 0x68, 0x8a, 0x34, 0xa4, 0x2e, 0x7a, 0x3e, 0xeb, 0xea, 0x97, 0x23, 0x49, 0xd0,
|
||||
0xf7, 0x8f, 0x00, 0x57, 0x45, 0xc1, 0x2d, 0xd8, 0x18, 0xf9, 0x73, 0x1e, 0x74, 0x6b, 0x18, 0x60,
|
||||
0xf3, 0x85, 0xe0, 0x8a, 0x89, 0x2e, 0xd2, 0xcf, 0xba, 0x42, 0x4c, 0x74, 0x9d, 0xc7, 0x9f, 0xfc,
|
||||
0x71, 0xd9, 0x47, 0x6f, 0x2e, 0xfb, 0xe8, 0xef, 0xcb, 0x3e, 0xfa, 0xe9, 0xaa, 0x5f, 0x7b, 0x73,
|
||||
0xd5, 0xaf, 0xfd, 0x75, 0xd5, 0xaf, 0xbd, 0xdc, 0x5b, 0xff, 0xb9, 0xfc, 0x6a, 0xd3, 0xfc, 0x7c,
|
||||
0xf6, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x04, 0x6d, 0x2c, 0x1d, 0x4f, 0x0b, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *RawACLRecord) Marshal() (dAtA []byte, err error) {
|
||||
@ -1133,6 +1322,20 @@ func (m *RawACLRecordWithId) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.AcceptorSignature) > 0 {
|
||||
i -= len(m.AcceptorSignature)
|
||||
copy(dAtA[i:], m.AcceptorSignature)
|
||||
i = encodeVarintAclrecord(dAtA, i, uint64(len(m.AcceptorSignature)))
|
||||
i--
|
||||
dAtA[i] = 0x22
|
||||
}
|
||||
if len(m.AcceptorIdentity) > 0 {
|
||||
i -= len(m.AcceptorIdentity)
|
||||
copy(dAtA[i:], m.AcceptorIdentity)
|
||||
i = encodeVarintAclrecord(dAtA, i, uint64(len(m.AcceptorIdentity)))
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
if len(m.Id) > 0 {
|
||||
i -= len(m.Id)
|
||||
copy(dAtA[i:], m.Id)
|
||||
@ -1861,6 +2064,131 @@ func (m *ACLUserPermissionChange) MarshalToSizedBuffer(dAtA []byte) (int, error)
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *ACLSyncMessage) 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 *ACLSyncMessage) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *ACLSyncMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.Content != nil {
|
||||
{
|
||||
size, err := m.Content.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintAclrecord(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *ACLSyncContentValue) 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 *ACLSyncContentValue) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *ACLSyncContentValue) 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 *ACLSyncContentValue_AddRecords) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *ACLSyncContentValue_AddRecords) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
if m.AddRecords != nil {
|
||||
{
|
||||
size, err := m.AddRecords.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintAclrecord(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
func (m *ACLAddRecords) 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 *ACLAddRecords) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *ACLAddRecords) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Records) > 0 {
|
||||
for iNdEx := len(m.Records) - 1; iNdEx >= 0; iNdEx-- {
|
||||
{
|
||||
size, err := m.Records[iNdEx].MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintAclrecord(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func encodeVarintAclrecord(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovAclrecord(v)
|
||||
base := offset
|
||||
@ -1903,6 +2231,14 @@ func (m *RawACLRecordWithId) Size() (n int) {
|
||||
if l > 0 {
|
||||
n += 1 + l + sovAclrecord(uint64(l))
|
||||
}
|
||||
l = len(m.AcceptorIdentity)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovAclrecord(uint64(l))
|
||||
}
|
||||
l = len(m.AcceptorSignature)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovAclrecord(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
@ -2253,6 +2589,58 @@ func (m *ACLUserPermissionChange) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *ACLSyncMessage) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.Content != nil {
|
||||
l = m.Content.Size()
|
||||
n += 1 + l + sovAclrecord(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *ACLSyncContentValue) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.Value != nil {
|
||||
n += m.Value.Size()
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *ACLSyncContentValue_AddRecords) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.AddRecords != nil {
|
||||
l = m.AddRecords.Size()
|
||||
n += 1 + l + sovAclrecord(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
func (m *ACLAddRecords) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Records) > 0 {
|
||||
for _, e := range m.Records {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovAclrecord(uint64(l))
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovAclrecord(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
@ -2472,6 +2860,74 @@ func (m *RawACLRecordWithId) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
m.Id = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field AcceptorIdentity", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowAclrecord
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
return ErrInvalidLengthAclrecord
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthAclrecord
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.AcceptorIdentity = append(m.AcceptorIdentity[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.AcceptorIdentity == nil {
|
||||
m.AcceptorIdentity = []byte{}
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 4:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field AcceptorSignature", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowAclrecord
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
return ErrInvalidLengthAclrecord
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthAclrecord
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.AcceptorSignature = append(m.AcceptorSignature[:0], dAtA[iNdEx:postIndex]...)
|
||||
if m.AcceptorSignature == nil {
|
||||
m.AcceptorSignature = []byte{}
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipAclrecord(dAtA[iNdEx:])
|
||||
@ -4629,6 +5085,261 @@ func (m *ACLUserPermissionChange) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *ACLSyncMessage) 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 ErrIntOverflowAclrecord
|
||||
}
|
||||
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: ACLSyncMessage: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: ACLSyncMessage: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
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 ErrIntOverflowAclrecord
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthAclrecord
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthAclrecord
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
if m.Content == nil {
|
||||
m.Content = &ACLSyncContentValue{}
|
||||
}
|
||||
if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipAclrecord(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthAclrecord
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *ACLSyncContentValue) 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 ErrIntOverflowAclrecord
|
||||
}
|
||||
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: ACLSyncContentValue: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: ACLSyncContentValue: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field AddRecords", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowAclrecord
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthAclrecord
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthAclrecord
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
v := &ACLAddRecords{}
|
||||
if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
m.Value = &ACLSyncContentValue_AddRecords{v}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipAclrecord(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthAclrecord
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *ACLAddRecords) 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 ErrIntOverflowAclrecord
|
||||
}
|
||||
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: ACLAddRecords: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: ACLAddRecords: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Records", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowAclrecord
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthAclrecord
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthAclrecord
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Records = append(m.Records, &RawACLRecordWithId{})
|
||||
if err := m.Records[len(m.Records)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipAclrecord(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return ErrInvalidLengthAclrecord
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipAclrecord(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
|
||||
@ -3,64 +3,66 @@ package aclrecord;
|
||||
option go_package = "pkg/acl/aclrecordproto";
|
||||
|
||||
message RawACLRecord {
|
||||
bytes payload = 1;
|
||||
bytes signature = 2;
|
||||
bytes payload = 1;
|
||||
bytes signature = 2;
|
||||
}
|
||||
|
||||
message RawACLRecordWithId {
|
||||
bytes payload = 1;
|
||||
string id = 2;
|
||||
bytes payload = 1;
|
||||
string id = 2;
|
||||
bytes acceptorIdentity = 3;
|
||||
bytes acceptorSignature = 4;
|
||||
}
|
||||
|
||||
message ACLRecord {
|
||||
string prevId = 1;
|
||||
bytes identity = 2;
|
||||
bytes data = 3;
|
||||
uint64 currentReadKeyHash = 4;
|
||||
int64 timestamp = 5;
|
||||
string prevId = 1;
|
||||
bytes identity = 2;
|
||||
bytes data = 3;
|
||||
uint64 currentReadKeyHash = 4;
|
||||
int64 timestamp = 5;
|
||||
}
|
||||
|
||||
message ACLRoot {
|
||||
bytes identity = 1;
|
||||
bytes encryptionKey = 2;
|
||||
string spaceId = 3;
|
||||
bytes encryptedReadKey = 4;
|
||||
string derivationScheme = 5;
|
||||
uint64 currentReadKeyHash = 6;
|
||||
int64 timestamp = 7;
|
||||
bytes identity = 1;
|
||||
bytes encryptionKey = 2;
|
||||
string spaceId = 3;
|
||||
bytes encryptedReadKey = 4;
|
||||
string derivationScheme = 5;
|
||||
uint64 currentReadKeyHash = 6;
|
||||
int64 timestamp = 7;
|
||||
}
|
||||
|
||||
message ACLContentValue {
|
||||
oneof value {
|
||||
ACLUserAdd userAdd = 1;
|
||||
ACLUserRemove userRemove = 2;
|
||||
ACLUserPermissionChange userPermissionChange = 3;
|
||||
ACLUserInvite userInvite = 4;
|
||||
ACLUserJoin userJoin = 5;
|
||||
}
|
||||
oneof value {
|
||||
ACLUserAdd userAdd = 1;
|
||||
ACLUserRemove userRemove = 2;
|
||||
ACLUserPermissionChange userPermissionChange = 3;
|
||||
ACLUserInvite userInvite = 4;
|
||||
ACLUserJoin userJoin = 5;
|
||||
}
|
||||
}
|
||||
|
||||
message ACLData {
|
||||
repeated ACLContentValue aclContent = 1;
|
||||
repeated ACLContentValue aclContent = 1;
|
||||
}
|
||||
|
||||
message ACLState {
|
||||
repeated uint64 readKeyHashes = 1;
|
||||
repeated ACLUserState userStates = 2;
|
||||
map<string, ACLUserInvite> invites = 3;
|
||||
repeated uint64 readKeyHashes = 1;
|
||||
repeated ACLUserState userStates = 2;
|
||||
map<string, ACLUserInvite> invites = 3;
|
||||
}
|
||||
|
||||
message ACLUserState {
|
||||
bytes identity = 1;
|
||||
bytes encryptionKey = 2;
|
||||
ACLUserPermissions permissions = 3;
|
||||
bytes identity = 1;
|
||||
bytes encryptionKey = 2;
|
||||
ACLUserPermissions permissions = 3;
|
||||
}
|
||||
|
||||
message ACLUserAdd {
|
||||
bytes identity = 1;
|
||||
bytes encryptionKey = 2;
|
||||
repeated bytes encryptedReadKeys = 3;
|
||||
ACLUserPermissions permissions = 4;
|
||||
bytes identity = 1;
|
||||
bytes encryptionKey = 2;
|
||||
repeated bytes encryptedReadKeys = 3;
|
||||
ACLUserPermissions permissions = 4;
|
||||
}
|
||||
|
||||
// accept key, encrypt key, invite id
|
||||
@ -68,41 +70,57 @@ message ACLUserAdd {
|
||||
// Join(ACLJoinRecord) -> Ok
|
||||
|
||||
message ACLUserInvite {
|
||||
bytes acceptPublicKey = 1;
|
||||
// TODO: change to read key
|
||||
bytes encryptPublicKey = 2;
|
||||
repeated bytes encryptedReadKeys = 3;
|
||||
ACLUserPermissions permissions = 4;
|
||||
// TODO: either derive inviteId from pub keys or think if it is possible to just use ACL record id
|
||||
string inviteId = 5;
|
||||
bytes acceptPublicKey = 1;
|
||||
// TODO: change to read key
|
||||
bytes encryptPublicKey = 2;
|
||||
repeated bytes encryptedReadKeys = 3;
|
||||
ACLUserPermissions permissions = 4;
|
||||
// TODO: either derive inviteId from pub keys or think if it is possible to just use ACL record id
|
||||
string inviteId = 5;
|
||||
}
|
||||
|
||||
message ACLUserJoin {
|
||||
bytes identity = 1;
|
||||
bytes encryptionKey = 2;
|
||||
bytes acceptSignature = 3;
|
||||
string inviteId = 4;
|
||||
repeated bytes encryptedReadKeys = 5;
|
||||
bytes identity = 1;
|
||||
bytes encryptionKey = 2;
|
||||
bytes acceptSignature = 3;
|
||||
string inviteId = 4;
|
||||
repeated bytes encryptedReadKeys = 5;
|
||||
}
|
||||
|
||||
message ACLUserRemove {
|
||||
bytes identity = 1;
|
||||
repeated ACLReadKeyReplace readKeyReplaces = 3;
|
||||
bytes identity = 1;
|
||||
repeated ACLReadKeyReplace readKeyReplaces = 3;
|
||||
}
|
||||
|
||||
message ACLReadKeyReplace {
|
||||
bytes identity = 1;
|
||||
bytes encryptionKey = 2;
|
||||
bytes encryptedReadKey = 3;
|
||||
bytes identity = 1;
|
||||
bytes encryptionKey = 2;
|
||||
bytes encryptedReadKey = 3;
|
||||
}
|
||||
|
||||
message ACLUserPermissionChange {
|
||||
bytes identity = 1;
|
||||
ACLUserPermissions permissions = 2;
|
||||
bytes identity = 1;
|
||||
ACLUserPermissions permissions = 2;
|
||||
}
|
||||
|
||||
enum ACLUserPermissions {
|
||||
Admin = 0;
|
||||
Writer = 1;
|
||||
Reader = 2;
|
||||
Admin = 0;
|
||||
Writer = 1;
|
||||
Reader = 2;
|
||||
}
|
||||
|
||||
|
||||
message ACLSyncMessage {
|
||||
ACLSyncContentValue content = 2;
|
||||
}
|
||||
|
||||
// ACLSyncContentValue provides different types for acl sync
|
||||
message ACLSyncContentValue {
|
||||
oneof value {
|
||||
ACLAddRecords addRecords = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ACLAddRecords {
|
||||
repeated RawACLRecordWithId records = 1;
|
||||
}
|
||||
@ -50,20 +50,12 @@ type aclList struct {
|
||||
}
|
||||
|
||||
func BuildACLListWithIdentity(acc *account.AccountData, storage storage.ListStorage) (ACLList, error) {
|
||||
id, err := storage.ID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
builder := newACLStateBuilderWithIdentity(acc)
|
||||
return build(id, builder, newACLRecordBuilder(id, common.NewKeychain()), storage)
|
||||
return build(storage.Id(), builder, newACLRecordBuilder(storage.Id(), common.NewKeychain()), storage)
|
||||
}
|
||||
|
||||
func BuildACLList(storage storage.ListStorage) (ACLList, error) {
|
||||
id, err := storage.ID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return build(id, newACLStateBuilder(), newACLRecordBuilder(id, common.NewKeychain()), storage)
|
||||
return build(storage.Id(), newACLStateBuilder(), newACLRecordBuilder(storage.Id(), common.NewKeychain()), storage)
|
||||
}
|
||||
|
||||
func build(id string, stateBuilder *aclStateBuilder, recBuilder ACLRecordBuilder, storage storage.ListStorage) (list ACLList, err error) {
|
||||
|
||||
@ -56,10 +56,10 @@ func (i *inMemoryACLListStorage) AddRawRecord(ctx context.Context, rec *aclrecor
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (i *inMemoryACLListStorage) ID() (string, error) {
|
||||
func (i *inMemoryACLListStorage) Id() string {
|
||||
i.RLock()
|
||||
defer i.RUnlock()
|
||||
return i.id, nil
|
||||
return i.id
|
||||
}
|
||||
|
||||
type inMemoryTreeStorage struct {
|
||||
@ -96,10 +96,10 @@ func (t *inMemoryTreeStorage) HasChange(ctx context.Context, id string) (bool, e
|
||||
return exists, nil
|
||||
}
|
||||
|
||||
func (t *inMemoryTreeStorage) ID() (string, error) {
|
||||
func (t *inMemoryTreeStorage) Id() string {
|
||||
t.RLock()
|
||||
defer t.RUnlock()
|
||||
return t.id, nil
|
||||
return t.id
|
||||
}
|
||||
|
||||
func (t *inMemoryTreeStorage) Root() (*treechangeproto.RawTreeChangeWithId, error) {
|
||||
|
||||
@ -12,7 +12,7 @@ var ErrACLExists = errors.New("acl already exists")
|
||||
var ErrUnknownRecord = errors.New("record doesn't exist")
|
||||
|
||||
type ListStorage interface {
|
||||
Storage
|
||||
Id() string
|
||||
Root() (*aclrecordproto.RawACLRecordWithId, error)
|
||||
Head() (string, error)
|
||||
SetHead(headId string) error
|
||||
|
||||
@ -80,19 +80,18 @@ func (mr *MockListStorageMockRecorder) Head() *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Head", reflect.TypeOf((*MockListStorage)(nil).Head))
|
||||
}
|
||||
|
||||
// ID mocks base method.
|
||||
func (m *MockListStorage) ID() (string, error) {
|
||||
// Id mocks base method.
|
||||
func (m *MockListStorage) Id() string {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ID")
|
||||
ret := m.ctrl.Call(m, "Id")
|
||||
ret0, _ := ret[0].(string)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
return ret0
|
||||
}
|
||||
|
||||
// ID indicates an expected call of ID.
|
||||
func (mr *MockListStorageMockRecorder) ID() *gomock.Call {
|
||||
// Id indicates an expected call of Id.
|
||||
func (mr *MockListStorageMockRecorder) Id() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ID", reflect.TypeOf((*MockListStorage)(nil).ID))
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Id", reflect.TypeOf((*MockListStorage)(nil).Id))
|
||||
}
|
||||
|
||||
// Root mocks base method.
|
||||
@ -206,19 +205,18 @@ func (mr *MockTreeStorageMockRecorder) Heads() *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Heads", reflect.TypeOf((*MockTreeStorage)(nil).Heads))
|
||||
}
|
||||
|
||||
// ID mocks base method.
|
||||
func (m *MockTreeStorage) ID() (string, error) {
|
||||
// Id mocks base method.
|
||||
func (m *MockTreeStorage) Id() string {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "ID")
|
||||
ret := m.ctrl.Call(m, "Id")
|
||||
ret0, _ := ret[0].(string)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
return ret0
|
||||
}
|
||||
|
||||
// ID indicates an expected call of ID.
|
||||
func (mr *MockTreeStorageMockRecorder) ID() *gomock.Call {
|
||||
// Id indicates an expected call of Id.
|
||||
func (mr *MockTreeStorageMockRecorder) Id() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ID", reflect.TypeOf((*MockTreeStorage)(nil).ID))
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Id", reflect.TypeOf((*MockTreeStorage)(nil).Id))
|
||||
}
|
||||
|
||||
// Root mocks base method.
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
package storage
|
||||
|
||||
type Storage interface {
|
||||
ID() (string, error)
|
||||
}
|
||||
@ -6,7 +6,7 @@ import (
|
||||
)
|
||||
|
||||
type TreeStorage interface {
|
||||
Storage
|
||||
Id() string
|
||||
Root() (*treechangeproto.RawTreeChangeWithId, error)
|
||||
Heads() ([]string, error)
|
||||
SetHeads(heads []string) error
|
||||
|
||||
@ -120,8 +120,8 @@ func (t *ACLListStorageBuilder) AddRawRecord(ctx context.Context, rec *aclrecord
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (t *ACLListStorageBuilder) ID() (string, error) {
|
||||
return t.id, nil
|
||||
func (t *ACLListStorageBuilder) Id() string {
|
||||
return t.id
|
||||
}
|
||||
|
||||
func (t *ACLListStorageBuilder) GetRawRecords() []*aclrecordproto2.RawACLRecordWithId {
|
||||
|
||||
@ -127,10 +127,7 @@ func buildObjectTree(deps objectTreeDeps) (ObjectTree, error) {
|
||||
}
|
||||
}
|
||||
|
||||
objTree.id, err = objTree.treeStorage.ID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
objTree.id = objTree.treeStorage.Id()
|
||||
|
||||
objTree.root, err = objTree.treeStorage.Root()
|
||||
if err != nil {
|
||||
|
||||
111
node/acl/service.go
Normal file
111
node/acl/service.go
Normal file
@ -0,0 +1,111 @@
|
||||
package acl
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/account"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/logger"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/syncservice/synchandler"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/aclrecordproto"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/consensus/consensusclient"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/consensus/consensusproto"
|
||||
"time"
|
||||
)
|
||||
|
||||
const CName = "node.acl"
|
||||
|
||||
var log = logger.NewNamed(CName)
|
||||
|
||||
type Service interface {
|
||||
app.Component
|
||||
}
|
||||
|
||||
type service struct {
|
||||
consService consensusclient.Service
|
||||
account account.Service
|
||||
}
|
||||
|
||||
func (s *service) Init(a *app.App) (err error) {
|
||||
s.consService = a.MustComponent(consensusclient.CName).(consensusclient.Service)
|
||||
s.account = a.MustComponent(account.CName).(account.Service)
|
||||
return
|
||||
}
|
||||
|
||||
func (s *service) Name() (name string) {
|
||||
return CName
|
||||
}
|
||||
|
||||
func (s *service) CreateLog(ctx context.Context, aclId string, rec *aclrecordproto.RawACLRecordWithId) (err error) {
|
||||
logId, err := cidToByte(aclId)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
recId, err := cidToByte(rec.Id)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
acc := s.account.Account()
|
||||
rec.AcceptorIdentity = acc.Identity
|
||||
if rec.AcceptorSignature, err = acc.SignKey.Sign(rec.Payload); err != nil {
|
||||
return
|
||||
}
|
||||
recPayload, err := rec.Marshal()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return s.consService.AddLog(ctx, &consensusproto.Log{
|
||||
Id: logId,
|
||||
Records: []*consensusproto.Record{
|
||||
{
|
||||
Id: recId,
|
||||
Payload: recPayload,
|
||||
CreatedUnix: uint64(time.Now().Unix()),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func (s *service) AddRecord(ctx context.Context, aclId string, rec *aclrecordproto.RawACLRecordWithId) (err error) {
|
||||
logId, err := cidToByte(aclId)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
recId, err := cidToByte(rec.Id)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
acc := s.account.Account()
|
||||
rec.AcceptorIdentity = acc.Identity
|
||||
if rec.AcceptorSignature, err = acc.SignKey.Sign(rec.Payload); err != nil {
|
||||
return
|
||||
}
|
||||
recPayload, err := rec.Marshal()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return s.consService.AddRecord(ctx, logId, &consensusproto.Record{
|
||||
Id: recId,
|
||||
PrevId: nil, //TODO:
|
||||
Payload: recPayload,
|
||||
CreatedUnix: uint64(time.Now().Unix()),
|
||||
})
|
||||
}
|
||||
|
||||
func (s *service) Watch(ctx context.Context, spaceId, aclId string, h synchandler.SyncHandler) (err error) {
|
||||
w, err := newWatcher(spaceId, aclId, h)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if err = s.consService.Watch(w.logId, w); err != nil {
|
||||
return err
|
||||
}
|
||||
return w.Ready(ctx)
|
||||
}
|
||||
|
||||
func (s *service) UnWatch(aclId string) (err error) {
|
||||
logId, err := cidToByte(aclId)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return s.consService.UnWatch(logId)
|
||||
}
|
||||
19
node/acl/util.go
Normal file
19
node/acl/util.go
Normal file
@ -0,0 +1,19 @@
|
||||
package acl
|
||||
|
||||
import "github.com/ipfs/go-cid"
|
||||
|
||||
func cidToString(b []byte) (s string, err error) {
|
||||
rcid, err := cid.Cast(b)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return rcid.String(), nil
|
||||
}
|
||||
|
||||
func cidToByte(s string) (b []byte, err error) {
|
||||
rcid, err := cid.Decode(s)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return rcid.Bytes(), nil
|
||||
}
|
||||
16
node/acl/util_test.go
Normal file
16
node/acl/util_test.go
Normal file
@ -0,0 +1,16 @@
|
||||
package acl
|
||||
|
||||
import (
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/cid"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCIDLen(t *testing.T) {
|
||||
s, _ := cid.NewCIDFromBytes([]byte("some data"))
|
||||
t.Log(s, len(s))
|
||||
b, _ := cidToByte(s)
|
||||
t.Log(b, len(b))
|
||||
s2, _ := cidToString(b)
|
||||
assert.Equal(t, s, s2)
|
||||
}
|
||||
93
node/acl/watcher.go
Normal file
93
node/acl/watcher.go
Normal file
@ -0,0 +1,93 @@
|
||||
package acl
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/syncservice/synchandler"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/aclrecordproto"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/consensus/consensusproto"
|
||||
"go.uber.org/zap"
|
||||
"sync"
|
||||
)
|
||||
|
||||
func newWatcher(spaceId, aclId string, h synchandler.SyncHandler) (w *watcher, err error) {
|
||||
w = &watcher{
|
||||
aclId: aclId,
|
||||
spaceId: spaceId,
|
||||
handler: h,
|
||||
ready: make(chan struct{}),
|
||||
}
|
||||
if w.logId, err = cidToByte(aclId); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type watcher struct {
|
||||
spaceId string
|
||||
aclId string
|
||||
logId []byte
|
||||
handler synchandler.SyncHandler
|
||||
ready chan struct{}
|
||||
isReady sync.Once
|
||||
err error
|
||||
}
|
||||
|
||||
func (w *watcher) AddConsensusRecords(recs []*consensusproto.Record) {
|
||||
w.isReady.Do(func() {
|
||||
close(w.ready)
|
||||
})
|
||||
records := make([]*aclrecordproto.RawACLRecordWithId, 0, len(recs))
|
||||
|
||||
for _, rec := range recs {
|
||||
recId, err := cidToString(rec.Id)
|
||||
if err != nil {
|
||||
log.Error("received invalid id from consensus node", zap.Error(err))
|
||||
continue
|
||||
}
|
||||
records = append(records, &aclrecordproto.RawACLRecordWithId{
|
||||
Payload: rec.Payload,
|
||||
Id: recId,
|
||||
})
|
||||
}
|
||||
|
||||
aclReq := &aclrecordproto.ACLSyncMessage{
|
||||
Content: &aclrecordproto.ACLSyncContentValue{
|
||||
Value: &aclrecordproto.ACLSyncContentValue_AddRecords{
|
||||
AddRecords: &aclrecordproto.ACLAddRecords{
|
||||
Records: records,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
payload, err := aclReq.Marshal()
|
||||
if err != nil {
|
||||
log.Error("acl payload marshal error", zap.Error(err))
|
||||
return
|
||||
}
|
||||
req := &spacesyncproto.ObjectSyncMessage{
|
||||
SpaceId: w.spaceId,
|
||||
Payload: payload,
|
||||
ObjectId: w.aclId,
|
||||
}
|
||||
|
||||
if err = w.handler.HandleMessage(context.TODO(), "", req); err != nil {
|
||||
log.Warn("handle message error", zap.Error(err))
|
||||
}
|
||||
}
|
||||
|
||||
func (w *watcher) AddConsensusError(err error) {
|
||||
w.isReady.Do(func() {
|
||||
w.err = err
|
||||
close(w.ready)
|
||||
})
|
||||
}
|
||||
|
||||
func (w *watcher) Ready(ctx context.Context) (err error) {
|
||||
select {
|
||||
case <-w.ready:
|
||||
return w.err
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
}
|
||||
}
|
||||
@ -82,8 +82,8 @@ func createListStorage(db *pogreb.DB, root *aclrecordproto.RawACLRecordWithId) (
|
||||
return
|
||||
}
|
||||
|
||||
func (l *listStorage) ID() (string, error) {
|
||||
return l.id, nil
|
||||
func (l *listStorage) Id() string {
|
||||
return l.id
|
||||
}
|
||||
|
||||
func (l *listStorage) Root() (*aclrecordproto.RawACLRecordWithId, error) {
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/logger"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto"
|
||||
spacestorage "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/storage"
|
||||
storage2 "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage"
|
||||
storage "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage"
|
||||
"go.uber.org/zap"
|
||||
"path"
|
||||
"sync"
|
||||
@ -22,7 +22,7 @@ type spaceStorage struct {
|
||||
spaceId string
|
||||
objDb *pogreb.DB
|
||||
keys spaceKeys
|
||||
aclStorage storage2.ListStorage
|
||||
aclStorage storage.ListStorage
|
||||
header *spacesyncproto.RawSpaceHeaderWithId
|
||||
mx sync.Mutex
|
||||
}
|
||||
@ -129,15 +129,15 @@ func createSpaceStorage(rootPath string, payload spacestorage.SpaceStorageCreate
|
||||
return
|
||||
}
|
||||
|
||||
func (s *spaceStorage) ID() (string, error) {
|
||||
return s.spaceId, nil
|
||||
func (s *spaceStorage) Id() string {
|
||||
return s.spaceId
|
||||
}
|
||||
|
||||
func (s *spaceStorage) TreeStorage(id string) (storage2.TreeStorage, error) {
|
||||
func (s *spaceStorage) TreeStorage(id string) (storage.TreeStorage, error) {
|
||||
return newTreeStorage(s.objDb, id)
|
||||
}
|
||||
|
||||
func (s *spaceStorage) CreateTreeStorage(payload storage2.TreeStorageCreatePayload) (ts storage2.TreeStorage, err error) {
|
||||
func (s *spaceStorage) CreateTreeStorage(payload storage.TreeStorageCreatePayload) (ts storage.TreeStorage, err error) {
|
||||
// we have mutex here, so we prevent overwriting the heads of a tree on concurrent creation
|
||||
s.mx.Lock()
|
||||
defer s.mx.Unlock()
|
||||
@ -145,7 +145,7 @@ func (s *spaceStorage) CreateTreeStorage(payload storage2.TreeStorageCreatePaylo
|
||||
return createTreeStorage(s.objDb, payload)
|
||||
}
|
||||
|
||||
func (s *spaceStorage) ACLStorage() (storage2.ListStorage, error) {
|
||||
func (s *spaceStorage) ACLStorage() (storage.ListStorage, error) {
|
||||
return s.aclStorage, nil
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ package storage
|
||||
import (
|
||||
"context"
|
||||
"github.com/akrylysov/pogreb"
|
||||
storage2 "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/treechangeproto"
|
||||
)
|
||||
|
||||
@ -14,14 +14,14 @@ type treeStorage struct {
|
||||
root *treechangeproto.RawTreeChangeWithId
|
||||
}
|
||||
|
||||
func newTreeStorage(db *pogreb.DB, treeId string) (ts storage2.TreeStorage, err error) {
|
||||
func newTreeStorage(db *pogreb.DB, treeId string) (ts storage.TreeStorage, err error) {
|
||||
keys := newTreeKeys(treeId)
|
||||
heads, err := db.Get(keys.HeadsKey())
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if heads == nil {
|
||||
err = storage2.ErrUnknownTreeId
|
||||
err = storage.ErrUnknownTreeId
|
||||
return
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ func newTreeStorage(db *pogreb.DB, treeId string) (ts storage2.TreeStorage, err
|
||||
return
|
||||
}
|
||||
if root == nil {
|
||||
err = storage2.ErrUnknownTreeId
|
||||
err = storage.ErrUnknownTreeId
|
||||
return
|
||||
}
|
||||
|
||||
@ -47,18 +47,18 @@ func newTreeStorage(db *pogreb.DB, treeId string) (ts storage2.TreeStorage, err
|
||||
return
|
||||
}
|
||||
|
||||
func createTreeStorage(db *pogreb.DB, payload storage2.TreeStorageCreatePayload) (ts storage2.TreeStorage, err error) {
|
||||
func createTreeStorage(db *pogreb.DB, payload storage.TreeStorageCreatePayload) (ts storage.TreeStorage, err error) {
|
||||
keys := newTreeKeys(payload.TreeId)
|
||||
has, err := db.Has(keys.HeadsKey())
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if has {
|
||||
err = storage2.ErrTreeExists
|
||||
err = storage.ErrTreeExists
|
||||
return
|
||||
}
|
||||
|
||||
heads := storage2.CreateHeadsPayload(payload.Heads)
|
||||
heads := storage.CreateHeadsPayload(payload.Heads)
|
||||
|
||||
for _, ch := range payload.Changes {
|
||||
err = db.Put(keys.RawChangeKey(ch.Id), ch.GetRawChange())
|
||||
@ -86,8 +86,8 @@ func createTreeStorage(db *pogreb.DB, payload storage2.TreeStorageCreatePayload)
|
||||
return
|
||||
}
|
||||
|
||||
func (t *treeStorage) ID() (string, error) {
|
||||
return t.id, nil
|
||||
func (t *treeStorage) Id() string {
|
||||
return t.id
|
||||
}
|
||||
|
||||
func (t *treeStorage) Root() (raw *treechangeproto.RawTreeChangeWithId, err error) {
|
||||
@ -100,15 +100,15 @@ func (t *treeStorage) Heads() (heads []string, err error) {
|
||||
return
|
||||
}
|
||||
if headsBytes == nil {
|
||||
err = storage2.ErrUnknownTreeId
|
||||
err = storage.ErrUnknownTreeId
|
||||
return
|
||||
}
|
||||
heads = storage2.ParseHeads(headsBytes)
|
||||
heads = storage.ParseHeads(headsBytes)
|
||||
return
|
||||
}
|
||||
|
||||
func (t *treeStorage) SetHeads(heads []string) (err error) {
|
||||
payload := storage2.CreateHeadsPayload(heads)
|
||||
payload := storage.CreateHeadsPayload(heads)
|
||||
return t.db.Put(t.keys.HeadsKey(), payload)
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ func (t *treeStorage) GetRawChange(ctx context.Context, id string) (raw *treecha
|
||||
return
|
||||
}
|
||||
if res == nil {
|
||||
err = storage2.ErrUnkownChange
|
||||
err = storage.ErrUnkownChange
|
||||
}
|
||||
|
||||
raw = &treechangeproto.RawTreeChangeWithId{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user