Add non-encrypted changes and settings document logic
This commit is contained in:
parent
d09a802487
commit
696cc37055
@ -101,3 +101,16 @@ func (c *treeCache) GetDocument(ctx context.Context, spaceId, id string) (doc te
|
||||
func (c *treeCache) GetTree(ctx context.Context, spaceId, id string) (tr tree.ObjectTree, err error) {
|
||||
return c.GetDocument(ctx, spaceId, id)
|
||||
}
|
||||
|
||||
func (c *treeCache) DeleteTree(ctx context.Context, spaceId, treeId string) (err error) {
|
||||
tr, err := c.GetTree(ctx, spaceId, treeId)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = tr.Delete()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, err = c.cache.Remove(treeId)
|
||||
return
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package commonspace
|
||||
import (
|
||||
"context"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/objectgetter"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/settingsdocument"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/syncacl"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/treegetter"
|
||||
)
|
||||
@ -11,13 +12,15 @@ type commonSpaceGetter struct {
|
||||
spaceId string
|
||||
aclList *syncacl.SyncACL
|
||||
treeGetter treegetter.TreeGetter
|
||||
settings settingsdocument.SettingsDocument
|
||||
}
|
||||
|
||||
func newCommonSpaceGetter(spaceId string, aclList *syncacl.SyncACL, treeGetter treegetter.TreeGetter) objectgetter.ObjectGetter {
|
||||
func newCommonSpaceGetter(spaceId string, aclList *syncacl.SyncACL, treeGetter treegetter.TreeGetter, settings settingsdocument.SettingsDocument) objectgetter.ObjectGetter {
|
||||
return &commonSpaceGetter{
|
||||
spaceId: spaceId,
|
||||
aclList: aclList,
|
||||
treeGetter: treeGetter,
|
||||
settings: settings,
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,6 +29,10 @@ func (c *commonSpaceGetter) GetObject(ctx context.Context, objectId string) (obj
|
||||
obj = c.aclList
|
||||
return
|
||||
}
|
||||
if c.settings.ID() == objectId {
|
||||
obj = c.settings.(objectgetter.Object)
|
||||
return
|
||||
}
|
||||
t, err := c.treeGetter.GetTree(ctx, c.spaceId, objectId)
|
||||
if err != nil {
|
||||
return
|
||||
|
||||
45
common/commonspace/settingsdocument/provider.go
Normal file
45
common/commonspace/settingsdocument/provider.go
Normal file
@ -0,0 +1,45 @@
|
||||
package settingsdocument
|
||||
|
||||
import (
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/tree"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
)
|
||||
|
||||
type deletedIdsProvider interface {
|
||||
ProvideIds(tr tree.ObjectTree, startId string) (ids []string, lastId string, err error)
|
||||
}
|
||||
|
||||
type provider struct{}
|
||||
|
||||
func (p *provider) convert(decrypted []byte) (res any, err error) {
|
||||
deleteChange := &spacesyncproto.SettingsData{}
|
||||
err = proto.Unmarshal(decrypted, deleteChange)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return deleteChange, nil
|
||||
}
|
||||
|
||||
func (p *provider) ProvideIds(tr tree.ObjectTree, startId string) (ids []string, lastId string, err error) {
|
||||
processChange := func(change *tree.Change) bool {
|
||||
// ignoring first change if startId is not ""
|
||||
if change.Id == startId {
|
||||
return true
|
||||
}
|
||||
deleteChange := change.Model.(*spacesyncproto.SettingsData)
|
||||
for _, cnt := range deleteChange.Content {
|
||||
if cnt.GetObjectDelete() != nil {
|
||||
ids = append(ids, cnt.GetObjectDelete().GetId())
|
||||
}
|
||||
}
|
||||
lastId = change.Id
|
||||
return true
|
||||
}
|
||||
if startId == "" {
|
||||
err = tr.IterateFrom(tr.ID(), p.convert, processChange)
|
||||
} else {
|
||||
err = tr.IterateFrom(startId, p.convert, processChange)
|
||||
}
|
||||
return
|
||||
}
|
||||
136
common/commonspace/settingsdocument/settingsdocument.go
Normal file
136
common/commonspace/settingsdocument/settingsdocument.go
Normal file
@ -0,0 +1,136 @@
|
||||
package settingsdocument
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/account"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto"
|
||||
spacestorage "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/storage"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/synctree/updatelistener"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/treegetter"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/tree"
|
||||
)
|
||||
|
||||
type DeletionState int
|
||||
|
||||
const (
|
||||
DeletionStateQueued DeletionState = iota
|
||||
DeletionStateDeleted
|
||||
)
|
||||
|
||||
type SettingsDocument interface {
|
||||
tree.ObjectTree
|
||||
DeleteObject(id string) (err error)
|
||||
}
|
||||
|
||||
type BuildTreeFunc func(ctx context.Context, id string, listener updatelistener.UpdateListener) (t tree.ObjectTree, err error)
|
||||
|
||||
type Deps struct {
|
||||
BuildFunc BuildTreeFunc
|
||||
Account account.Service
|
||||
TreeGetter treegetter.TreeGetter
|
||||
Store spacestorage.SpaceStorage
|
||||
prov deletedIdsProvider
|
||||
}
|
||||
|
||||
type settingsDocument struct {
|
||||
tree.ObjectTree
|
||||
account account.Service
|
||||
spaceId string
|
||||
deletionState map[string]DeletionState
|
||||
treeGetter treegetter.TreeGetter
|
||||
store spacestorage.SpaceStorage
|
||||
lastChangeId string
|
||||
prov deletedIdsProvider
|
||||
}
|
||||
|
||||
func NewSettingsDocument(ctx context.Context, deps Deps, spaceId string) (doc SettingsDocument, err error) {
|
||||
s := &settingsDocument{
|
||||
account: deps.Account,
|
||||
spaceId: spaceId,
|
||||
deletionState: map[string]DeletionState{},
|
||||
treeGetter: deps.TreeGetter,
|
||||
store: deps.Store,
|
||||
}
|
||||
s.ObjectTree, err = deps.BuildFunc(ctx, deps.Store.SpaceSettingsId(), s)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
// this is needed mainly for testing
|
||||
if deps.prov == nil {
|
||||
s.prov = &provider{}
|
||||
}
|
||||
doc = s
|
||||
return
|
||||
}
|
||||
|
||||
func (s *settingsDocument) Update(tr tree.ObjectTree) {
|
||||
ids, lastId, err := s.prov.ProvideIds(tr, s.lastChangeId)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
s.lastChangeId = lastId
|
||||
s.toBeDeleted(ids)
|
||||
}
|
||||
|
||||
func (s *settingsDocument) Rebuild(tr tree.ObjectTree) {
|
||||
ids, lastId, err := s.prov.ProvideIds(tr, "")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
s.lastChangeId = lastId
|
||||
s.toBeDeleted(ids)
|
||||
}
|
||||
|
||||
func (s *settingsDocument) Init() {
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
s.Rebuild(s)
|
||||
}
|
||||
|
||||
func (s *settingsDocument) toBeDeleted(ids []string) {
|
||||
for _, id := range ids {
|
||||
if state, exists := s.deletionState[id]; exists && state == DeletionStateDeleted {
|
||||
continue
|
||||
}
|
||||
// if not already deleted
|
||||
if _, err := s.store.TreeStorage(id); err == nil {
|
||||
s.deletionState[id] = DeletionStateQueued
|
||||
err := s.treeGetter.DeleteTree(context.Background(), s.spaceId, id)
|
||||
if err != nil {
|
||||
// TODO: some errors may tell us that the tree is actually deleted, so we should have more checks here
|
||||
// TODO: add logging
|
||||
continue
|
||||
}
|
||||
}
|
||||
s.deletionState[id] = DeletionStateDeleted
|
||||
}
|
||||
}
|
||||
|
||||
func (s *settingsDocument) DeleteObject(id string) (err error) {
|
||||
content := &spacesyncproto.SpaceSettingsContent_ObjectDelete{
|
||||
ObjectDelete: &spacesyncproto.ObjectDelete{Id: id},
|
||||
}
|
||||
change := &spacesyncproto.SettingsData{
|
||||
Content: []*spacesyncproto.SpaceSettingsContent{
|
||||
{content},
|
||||
},
|
||||
Snapshot: nil,
|
||||
}
|
||||
res, err := change.Marshal()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
_, err = s.AddContent(context.Background(), tree.SignableChangeContent{
|
||||
Data: res,
|
||||
Key: s.account.Account().SignKey,
|
||||
Identity: s.account.Account().Identity,
|
||||
IsSnapshot: false,
|
||||
IsEncrypted: false,
|
||||
})
|
||||
if err == nil {
|
||||
s.Update(s)
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
package settingsservice
|
||||
|
||||
import (
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/account"
|
||||
)
|
||||
|
||||
type Service interface {
|
||||
}
|
||||
|
||||
const deletionChangeType = "space.deletionlist"
|
||||
|
||||
type service struct {
|
||||
account account.Service
|
||||
}
|
||||
|
||||
func New() Service {
|
||||
return nil
|
||||
}
|
||||
|
||||
type DeletedDocumentNotifiable interface {
|
||||
NotifyDeleted(id string)
|
||||
}
|
||||
@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/account"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/diffservice"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/settingsdocument"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/storage"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/syncacl"
|
||||
@ -89,6 +90,7 @@ type space struct {
|
||||
account account.Service
|
||||
aclList *syncacl.SyncACL
|
||||
configuration nodeconf.Configuration
|
||||
settingsDocument settingsdocument.SettingsDocument
|
||||
|
||||
isClosed atomic.Bool
|
||||
}
|
||||
@ -142,8 +144,18 @@ func (s *space) Init(ctx context.Context) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
deps := settingsdocument.Deps{
|
||||
BuildFunc: s.BuildTree,
|
||||
Account: s.account,
|
||||
TreeGetter: s.cache,
|
||||
Store: s.storage,
|
||||
}
|
||||
s.settingsDocument, err = settingsdocument.NewSettingsDocument(context.Background(), deps, s.id)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
s.aclList = syncacl.NewSyncACL(aclList, s.syncService.StreamPool())
|
||||
objectGetter := newCommonSpaceGetter(s.id, s.aclList, s.cache)
|
||||
objectGetter := newCommonSpaceGetter(s.id, s.aclList, s.cache, s.settingsDocument)
|
||||
s.syncService.Init(objectGetter)
|
||||
s.diffService.Init(initialIds)
|
||||
return nil
|
||||
@ -231,6 +243,9 @@ func (s *space) Close() error {
|
||||
if err := s.syncService.Close(); err != nil {
|
||||
mError.Add(err)
|
||||
}
|
||||
if err := s.settingsDocument.Close(); err != nil {
|
||||
mError.Add(err)
|
||||
}
|
||||
if err := s.aclList.Close(); err != nil {
|
||||
mError.Add(err)
|
||||
}
|
||||
|
||||
@ -106,3 +106,23 @@ message RawSpaceHeaderWithId {
|
||||
bytes rawHeader = 1;
|
||||
string id = 2;
|
||||
}
|
||||
|
||||
message SpaceSettingsContent {
|
||||
oneof value {
|
||||
ObjectDelete objectDelete = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message ObjectDelete {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message SpaceSettingsSnapshot {
|
||||
repeated string deletedIds = 1;
|
||||
}
|
||||
|
||||
message SettingsData {
|
||||
repeated SpaceSettingsContent content = 1;
|
||||
SpaceSettingsSnapshot snapshot = 2;
|
||||
}
|
||||
|
||||
|
||||
@ -824,6 +824,219 @@ func (m *RawSpaceHeaderWithId) GetId() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
type SpaceSettingsContent struct {
|
||||
// Types that are valid to be assigned to Value:
|
||||
//
|
||||
// *SpaceSettingsContent_ObjectDelete
|
||||
Value isSpaceSettingsContent_Value `protobuf_oneof:"value"`
|
||||
}
|
||||
|
||||
func (m *SpaceSettingsContent) Reset() { *m = SpaceSettingsContent{} }
|
||||
func (m *SpaceSettingsContent) String() string { return proto.CompactTextString(m) }
|
||||
func (*SpaceSettingsContent) ProtoMessage() {}
|
||||
func (*SpaceSettingsContent) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_80e49f1f4ac27799, []int{14}
|
||||
}
|
||||
func (m *SpaceSettingsContent) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *SpaceSettingsContent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_SpaceSettingsContent.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 *SpaceSettingsContent) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_SpaceSettingsContent.Merge(m, src)
|
||||
}
|
||||
func (m *SpaceSettingsContent) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *SpaceSettingsContent) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_SpaceSettingsContent.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_SpaceSettingsContent proto.InternalMessageInfo
|
||||
|
||||
type isSpaceSettingsContent_Value interface {
|
||||
isSpaceSettingsContent_Value()
|
||||
MarshalTo([]byte) (int, error)
|
||||
Size() int
|
||||
}
|
||||
|
||||
type SpaceSettingsContent_ObjectDelete struct {
|
||||
ObjectDelete *ObjectDelete `protobuf:"bytes,1,opt,name=objectDelete,proto3,oneof" json:"objectDelete,omitempty"`
|
||||
}
|
||||
|
||||
func (*SpaceSettingsContent_ObjectDelete) isSpaceSettingsContent_Value() {}
|
||||
|
||||
func (m *SpaceSettingsContent) GetValue() isSpaceSettingsContent_Value {
|
||||
if m != nil {
|
||||
return m.Value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *SpaceSettingsContent) GetObjectDelete() *ObjectDelete {
|
||||
if x, ok := m.GetValue().(*SpaceSettingsContent_ObjectDelete); ok {
|
||||
return x.ObjectDelete
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// XXX_OneofWrappers is for the internal use of the proto package.
|
||||
func (*SpaceSettingsContent) XXX_OneofWrappers() []interface{} {
|
||||
return []interface{}{
|
||||
(*SpaceSettingsContent_ObjectDelete)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
type ObjectDelete struct {
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ObjectDelete) Reset() { *m = ObjectDelete{} }
|
||||
func (m *ObjectDelete) String() string { return proto.CompactTextString(m) }
|
||||
func (*ObjectDelete) ProtoMessage() {}
|
||||
func (*ObjectDelete) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_80e49f1f4ac27799, []int{15}
|
||||
}
|
||||
func (m *ObjectDelete) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *ObjectDelete) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_ObjectDelete.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 *ObjectDelete) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ObjectDelete.Merge(m, src)
|
||||
}
|
||||
func (m *ObjectDelete) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *ObjectDelete) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ObjectDelete.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ObjectDelete proto.InternalMessageInfo
|
||||
|
||||
func (m *ObjectDelete) GetId() string {
|
||||
if m != nil {
|
||||
return m.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type SpaceSettingsSnapshot struct {
|
||||
DeletedIds []string `protobuf:"bytes,1,rep,name=deletedIds,proto3" json:"deletedIds,omitempty"`
|
||||
}
|
||||
|
||||
func (m *SpaceSettingsSnapshot) Reset() { *m = SpaceSettingsSnapshot{} }
|
||||
func (m *SpaceSettingsSnapshot) String() string { return proto.CompactTextString(m) }
|
||||
func (*SpaceSettingsSnapshot) ProtoMessage() {}
|
||||
func (*SpaceSettingsSnapshot) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_80e49f1f4ac27799, []int{16}
|
||||
}
|
||||
func (m *SpaceSettingsSnapshot) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *SpaceSettingsSnapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_SpaceSettingsSnapshot.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 *SpaceSettingsSnapshot) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_SpaceSettingsSnapshot.Merge(m, src)
|
||||
}
|
||||
func (m *SpaceSettingsSnapshot) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *SpaceSettingsSnapshot) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_SpaceSettingsSnapshot.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_SpaceSettingsSnapshot proto.InternalMessageInfo
|
||||
|
||||
func (m *SpaceSettingsSnapshot) GetDeletedIds() []string {
|
||||
if m != nil {
|
||||
return m.DeletedIds
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type SettingsData struct {
|
||||
Content []*SpaceSettingsContent `protobuf:"bytes,1,rep,name=content,proto3" json:"content,omitempty"`
|
||||
Snapshot *SpaceSettingsSnapshot `protobuf:"bytes,2,opt,name=snapshot,proto3" json:"snapshot,omitempty"`
|
||||
}
|
||||
|
||||
func (m *SettingsData) Reset() { *m = SettingsData{} }
|
||||
func (m *SettingsData) String() string { return proto.CompactTextString(m) }
|
||||
func (*SettingsData) ProtoMessage() {}
|
||||
func (*SettingsData) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_80e49f1f4ac27799, []int{17}
|
||||
}
|
||||
func (m *SettingsData) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *SettingsData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_SettingsData.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 *SettingsData) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_SettingsData.Merge(m, src)
|
||||
}
|
||||
func (m *SettingsData) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *SettingsData) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_SettingsData.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_SettingsData proto.InternalMessageInfo
|
||||
|
||||
func (m *SettingsData) GetContent() []*SpaceSettingsContent {
|
||||
if m != nil {
|
||||
return m.Content
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *SettingsData) GetSnapshot() *SpaceSettingsSnapshot {
|
||||
if m != nil {
|
||||
return m.Snapshot
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterEnum("anySpace.ErrCodes", ErrCodes_name, ErrCodes_value)
|
||||
proto.RegisterType((*HeadSyncRange)(nil), "anySpace.HeadSyncRange")
|
||||
@ -840,6 +1053,10 @@ func init() {
|
||||
proto.RegisterType((*SpaceHeader)(nil), "anySpace.SpaceHeader")
|
||||
proto.RegisterType((*RawSpaceHeader)(nil), "anySpace.RawSpaceHeader")
|
||||
proto.RegisterType((*RawSpaceHeaderWithId)(nil), "anySpace.RawSpaceHeaderWithId")
|
||||
proto.RegisterType((*SpaceSettingsContent)(nil), "anySpace.SpaceSettingsContent")
|
||||
proto.RegisterType((*ObjectDelete)(nil), "anySpace.ObjectDelete")
|
||||
proto.RegisterType((*SpaceSettingsSnapshot)(nil), "anySpace.SpaceSettingsSnapshot")
|
||||
proto.RegisterType((*SettingsData)(nil), "anySpace.SettingsData")
|
||||
}
|
||||
|
||||
func init() {
|
||||
@ -847,55 +1064,62 @@ func init() {
|
||||
}
|
||||
|
||||
var fileDescriptor_80e49f1f4ac27799 = []byte{
|
||||
// 770 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xcd, 0x4e, 0x23, 0x47,
|
||||
0x10, 0xf6, 0x0c, 0x06, 0xec, 0xb2, 0x31, 0xa6, 0x43, 0xc8, 0xc4, 0x89, 0x26, 0xd6, 0x1c, 0x22,
|
||||
0x2b, 0x07, 0x20, 0x4e, 0x94, 0x0b, 0x97, 0xfc, 0x60, 0x14, 0x2b, 0x22, 0xa0, 0x76, 0xa2, 0x48,
|
||||
0x51, 0x2e, 0xcd, 0x4c, 0x63, 0x4f, 0x34, 0x7f, 0x3b, 0xdd, 0x16, 0xcc, 0x61, 0xa5, 0x7d, 0x84,
|
||||
0x7d, 0x82, 0x95, 0xf6, 0x6d, 0xf6, 0xc8, 0x71, 0x8f, 0x2b, 0x78, 0x91, 0x55, 0x97, 0x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15, 0xfe, 0x7f, 0x5c, 0xb9, 0x98,
|
||||
0x3a, 0xb4, 0x9c, 0x42, 0x4c, 0x00, 0x66, 0x7b, 0x29, 0x1f, 0x6a, 0xdd, 0xa5, 0x25, 0x84, 0x58,
|
||||
0xd0, 0x2d, 0xac, 0xe9, 0x4a, 0xf3, 0x36, 0xad, 0x60, 0x64, 0x0c, 0xfb, 0x48, 0x39, 0xe3, 0x52,
|
||||
0xba, 0xc1, 0x5c, 0x64, 0x6c, 0x4d, 0x64, 0xab, 0xf5, 0x91, 0x9f, 0xe0, 0xa0, 0x0e, 0x9f, 0x3a,
|
||||
0xc6, 0x26, 0x56, 0x78, 0xc2, 0x6b, 0xbd, 0xd5, 0xa0, 0x53, 0x1a, 0x49, 0x1d, 0xba, 0xeb, 0xf0,
|
||||
0x40, 0xba, 0x32, 0x49, 0xb7, 0x34, 0xb7, 0xc9, 0xd7, 0xd0, 0x96, 0xae, 0xcf, 0x85, 0x64, 0x7e,
|
||||
0x84, 0xa3, 0x6d, 0xd0, 0x02, 0x50, 0x5e, 0xac, 0xf1, 0x57, 0x12, 0xf1, 0x74, 0xac, 0x02, 0x20,
|
||||
0xdf, 0x42, 0x4f, 0xdd, 0x38, 0xd7, 0x66, 0xd2, 0x0d, 0x83, 0x3f, 0x78, 0x82, 0xd3, 0x34, 0xe9,
|
||||
0x1a, 0xaa, 0x36, 0x52, 0x70, 0xbe, 0xea, 0xba, 0x4b, 0xf1, 0xdd, 0xba, 0x84, 0x5e, 0x55, 0x78,
|
||||
0x32, 0x7c, 0x7c, 0x4e, 0xdd, 0xea, 0x39, 0xa8, 0x6e, 0xdc, 0x79, 0xc0, 0xe4, 0x32, 0xe6, 0xe9,
|
||||
0x31, 0x14, 0x80, 0x75, 0x0a, 0xfb, 0x75, 0x47, 0xa9, 0xb2, 0x62, 0x76, 0x53, 0x61, 0x2d, 0x80,
|
||||
0xf4, 0x16, 0xea, 0xd9, 0x2d, 0xfc, 0xee, 0x4f, 0x68, 0x4d, 0xe2, 0xf8, 0xb7, 0xd0, 0xe1, 0x82,
|
||||
0xf4, 0x00, 0xfe, 0x0e, 0xf8, 0x6d, 0xc4, 0x6d, 0xc9, 0x9d, 0x7e, 0x83, 0xf4, 0xd3, 0x9b, 0x75,
|
||||
0xee, 0x0a, 0xe1, 0x06, 0xf3, 0xbe, 0x46, 0x76, 0x53, 0xa1, 0x27, 0xb7, 0xae, 0x90, 0xa2, 0xaf,
|
||||
0x2b, 0x60, 0x12, 0xc7, 0x61, 0x7c, 0x71, 0x7d, 0x2d, 0xb8, 0xec, 0x3b, 0xe3, 0x37, 0x3a, 0x6c,
|
||||
0x62, 0x08, 0xf9, 0x05, 0x5a, 0xd9, 0xe2, 0x93, 0x2f, 0xeb, 0x3e, 0x06, 0xb8, 0x16, 0x83, 0x41,
|
||||
0xed, 0x77, 0x62, 0xb5, 0x0d, 0xa7, 0xd0, 0xce, 0x77, 0x8b, 0x94, 0x02, 0xd7, 0xd7, 0x76, 0xf0,
|
||||
0x55, 0xad, 0xaf, 0xcc, 0x92, 0x2e, 0x5a, 0x95, 0xa5, 0xba, 0xa1, 0x55, 0x96, 0xf5, 0xcd, 0x3c,
|
||||
0x83, 0xad, 0x99, 0x8c, 0x39, 0xf3, 0x49, 0x29, 0xec, 0xd1, 0xe7, 0x6b, 0xf0, 0x9c, 0x73, 0xa4,
|
||||
0x1d, 0x6b, 0xbf, 0xfe, 0xf8, 0xee, 0xde, 0xd4, 0xee, 0xee, 0x4d, 0xed, 0xc3, 0xbd, 0xa9, 0xbd,
|
||||
0x7e, 0x30, 0x1b, 0x77, 0x0f, 0x66, 0xe3, 0xfd, 0x83, 0xd9, 0xf8, 0x77, 0xf0, 0xf4, 0x5f, 0xde,
|
||||
0xd5, 0x16, 0xfe, 0xfc, 0xf0, 0x31, 0x00, 0x00, 0xff, 0xff, 0xaa, 0x60, 0x9b, 0x89, 0x17, 0x07,
|
||||
// 882 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0x4f, 0x6f, 0x1b, 0x45,
|
||||
0x14, 0xf7, 0x6e, 0x9c, 0xc4, 0x7e, 0xd9, 0xba, 0xee, 0x90, 0x96, 0xc5, 0x45, 0x4b, 0x34, 0x07,
|
||||
0x14, 0x71, 0x48, 0x8a, 0x41, 0x80, 0x54, 0x0e, 0xd0, 0xda, 0x55, 0x2d, 0x54, 0x12, 0x8d, 0x41,
|
||||
0x48, 0x08, 0x0e, 0xd3, 0xdd, 0x89, 0xbd, 0x68, 0xbd, 0xb3, 0xec, 0x8c, 0x49, 0x7d, 0x40, 0xe2,
|
||||
0xc2, 0x9d, 0x4f, 0x80, 0xc4, 0xb7, 0xe1, 0xd8, 0x23, 0x47, 0x94, 0x7c, 0x11, 0x34, 0x6f, 0xff,
|
||||
0x3b, 0x9b, 0x4a, 0x5c, 0xd6, 0xf3, 0xfe, 0xfd, 0xde, 0x9f, 0x79, 0xf3, 0x93, 0xe1, 0x43, 0x5f,
|
||||
0xae, 0x56, 0x32, 0x56, 0x09, 0xf7, 0xc5, 0x29, 0x7e, 0xd5, 0x26, 0xf6, 0x93, 0x54, 0x6a, 0x79,
|
||||
0x8a, 0x5f, 0x55, 0x69, 0x4f, 0x50, 0x41, 0x7a, 0x3c, 0xde, 0xcc, 0x8d, 0x8e, 0xce, 0xe0, 0xce,
|
||||
0x73, 0xc1, 0x83, 0xf9, 0x26, 0xf6, 0x19, 0x8f, 0x17, 0x82, 0x10, 0xe8, 0x5e, 0xa4, 0x72, 0xe5,
|
||||
0x5a, 0x47, 0xd6, 0x71, 0x97, 0xe1, 0x99, 0x0c, 0xc0, 0xd6, 0xd2, 0xb5, 0x51, 0x63, 0x6b, 0x49,
|
||||
0x0e, 0x61, 0x37, 0x0a, 0x57, 0xa1, 0x76, 0x77, 0x8e, 0xac, 0xe3, 0x3b, 0x2c, 0x13, 0xe8, 0x25,
|
||||
0x0c, 0x4a, 0x28, 0xa1, 0xd6, 0x91, 0x36, 0x58, 0x4b, 0xae, 0x96, 0x88, 0xe5, 0x30, 0x3c, 0x93,
|
||||
0xc7, 0xd0, 0x13, 0x91, 0x58, 0x89, 0x58, 0x2b, 0xd7, 0x3e, 0xda, 0x39, 0x3e, 0x18, 0xbf, 0x77,
|
||||
0x52, 0x54, 0x73, 0xd2, 0x8c, 0x9f, 0x66, 0x7e, 0xac, 0x0c, 0x30, 0x89, 0x7d, 0xb9, 0x8e, 0xcb,
|
||||
0xc4, 0x28, 0xd0, 0xc7, 0x70, 0xbf, 0x35, 0xd0, 0xd4, 0x1d, 0x06, 0x98, 0xbd, 0xcf, 0xec, 0x30,
|
||||
0xc0, 0x7a, 0x04, 0x0f, 0xb0, 0x93, 0x3e, 0xc3, 0x33, 0xfd, 0x01, 0xee, 0x56, 0xc1, 0x3f, 0xaf,
|
||||
0x85, 0xd2, 0xc4, 0x85, 0x7d, 0x1c, 0xd8, 0xac, 0x88, 0x2d, 0x44, 0x72, 0x0a, 0x7b, 0xa9, 0x99,
|
||||
0x52, 0x51, 0xfa, 0xdb, 0x2d, 0xa5, 0x1b, 0x3b, 0xcb, 0xdd, 0xe8, 0x33, 0x18, 0xd6, 0x4a, 0x4b,
|
||||
0x64, 0xac, 0x04, 0x19, 0xc3, 0x7e, 0x8a, 0x65, 0x2a, 0xd7, 0x42, 0x14, 0xf7, 0xb6, 0x01, 0xb0,
|
||||
0xc2, 0x91, 0xfe, 0x0a, 0xf7, 0xce, 0x5e, 0xfe, 0x24, 0x7c, 0x6d, 0x8c, 0x2f, 0x84, 0x52, 0x7c,
|
||||
0x21, 0xde, 0x50, 0xa7, 0x6b, 0x52, 0x24, 0xd1, 0x66, 0x56, 0xf4, 0x5a, 0x88, 0xc6, 0x92, 0xf0,
|
||||
0x4d, 0x24, 0x79, 0x80, 0x33, 0x74, 0x58, 0x21, 0x92, 0x11, 0xf4, 0x24, 0xa6, 0x98, 0x05, 0x6e,
|
||||
0x17, 0x83, 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, 0xfa, 0x57, 0x08,
|
||||
0x00, 0x00,
|
||||
}
|
||||
|
||||
@ -1469,6 +1693,170 @@ func (m *RawSpaceHeaderWithId) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *SpaceSettingsContent) 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 *SpaceSettingsContent) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *SpaceSettingsContent) 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 *SpaceSettingsContent_ObjectDelete) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *SpaceSettingsContent_ObjectDelete) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
if m.ObjectDelete != nil {
|
||||
{
|
||||
size, err := m.ObjectDelete.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 *ObjectDelete) 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 *ObjectDelete) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *ObjectDelete) 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 = encodeVarintSpacesync(dAtA, i, uint64(len(m.Id)))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *SpaceSettingsSnapshot) 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 *SpaceSettingsSnapshot) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *SpaceSettingsSnapshot) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.DeletedIds) > 0 {
|
||||
for iNdEx := len(m.DeletedIds) - 1; iNdEx >= 0; iNdEx-- {
|
||||
i -= len(m.DeletedIds[iNdEx])
|
||||
copy(dAtA[i:], m.DeletedIds[iNdEx])
|
||||
i = encodeVarintSpacesync(dAtA, i, uint64(len(m.DeletedIds[iNdEx])))
|
||||
i--
|
||||
dAtA[i] = 0xa
|
||||
}
|
||||
}
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *SettingsData) 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 *SettingsData) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *SettingsData) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.Snapshot != nil {
|
||||
{
|
||||
size, err := m.Snapshot.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintSpacesync(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x12
|
||||
}
|
||||
if len(m.Content) > 0 {
|
||||
for iNdEx := len(m.Content) - 1; iNdEx >= 0; iNdEx-- {
|
||||
{
|
||||
size, err := m.Content[iNdEx].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 encodeVarintSpacesync(dAtA []byte, offset int, v uint64) int {
|
||||
offset -= sovSpacesync(v)
|
||||
base := offset
|
||||
@ -1734,6 +2122,77 @@ func (m *RawSpaceHeaderWithId) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *SpaceSettingsContent) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.Value != nil {
|
||||
n += m.Value.Size()
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *SpaceSettingsContent_ObjectDelete) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.ObjectDelete != nil {
|
||||
l = m.ObjectDelete.Size()
|
||||
n += 1 + l + sovSpacesync(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
func (m *ObjectDelete) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
l = len(m.Id)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovSpacesync(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *SpaceSettingsSnapshot) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.DeletedIds) > 0 {
|
||||
for _, s := range m.DeletedIds {
|
||||
l = len(s)
|
||||
n += 1 + l + sovSpacesync(uint64(l))
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *SettingsData) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Content) > 0 {
|
||||
for _, e := range m.Content {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovSpacesync(uint64(l))
|
||||
}
|
||||
}
|
||||
if m.Snapshot != nil {
|
||||
l = m.Snapshot.Size()
|
||||
n += 1 + l + sovSpacesync(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovSpacesync(x uint64) (n int) {
|
||||
return (math_bits.Len64(x|1) + 6) / 7
|
||||
}
|
||||
@ -3422,6 +3881,375 @@ func (m *RawSpaceHeaderWithId) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *SpaceSettingsContent) 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: SpaceSettingsContent: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: SpaceSettingsContent: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ObjectDelete", 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 := &ObjectDelete{}
|
||||
if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
m.Value = &SpaceSettingsContent_ObjectDelete{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 *ObjectDelete) 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: ObjectDelete: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: ObjectDelete: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
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 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.Id = 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 *SpaceSettingsSnapshot) 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: SpaceSettingsSnapshot: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: SpaceSettingsSnapshot: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field DeletedIds", 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.DeletedIds = append(m.DeletedIds, 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 *SettingsData) 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: SettingsData: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: SettingsData: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 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.Content = append(m.Content, &SpaceSettingsContent{})
|
||||
if err := m.Content[len(m.Content)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Snapshot", 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.Snapshot == nil {
|
||||
m.Snapshot = &SpaceSettingsSnapshot{}
|
||||
}
|
||||
if err := m.Snapshot.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
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
|
||||
|
||||
@ -5,7 +5,6 @@ import (
|
||||
"errors"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/logger"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/diffservice"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/settingsservice"
|
||||
spacestorage "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/storage"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/syncservice"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/syncservice/synchandler"
|
||||
@ -30,7 +29,6 @@ type SyncTree struct {
|
||||
synchandler.SyncHandler
|
||||
syncClient SyncClient
|
||||
listener updatelistener.UpdateListener
|
||||
deletedNotifiable settingsservice.DeletedDocumentNotifiable
|
||||
isClosed bool
|
||||
isDeleted bool
|
||||
}
|
||||
@ -51,7 +49,6 @@ type CreateDeps struct {
|
||||
Listener updatelistener.UpdateListener
|
||||
AclList list.ACLList
|
||||
CreateStorage storage.TreeStorageCreatorFunc
|
||||
DeletedNotifiable settingsservice.DeletedDocumentNotifiable
|
||||
}
|
||||
|
||||
type BuildDeps struct {
|
||||
@ -63,7 +60,6 @@ type BuildDeps struct {
|
||||
AclList list.ACLList
|
||||
SpaceStorage spacestorage.SpaceStorage
|
||||
TreeStorage storage.TreeStorage
|
||||
DeletedNotifiable settingsservice.DeletedDocumentNotifiable
|
||||
}
|
||||
|
||||
func DeriveSyncTree(ctx context.Context, deps CreateDeps) (t tree.ObjectTree, err error) {
|
||||
@ -81,7 +77,6 @@ func DeriveSyncTree(ctx context.Context, deps CreateDeps) (t tree.ObjectTree, er
|
||||
ObjectTree: t,
|
||||
syncClient: syncClient,
|
||||
listener: deps.Listener,
|
||||
deletedNotifiable: deps.DeletedNotifiable,
|
||||
}
|
||||
syncHandler := newSyncTreeHandler(syncTree, syncClient)
|
||||
syncTree.SyncHandler = syncHandler
|
||||
@ -107,7 +102,6 @@ func CreateSyncTree(ctx context.Context, deps CreateDeps) (t tree.ObjectTree, er
|
||||
ObjectTree: t,
|
||||
syncClient: syncClient,
|
||||
listener: deps.Listener,
|
||||
deletedNotifiable: deps.DeletedNotifiable,
|
||||
}
|
||||
syncHandler := newSyncTreeHandler(syncTree, syncClient)
|
||||
syncTree.SyncHandler = syncHandler
|
||||
@ -188,7 +182,6 @@ func buildSyncTree(ctx context.Context, isFirstBuild bool, deps BuildDeps) (t tr
|
||||
ObjectTree: t,
|
||||
syncClient: syncClient,
|
||||
listener: deps.Listener,
|
||||
deletedNotifiable: deps.DeletedNotifiable,
|
||||
}
|
||||
syncHandler := newSyncTreeHandler(syncTree, syncClient)
|
||||
syncTree.SyncHandler = syncHandler
|
||||
@ -206,6 +199,20 @@ func buildSyncTree(ctx context.Context, isFirstBuild bool, deps BuildDeps) (t tr
|
||||
return
|
||||
}
|
||||
|
||||
func (s *SyncTree) IterateFrom(id string, convert tree.ChangeConvertFunc, iterate tree.ChangeIterateFunc) (err error) {
|
||||
if err = s.checkAlive(); err != nil {
|
||||
return
|
||||
}
|
||||
return s.ObjectTree.IterateFrom(id, convert, iterate)
|
||||
}
|
||||
|
||||
func (s *SyncTree) Iterate(convert tree.ChangeConvertFunc, iterate tree.ChangeIterateFunc) (err error) {
|
||||
if err = s.checkAlive(); err != nil {
|
||||
return
|
||||
}
|
||||
return s.ObjectTree.Iterate(convert, iterate)
|
||||
}
|
||||
|
||||
func (s *SyncTree) AddContent(ctx context.Context, content tree.SignableChangeContent) (res tree.AddResult, err error) {
|
||||
if err = s.checkAlive(); err != nil {
|
||||
return
|
||||
@ -247,12 +254,7 @@ func (s *SyncTree) AddRawChanges(ctx context.Context, changes ...*treechangeprot
|
||||
func (s *SyncTree) Delete() (err error) {
|
||||
log.With("id", s.ID()).Debug("deleting sync tree")
|
||||
s.Lock()
|
||||
defer func() {
|
||||
s.Unlock()
|
||||
if err == nil {
|
||||
s.deletedNotifiable.NotifyDeleted(s.ID())
|
||||
}
|
||||
}()
|
||||
defer s.Unlock()
|
||||
if err = s.checkAlive(); err != nil {
|
||||
return
|
||||
}
|
||||
@ -261,7 +263,6 @@ func (s *SyncTree) Delete() (err error) {
|
||||
return
|
||||
}
|
||||
s.isDeleted = true
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@ -15,4 +15,5 @@ var ErrSpaceNotFound = errors.New("space not found")
|
||||
type TreeGetter interface {
|
||||
app.ComponentRunnable
|
||||
GetTree(ctx context.Context, spaceId, treeId string) (tree.ObjectTree, error)
|
||||
DeleteTree(ctx context.Context, spaceId, treeId string) error
|
||||
}
|
||||
|
||||
@ -155,12 +155,15 @@ func (c *changeBuilder) BuildContent(payload BuilderContent) (ch *Change, rawIdC
|
||||
Identity: payload.Identity,
|
||||
IsSnapshot: payload.IsSnapshot,
|
||||
}
|
||||
|
||||
if payload.ReadKey != nil {
|
||||
encrypted, err := payload.ReadKey.Encrypt(payload.Content)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
change.ChangesData = encrypted
|
||||
} else {
|
||||
change.ChangesData = payload.Content
|
||||
}
|
||||
|
||||
marshalledChange, err := proto.Marshal(change)
|
||||
if err != nil {
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/common"
|
||||
list2 "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/list"
|
||||
list "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/list"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/treechangeproto"
|
||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/symmetric"
|
||||
@ -67,7 +67,7 @@ type objectTree struct {
|
||||
validator ObjectTreeValidator
|
||||
rawChangeLoader *rawChangeLoader
|
||||
treeBuilder *treeBuilder
|
||||
aclList list2.ACLList
|
||||
aclList list.ACLList
|
||||
|
||||
id string
|
||||
root *treechangeproto.RawTreeChangeWithId
|
||||
@ -92,13 +92,13 @@ type objectTreeDeps struct {
|
||||
treeStorage storage.TreeStorage
|
||||
validator ObjectTreeValidator
|
||||
rawChangeLoader *rawChangeLoader
|
||||
aclList list2.ACLList
|
||||
aclList list.ACLList
|
||||
}
|
||||
|
||||
func defaultObjectTreeDeps(
|
||||
rootChange *treechangeproto.RawTreeChangeWithId,
|
||||
treeStorage storage.TreeStorage,
|
||||
aclList list2.ACLList) objectTreeDeps {
|
||||
aclList list.ACLList) objectTreeDeps {
|
||||
|
||||
keychain := common.NewKeychain()
|
||||
changeBuilder := NewChangeBuilder(keychain, rootChange)
|
||||
@ -187,16 +187,23 @@ func (ot *objectTree) prepareBuilderContent(content SignableChangeContent) (cnt
|
||||
ot.aclList.RLock()
|
||||
defer ot.aclList.RUnlock()
|
||||
|
||||
state := ot.aclList.ACLState() // special method for own keys
|
||||
readKey, err := state.CurrentReadKey()
|
||||
var (
|
||||
state = ot.aclList.ACLState() // special method for own keys
|
||||
readKey *symmetric.Key
|
||||
readKeyHash uint64
|
||||
)
|
||||
if content.IsEncrypted {
|
||||
readKeyHash = state.CurrentReadKeyHash()
|
||||
readKey, err = state.CurrentReadKey()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
cnt = BuilderContent{
|
||||
TreeHeadIds: ot.tree.Heads(),
|
||||
AclHeadId: ot.aclList.Head().Id,
|
||||
SnapshotBaseId: ot.tree.RootId(),
|
||||
CurrentReadKeyHash: state.CurrentReadKeyHash(),
|
||||
CurrentReadKeyHash: readKeyHash,
|
||||
Identity: content.Identity,
|
||||
IsSnapshot: content.IsSnapshot,
|
||||
SigningKey: content.Key,
|
||||
@ -440,9 +447,25 @@ func (ot *objectTree) IterateFrom(id string, convert ChangeConvertFunc, iterate
|
||||
ot.tree.Iterate(id, iterate)
|
||||
return
|
||||
}
|
||||
decrypt := func(c *Change) (decrypted []byte, err error) {
|
||||
// the change is not encrypted
|
||||
if c.ReadKeyHash == 0 {
|
||||
decrypted = c.Data
|
||||
return
|
||||
}
|
||||
readKey, exists := ot.keys[c.ReadKeyHash]
|
||||
if !exists {
|
||||
err = list.ErrNoReadKey
|
||||
return
|
||||
}
|
||||
|
||||
decrypted, err = readKey.Decrypt(c.Data)
|
||||
return
|
||||
}
|
||||
|
||||
ot.tree.Iterate(ot.tree.RootId(), func(c *Change) (isContinue bool) {
|
||||
var model any
|
||||
// if already saved as a model
|
||||
if c.Model != nil {
|
||||
return iterate(c)
|
||||
}
|
||||
@ -450,14 +473,9 @@ func (ot *objectTree) IterateFrom(id string, convert ChangeConvertFunc, iterate
|
||||
if c.Id == ot.id {
|
||||
return iterate(c)
|
||||
}
|
||||
readKey, exists := ot.keys[c.ReadKeyHash]
|
||||
if !exists {
|
||||
err = list2.ErrNoReadKey
|
||||
return false
|
||||
}
|
||||
|
||||
var decrypted []byte
|
||||
decrypted, err = readKey.Decrypt(c.Data)
|
||||
decrypted, err = decrypt(c)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ type ObjectTreeCreatePayload struct {
|
||||
ChangeType string
|
||||
SpaceId string
|
||||
Identity []byte
|
||||
IsEncrypted bool
|
||||
}
|
||||
|
||||
func BuildObjectTree(treeStorage storage2.TreeStorage, aclList list.ACLList) (ObjectTree, error) {
|
||||
|
||||
@ -9,4 +9,5 @@ type SignableChangeContent struct {
|
||||
Key signingkey.PrivKey
|
||||
Identity []byte
|
||||
IsSnapshot bool
|
||||
IsEncrypted bool
|
||||
}
|
||||
|
||||
@ -70,3 +70,16 @@ func (c *treeCache) GetTree(ctx context.Context, spaceId, id string) (tr tree.Ob
|
||||
tr = value.(tree.ObjectTree)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *treeCache) DeleteTree(ctx context.Context, spaceId, treeId string) (err error) {
|
||||
tr, err := c.GetTree(ctx, spaceId, treeId)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = tr.Delete()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, err = c.cache.Remove(treeId)
|
||||
return
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user