Add space and document creation logic for client

This commit is contained in:
mcrakhman 2022-10-18 14:17:49 +02:00 committed by Mikhail Iudin
parent 2c9f54464a
commit 42e0c50540
No known key found for this signature in database
GPG Key ID: FAAAA8BAABDFF1C0
14 changed files with 583 additions and 376 deletions

4
.fleet/settings.json Normal file
View File

@ -0,0 +1,4 @@
{
"toolchains": [],
"editor.guides": []
}

View File

@ -3,9 +3,10 @@ package clientcache
import ( import (
"context" "context"
"errors" "errors"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/clientspace"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/document"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app" "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/app/logger"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/clientspace"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/cache" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/cache"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/ocache" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/ocache"
"time" "time"
@ -21,6 +22,7 @@ const spaceKey ctxKey = 0
type treeCache struct { type treeCache struct {
gcttl int gcttl int
cache ocache.OCache cache ocache.OCache
docService document.Service
clientService clientspace.Service clientService clientspace.Service
} }
@ -40,14 +42,16 @@ func (c *treeCache) Close(ctx context.Context) (err error) {
func (c *treeCache) Init(a *app.App) (err error) { func (c *treeCache) Init(a *app.App) (err error) {
c.clientService = a.MustComponent(clientspace.CName).(clientspace.Service) c.clientService = a.MustComponent(clientspace.CName).(clientspace.Service)
c.docService = a.MustComponent(document.CName).(document.Service)
c.cache = ocache.New( c.cache = ocache.New(
func(ctx context.Context, id string) (value ocache.Object, err error) { func(ctx context.Context, id string) (value ocache.Object, err error) {
spaceId := ctx.Value(spaceKey).(string) spaceId := ctx.Value(spaceKey).(string)
space, err := c.clientService.GetSpace(ctx, spaceId) container, err := c.clientService.GetSpace(ctx, spaceId)
if err != nil { if err != nil {
return return
} }
return space.BuildTree(ctx, id, nil) defer container.Release()
return document.NewTextDocument(context.Background(), container.Object, id, c.docService)
}, },
ocache.WithLogger(log.Sugar()), ocache.WithLogger(log.Sugar()),
ocache.WithGCPeriod(time.Minute), ocache.WithGCPeriod(time.Minute),

View File

@ -2,6 +2,7 @@ package clientspace
import ( import (
"context" "context"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/util"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app" "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/app/logger"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace" "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace"
@ -22,9 +23,9 @@ func New() Service {
} }
type Service interface { type Service interface {
GetSpace(ctx context.Context, id string) (commonspace.Space, error) GetSpace(ctx context.Context, id string) (util.ReleaseContainer[commonspace.Space], error)
CreateSpace(ctx context.Context, payload commonspace.SpaceCreatePayload) (commonspace.Space, error) CreateSpace(ctx context.Context, payload commonspace.SpaceCreatePayload) (util.ReleaseContainer[commonspace.Space], error)
DeriveSpace(ctx context.Context, payload commonspace.SpaceDerivePayload) (commonspace.Space, error) DeriveSpace(ctx context.Context, payload commonspace.SpaceDerivePayload) (util.ReleaseContainer[commonspace.Space], error)
app.ComponentRunnable app.ComponentRunnable
} }
@ -63,38 +64,53 @@ func (s *service) Run(ctx context.Context) (err error) {
return return
} }
func (s *service) CreateSpace(ctx context.Context, payload commonspace.SpaceCreatePayload) (space commonspace.Space, err error) { func (s *service) CreateSpace(ctx context.Context, payload commonspace.SpaceCreatePayload) (container util.ReleaseContainer[commonspace.Space], err error) {
id, err := s.commonSpace.CreateSpace(ctx, payload) id, err := s.commonSpace.CreateSpace(ctx, payload)
if err != nil { if err != nil {
return return
} }
obj, err := s.commonSpace.GetSpace(ctx, id) obj, err := s.spaceCache.Get(ctx, id)
if err != nil { if err != nil {
return return
} }
return obj.(commonspace.Space), nil return util.ReleaseContainer[commonspace.Space]{
Object: obj.(commonspace.Space),
Release: func() {
s.spaceCache.Release(id)
},
}, nil
} }
func (s *service) DeriveSpace(ctx context.Context, payload commonspace.SpaceDerivePayload) (space commonspace.Space, err error) { func (s *service) DeriveSpace(ctx context.Context, payload commonspace.SpaceDerivePayload) (container util.ReleaseContainer[commonspace.Space], err error) {
id, err := s.commonSpace.DeriveSpace(ctx, payload) id, err := s.commonSpace.DeriveSpace(ctx, payload)
if err != nil { if err != nil {
return return
} }
obj, err := s.commonSpace.GetSpace(ctx, id) obj, err := s.spaceCache.Get(ctx, id)
if err != nil { if err != nil {
return return
} }
return obj.(commonspace.Space), nil return util.ReleaseContainer[commonspace.Space]{
Object: obj.(commonspace.Space),
Release: func() {
s.spaceCache.Release(id)
},
}, nil
} }
func (s *service) GetSpace(ctx context.Context, id string) (commonspace.Space, error) { func (s *service) GetSpace(ctx context.Context, id string) (container util.ReleaseContainer[commonspace.Space], err error) {
v, err := s.spaceCache.Get(ctx, id) v, err := s.spaceCache.Get(ctx, id)
if err != nil { if err != nil {
return nil, err return
} }
return v.(commonspace.Space), nil return util.ReleaseContainer[commonspace.Space]{
Object: v.(commonspace.Space),
Release: func() {
s.spaceCache.Release(id)
},
}, nil
} }
func (s *service) Close(ctx context.Context) (err error) { func (s *service) Close(ctx context.Context) (err error) {

View File

@ -1,13 +1,97 @@
package document package document
import "github.com/anytypeio/go-anytype-infrastructure-experiments/common/app" import (
"context"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/clientspace"
"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/cache"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/synctree/updatelistener"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/tree"
)
type Service interface { type Service interface {
app.Component app.Component
updatelistener.UpdateListener
CreateDocument(spaceId string) (id string, err error) CreateDocument(spaceId string) (id string, err error)
GetAllDocumentIds(spaceId string) (ids []string, err error) GetAllDocumentIds(spaceId string) (ids []string, err error)
AddText(documentId, text string) (err error) AddText(spaceId, documentId, text string) (err error)
DumpDocumentTree(documentId string) (err error) DumpDocumentTree(spaceId, documentId string) (dump string, err error)
} }
const CName = "client.document" const CName = "client.document"
var log = logger.NewNamed(CName)
type service struct {
account account.Service
spaceService clientspace.Service
cache cache.TreeCache
}
func New() Service {
return &service{}
}
func (s *service) Init(a *app.App) (err error) {
s.account = a.MustComponent(account.CName).(account.Service)
s.spaceService = a.MustComponent(clientspace.CName).(clientspace.Service)
s.cache = a.MustComponent(cache.CName).(cache.TreeCache)
return
}
func (s *service) Name() (name string) {
return CName
}
func (s *service) CreateDocument(spaceId string) (id string, err error) {
spaceRef, err := s.spaceService.GetSpace(context.Background(), spaceId)
if err != nil {
return
}
defer spaceRef.Release()
doc, err := createTextDocument(context.Background(), spaceRef.Object, s.account, s)
if err != nil {
return
}
id = doc.Tree().ID()
return
}
func (s *service) GetAllDocumentIds(spaceId string) (ids []string, err error) {
spaceRef, err := s.spaceService.GetSpace(context.Background(), spaceId)
if err != nil {
return
}
defer spaceRef.Release()
ids = spaceRef.Object.StoredIds()
return
}
func (s *service) AddText(spaceId, documentId, text string) (err error) {
doc, err := s.cache.GetTree(context.Background(), spaceId, documentId)
if err != nil {
return
}
defer doc.Release()
return doc.TreeContainer.(TextDocument).AddText(text)
}
func (s *service) DumpDocumentTree(spaceId, documentId string) (dump string, err error) {
doc, err := s.cache.GetTree(context.Background(), spaceId, documentId)
if err != nil {
return
}
defer doc.Release()
return doc.TreeContainer.Tree().DebugDump()
}
func (s *service) Update(tree tree.ObjectTree) {
}
func (s *service) Rebuild(tree tree.ObjectTree) {
//TODO implement me
panic("implement me")
}

View File

@ -0,0 +1,114 @@
package document
import (
"context"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/account"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/cache"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/synctree/updatelistener"
testchanges "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/testutils/testchanges/proto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/tree"
"github.com/gogo/protobuf/proto"
)
type TextDocument interface {
cache.TreeContainer
AddText(text string) error
Text() (string, error)
TreeDump() string
Close() error
}
type textDocument struct {
objTree tree.ObjectTree
account account.Service
}
func createTextDocument(
ctx context.Context,
space commonspace.Space,
account account.Service,
listener updatelistener.UpdateListener) (doc TextDocument, err error) {
payload := tree.ObjectTreeCreatePayload{
SignKey: account.Account().SignKey,
SpaceId: space.Id(),
Identity: account.Account().Identity,
}
t, err := space.CreateTree(ctx, payload, listener)
if err != nil {
return
}
return &textDocument{
objTree: t,
}, nil
}
func NewTextDocument(ctx context.Context, space commonspace.Space, id string, listener updatelistener.UpdateListener) (doc TextDocument, err error) {
t, err := space.BuildTree(ctx, id, listener)
if err != nil {
return
}
return &textDocument{
objTree: t,
}, nil
}
func (t *textDocument) Tree() tree.ObjectTree {
return t.objTree
}
func (t *textDocument) AddText(text string) (err error) {
content := &testchanges.TextContentValueOfTextAppend{
TextAppend: &testchanges.TextAppend{Text: text},
}
change := &testchanges.TextData{
Content: []*testchanges.TextContent{
{content},
},
Snapshot: nil,
}
res, err := change.Marshal()
if err != nil {
return
}
_, err = t.objTree.AddContent(context.Background(), tree.SignableChangeContent{
Data: res,
Key: t.account.Account().SignKey,
Identity: t.account.Account().Identity,
IsSnapshot: false,
})
return
}
func (t *textDocument) Text() (text string, err error) {
t.objTree.RLock()
defer t.objTree.RUnlock()
err = t.objTree.Iterate(
func(decrypted []byte) (any, error) {
textChange := &testchanges.TextData{}
err = proto.Unmarshal(decrypted, textChange)
if err != nil {
return nil, err
}
for _, cnt := range textChange.Content {
if cnt.GetTextAppend() != nil {
text += cnt.GetTextAppend().Text
}
}
return textChange, nil
}, func(change *tree.Change) bool {
return true
})
return
}
func (t *textDocument) TreeDump() string {
return t.TreeDump()
}
func (t *textDocument) Close() error {
return nil
}

View File

@ -2,10 +2,70 @@ module github.com/anytypeio/go-anytype-infrastructure-experiments/client
replace github.com/anytypeio/go-anytype-infrastructure-experiments/common => ../common replace github.com/anytypeio/go-anytype-infrastructure-experiments/common => ../common
go 1.19 go 1.19
require ( require (
github.com/anytypeio/go-anytype-infrastructure-experiments/common v0.0.0-00010101000000-000000000000 github.com/anytypeio/go-anytype-infrastructure-experiments/common v0.0.0-00010101000000-000000000000
github.com/dgraph-io/badger/v3 v3.2103.3 github.com/dgraph-io/badger/v3 v3.2103.3
github.com/gogo/protobuf v1.3.2
)
require (
github.com/anytypeio/go-chash v0.0.0-20220629194632-4ad1154fe232 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
github.com/dgraph-io/ristretto v0.1.1 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/fogleman/gg v1.3.0 // indirect
github.com/goccy/go-graphviz v0.0.9 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/google/flatbuffers v1.12.1 // indirect
github.com/huandu/skiplist v1.2.0 // indirect
github.com/ipfs/go-cid v0.3.2 // indirect
github.com/ipfs/go-log/v2 v2.5.1 // indirect
github.com/klauspost/compress v1.15.10 // indirect
github.com/klauspost/cpuid/v2 v2.1.1 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/libp2p/go-libp2p v0.23.2 // indirect
github.com/libp2p/go-libp2p-core v0.20.1 // indirect
github.com/libp2p/go-openssl v0.1.0 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mattn/go-pointer v0.0.1 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/minio/sha256-simd v1.0.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/multiformats/go-base32 v0.1.0 // indirect
github.com/multiformats/go-base36 v0.1.0 // indirect
github.com/multiformats/go-multiaddr v0.7.0 // indirect
github.com/multiformats/go-multibase v0.1.1 // indirect
github.com/multiformats/go-multicodec v0.6.0 // indirect
github.com/multiformats/go-multihash v0.2.1 // indirect
github.com/multiformats/go-varint v0.0.6 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.13.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/zeebo/blake3 v0.2.3 // indirect
github.com/zeebo/errs v1.3.0 // indirect
go.opencensus.io v0.23.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.23.0 // indirect
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
golang.org/x/image v0.0.0-20200119044424-58c23975cae1 // indirect
golang.org/x/net v0.0.0-20220920183852-bf014ff85ad5 // indirect
golang.org/x/sys v0.0.0-20221010170243-090e33056c14 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/blake3 v1.1.7 // indirect
storj.io/drpc v0.0.32 // indirect
) )

View File

@ -0,0 +1,6 @@
package util
type ReleaseContainer[T any] struct {
Object T
Release func()
}

View File

@ -17,6 +17,7 @@ type DiffService interface {
HandleRangeRequest(ctx context.Context, req *spacesyncproto.HeadSyncRequest) (resp *spacesyncproto.HeadSyncResponse, err error) HandleRangeRequest(ctx context.Context, req *spacesyncproto.HeadSyncRequest) (resp *spacesyncproto.HeadSyncResponse, err error)
UpdateHeads(id string, heads []string) UpdateHeads(id string, heads []string)
RemoveObject(id string) RemoveObject(id string)
AllIds() []string
Init(objectIds []string) Init(objectIds []string)
Close() (err error) Close() (err error)
@ -72,6 +73,10 @@ func (d *diffService) UpdateHeads(id string, heads []string) {
}) })
} }
func (d *diffService) AllIds() []string {
return d.diff.Ids()
}
func (d *diffService) RemoveObject(id string) { func (d *diffService) RemoveObject(id string) {
// TODO: add space document to remove ids // TODO: add space document to remove ids
d.diff.RemoveId(id) d.diff.RemoveId(id)

View File

@ -44,6 +44,7 @@ func NewSpaceId(id string, repKey uint64) string {
type Space interface { type Space interface {
Id() string Id() string
StoredIds() []string
SpaceSyncRpc() RpcHandler SpaceSyncRpc() RpcHandler
@ -94,6 +95,10 @@ func (s *space) DiffService() diffservice.DiffService {
return s.diffService return s.diffService
} }
func (s *space) StoredIds() []string {
return s.diffService.AllIds()
}
func (s *space) DeriveTree(ctx context.Context, payload tree2.ObjectTreeCreatePayload, listener updatelistener.UpdateListener) (tree2.ObjectTree, error) { func (s *space) DeriveTree(ctx context.Context, payload tree2.ObjectTreeCreatePayload, listener updatelistener.UpdateListener) (tree2.ObjectTree, error) {
return synctree.DeriveSyncTree(ctx, payload, s.syncService.SyncClient(), listener, s.aclList, s.storage.CreateTreeStorage) return synctree.DeriveSyncTree(ctx, payload, s.syncService.SyncClient(), listener, s.aclList, s.storage.CreateTreeStorage)
} }

View File

@ -408,11 +408,11 @@ func (m *ObjectSyncMessage) GetTrackingId() string {
// ObjectSyncContentValue provides different types for object sync // ObjectSyncContentValue provides different types for object sync
type ObjectSyncContentValue struct { type ObjectSyncContentValue struct {
// Types that are valid to be assigned to Value: // Types that are valid to be assigned to Value:
// *ObjectSyncContentValue_HeadUpdate // *ObjectSyncContentValueValueOfHeadUpdate
// *ObjectSyncContentValue_FullSyncRequest // *ObjectSyncContentValueValueOfFullSyncRequest
// *ObjectSyncContentValue_FullSyncResponse // *ObjectSyncContentValueValueOfFullSyncResponse
// *ObjectSyncContentValue_ErrorResponse // *ObjectSyncContentValueValueOfErrorResponse
Value isObjectSyncContentValue_Value `protobuf_oneof:"value"` Value IsObjectSyncContentValueValue `protobuf_oneof:"value"`
} }
func (m *ObjectSyncContentValue) Reset() { *m = ObjectSyncContentValue{} } func (m *ObjectSyncContentValue) Reset() { *m = ObjectSyncContentValue{} }
@ -448,31 +448,31 @@ func (m *ObjectSyncContentValue) XXX_DiscardUnknown() {
var xxx_messageInfo_ObjectSyncContentValue proto.InternalMessageInfo var xxx_messageInfo_ObjectSyncContentValue proto.InternalMessageInfo
type isObjectSyncContentValue_Value interface { type IsObjectSyncContentValueValue interface {
isObjectSyncContentValue_Value() IsObjectSyncContentValueValue()
MarshalTo([]byte) (int, error) MarshalTo([]byte) (int, error)
Size() int Size() int
} }
type ObjectSyncContentValue_HeadUpdate struct { type ObjectSyncContentValueValueOfHeadUpdate struct {
HeadUpdate *ObjectHeadUpdate `protobuf:"bytes,1,opt,name=headUpdate,proto3,oneof" json:"headUpdate,omitempty"` HeadUpdate *ObjectHeadUpdate `protobuf:"bytes,1,opt,name=headUpdate,proto3,oneof" json:"headUpdate,omitempty"`
} }
type ObjectSyncContentValue_FullSyncRequest struct { type ObjectSyncContentValueValueOfFullSyncRequest struct {
FullSyncRequest *ObjectFullSyncRequest `protobuf:"bytes,2,opt,name=fullSyncRequest,proto3,oneof" json:"fullSyncRequest,omitempty"` FullSyncRequest *ObjectFullSyncRequest `protobuf:"bytes,2,opt,name=fullSyncRequest,proto3,oneof" json:"fullSyncRequest,omitempty"`
} }
type ObjectSyncContentValue_FullSyncResponse struct { type ObjectSyncContentValueValueOfFullSyncResponse struct {
FullSyncResponse *ObjectFullSyncResponse `protobuf:"bytes,3,opt,name=fullSyncResponse,proto3,oneof" json:"fullSyncResponse,omitempty"` FullSyncResponse *ObjectFullSyncResponse `protobuf:"bytes,3,opt,name=fullSyncResponse,proto3,oneof" json:"fullSyncResponse,omitempty"`
} }
type ObjectSyncContentValue_ErrorResponse struct { type ObjectSyncContentValueValueOfErrorResponse struct {
ErrorResponse *ObjectErrorResponse `protobuf:"bytes,4,opt,name=errorResponse,proto3,oneof" json:"errorResponse,omitempty"` ErrorResponse *ObjectErrorResponse `protobuf:"bytes,4,opt,name=errorResponse,proto3,oneof" json:"errorResponse,omitempty"`
} }
func (*ObjectSyncContentValue_HeadUpdate) isObjectSyncContentValue_Value() {} func (*ObjectSyncContentValueValueOfHeadUpdate) IsObjectSyncContentValueValue() {}
func (*ObjectSyncContentValue_FullSyncRequest) isObjectSyncContentValue_Value() {} func (*ObjectSyncContentValueValueOfFullSyncRequest) IsObjectSyncContentValueValue() {}
func (*ObjectSyncContentValue_FullSyncResponse) isObjectSyncContentValue_Value() {} func (*ObjectSyncContentValueValueOfFullSyncResponse) IsObjectSyncContentValueValue() {}
func (*ObjectSyncContentValue_ErrorResponse) isObjectSyncContentValue_Value() {} func (*ObjectSyncContentValueValueOfErrorResponse) IsObjectSyncContentValueValue() {}
func (m *ObjectSyncContentValue) GetValue() isObjectSyncContentValue_Value { func (m *ObjectSyncContentValue) GetValue() IsObjectSyncContentValueValue {
if m != nil { if m != nil {
return m.Value return m.Value
} }
@ -480,28 +480,28 @@ func (m *ObjectSyncContentValue) GetValue() isObjectSyncContentValue_Value {
} }
func (m *ObjectSyncContentValue) GetHeadUpdate() *ObjectHeadUpdate { func (m *ObjectSyncContentValue) GetHeadUpdate() *ObjectHeadUpdate {
if x, ok := m.GetValue().(*ObjectSyncContentValue_HeadUpdate); ok { if x, ok := m.GetValue().(*ObjectSyncContentValueValueOfHeadUpdate); ok {
return x.HeadUpdate return x.HeadUpdate
} }
return nil return nil
} }
func (m *ObjectSyncContentValue) GetFullSyncRequest() *ObjectFullSyncRequest { func (m *ObjectSyncContentValue) GetFullSyncRequest() *ObjectFullSyncRequest {
if x, ok := m.GetValue().(*ObjectSyncContentValue_FullSyncRequest); ok { if x, ok := m.GetValue().(*ObjectSyncContentValueValueOfFullSyncRequest); ok {
return x.FullSyncRequest return x.FullSyncRequest
} }
return nil return nil
} }
func (m *ObjectSyncContentValue) GetFullSyncResponse() *ObjectFullSyncResponse { func (m *ObjectSyncContentValue) GetFullSyncResponse() *ObjectFullSyncResponse {
if x, ok := m.GetValue().(*ObjectSyncContentValue_FullSyncResponse); ok { if x, ok := m.GetValue().(*ObjectSyncContentValueValueOfFullSyncResponse); ok {
return x.FullSyncResponse return x.FullSyncResponse
} }
return nil return nil
} }
func (m *ObjectSyncContentValue) GetErrorResponse() *ObjectErrorResponse { func (m *ObjectSyncContentValue) GetErrorResponse() *ObjectErrorResponse {
if x, ok := m.GetValue().(*ObjectSyncContentValue_ErrorResponse); ok { if x, ok := m.GetValue().(*ObjectSyncContentValueValueOfErrorResponse); ok {
return x.ErrorResponse return x.ErrorResponse
} }
return nil return nil
@ -510,10 +510,10 @@ func (m *ObjectSyncContentValue) GetErrorResponse() *ObjectErrorResponse {
// XXX_OneofWrappers is for the internal use of the proto package. // XXX_OneofWrappers is for the internal use of the proto package.
func (*ObjectSyncContentValue) XXX_OneofWrappers() []interface{} { func (*ObjectSyncContentValue) XXX_OneofWrappers() []interface{} {
return []interface{}{ return []interface{}{
(*ObjectSyncContentValue_HeadUpdate)(nil), (*ObjectSyncContentValueValueOfHeadUpdate)(nil),
(*ObjectSyncContentValue_FullSyncRequest)(nil), (*ObjectSyncContentValueValueOfFullSyncRequest)(nil),
(*ObjectSyncContentValue_FullSyncResponse)(nil), (*ObjectSyncContentValueValueOfFullSyncResponse)(nil),
(*ObjectSyncContentValue_ErrorResponse)(nil), (*ObjectSyncContentValueValueOfErrorResponse)(nil),
} }
} }
@ -1410,12 +1410,12 @@ func (m *ObjectSyncContentValue) MarshalToSizedBuffer(dAtA []byte) (int, error)
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *ObjectSyncContentValue_HeadUpdate) MarshalTo(dAtA []byte) (int, error) { func (m *ObjectSyncContentValueValueOfHeadUpdate) MarshalTo(dAtA []byte) (int, error) {
size := m.Size() size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size]) return m.MarshalToSizedBuffer(dAtA[:size])
} }
func (m *ObjectSyncContentValue_HeadUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { func (m *ObjectSyncContentValueValueOfHeadUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA) i := len(dAtA)
if m.HeadUpdate != nil { if m.HeadUpdate != nil {
{ {
@ -1431,12 +1431,12 @@ func (m *ObjectSyncContentValue_HeadUpdate) MarshalToSizedBuffer(dAtA []byte) (i
} }
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *ObjectSyncContentValue_FullSyncRequest) MarshalTo(dAtA []byte) (int, error) { func (m *ObjectSyncContentValueValueOfFullSyncRequest) MarshalTo(dAtA []byte) (int, error) {
size := m.Size() size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size]) return m.MarshalToSizedBuffer(dAtA[:size])
} }
func (m *ObjectSyncContentValue_FullSyncRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { func (m *ObjectSyncContentValueValueOfFullSyncRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA) i := len(dAtA)
if m.FullSyncRequest != nil { if m.FullSyncRequest != nil {
{ {
@ -1452,12 +1452,12 @@ func (m *ObjectSyncContentValue_FullSyncRequest) MarshalToSizedBuffer(dAtA []byt
} }
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *ObjectSyncContentValue_FullSyncResponse) MarshalTo(dAtA []byte) (int, error) { func (m *ObjectSyncContentValueValueOfFullSyncResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size() size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size]) return m.MarshalToSizedBuffer(dAtA[:size])
} }
func (m *ObjectSyncContentValue_FullSyncResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { func (m *ObjectSyncContentValueValueOfFullSyncResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA) i := len(dAtA)
if m.FullSyncResponse != nil { if m.FullSyncResponse != nil {
{ {
@ -1473,12 +1473,12 @@ func (m *ObjectSyncContentValue_FullSyncResponse) MarshalToSizedBuffer(dAtA []by
} }
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *ObjectSyncContentValue_ErrorResponse) MarshalTo(dAtA []byte) (int, error) { func (m *ObjectSyncContentValueValueOfErrorResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size() size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size]) return m.MarshalToSizedBuffer(dAtA[:size])
} }
func (m *ObjectSyncContentValue_ErrorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { func (m *ObjectSyncContentValueValueOfErrorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA) i := len(dAtA)
if m.ErrorResponse != nil { if m.ErrorResponse != nil {
{ {
@ -2030,7 +2030,7 @@ func (m *ObjectSyncContentValue) Size() (n int) {
return n return n
} }
func (m *ObjectSyncContentValue_HeadUpdate) Size() (n int) { func (m *ObjectSyncContentValueValueOfHeadUpdate) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
} }
@ -2042,7 +2042,7 @@ func (m *ObjectSyncContentValue_HeadUpdate) Size() (n int) {
} }
return n return n
} }
func (m *ObjectSyncContentValue_FullSyncRequest) Size() (n int) { func (m *ObjectSyncContentValueValueOfFullSyncRequest) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
} }
@ -2054,7 +2054,7 @@ func (m *ObjectSyncContentValue_FullSyncRequest) Size() (n int) {
} }
return n return n
} }
func (m *ObjectSyncContentValue_FullSyncResponse) Size() (n int) { func (m *ObjectSyncContentValueValueOfFullSyncResponse) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
} }
@ -2066,7 +2066,7 @@ func (m *ObjectSyncContentValue_FullSyncResponse) Size() (n int) {
} }
return n return n
} }
func (m *ObjectSyncContentValue_ErrorResponse) Size() (n int) { func (m *ObjectSyncContentValueValueOfErrorResponse) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
} }
@ -3103,7 +3103,7 @@ func (m *ObjectSyncContentValue) Unmarshal(dAtA []byte) error {
if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err return err
} }
m.Value = &ObjectSyncContentValue_HeadUpdate{v} m.Value = &ObjectSyncContentValueValueOfHeadUpdate{v}
iNdEx = postIndex iNdEx = postIndex
case 2: case 2:
if wireType != 2 { if wireType != 2 {
@ -3138,7 +3138,7 @@ func (m *ObjectSyncContentValue) Unmarshal(dAtA []byte) error {
if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err return err
} }
m.Value = &ObjectSyncContentValue_FullSyncRequest{v} m.Value = &ObjectSyncContentValueValueOfFullSyncRequest{v}
iNdEx = postIndex iNdEx = postIndex
case 3: case 3:
if wireType != 2 { if wireType != 2 {
@ -3173,7 +3173,7 @@ func (m *ObjectSyncContentValue) Unmarshal(dAtA []byte) error {
if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err return err
} }
m.Value = &ObjectSyncContentValue_FullSyncResponse{v} m.Value = &ObjectSyncContentValueValueOfFullSyncResponse{v}
iNdEx = postIndex iNdEx = postIndex
case 4: case 4:
if wireType != 2 { if wireType != 2 {
@ -3208,7 +3208,7 @@ func (m *ObjectSyncContentValue) Unmarshal(dAtA []byte) error {
if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err return err
} }
m.Value = &ObjectSyncContentValue_ErrorResponse{v} m.Value = &ObjectSyncContentValueValueOfErrorResponse{v}
iNdEx = postIndex iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex

View File

@ -324,13 +324,12 @@ func (m *ACLRoot) GetTimestamp() int64 {
type ACLContentValue struct { type ACLContentValue struct {
// Types that are valid to be assigned to Value: // Types that are valid to be assigned to Value:
// // *ACLContentValueValueOfUserAdd
// *ACLContentValue_UserAdd // *ACLContentValueValueOfUserRemove
// *ACLContentValue_UserRemove // *ACLContentValueValueOfUserPermissionChange
// *ACLContentValue_UserPermissionChange // *ACLContentValueValueOfUserInvite
// *ACLContentValue_UserInvite // *ACLContentValueValueOfUserJoin
// *ACLContentValue_UserJoin Value IsACLContentValueValue `protobuf_oneof:"value"`
Value isACLContentValue_Value `protobuf_oneof:"value"`
} }
func (m *ACLContentValue) Reset() { *m = ACLContentValue{} } func (m *ACLContentValue) Reset() { *m = ACLContentValue{} }
@ -366,35 +365,35 @@ func (m *ACLContentValue) XXX_DiscardUnknown() {
var xxx_messageInfo_ACLContentValue proto.InternalMessageInfo var xxx_messageInfo_ACLContentValue proto.InternalMessageInfo
type isACLContentValue_Value interface { type IsACLContentValueValue interface {
isACLContentValue_Value() IsACLContentValueValue()
MarshalTo([]byte) (int, error) MarshalTo([]byte) (int, error)
Size() int Size() int
} }
type ACLContentValue_UserAdd struct { type ACLContentValueValueOfUserAdd struct {
UserAdd *ACLUserAdd `protobuf:"bytes,1,opt,name=userAdd,proto3,oneof" json:"userAdd,omitempty"` UserAdd *ACLUserAdd `protobuf:"bytes,1,opt,name=userAdd,proto3,oneof" json:"userAdd,omitempty"`
} }
type ACLContentValue_UserRemove struct { type ACLContentValueValueOfUserRemove struct {
UserRemove *ACLUserRemove `protobuf:"bytes,2,opt,name=userRemove,proto3,oneof" json:"userRemove,omitempty"` UserRemove *ACLUserRemove `protobuf:"bytes,2,opt,name=userRemove,proto3,oneof" json:"userRemove,omitempty"`
} }
type ACLContentValue_UserPermissionChange struct { type ACLContentValueValueOfUserPermissionChange struct {
UserPermissionChange *ACLUserPermissionChange `protobuf:"bytes,3,opt,name=userPermissionChange,proto3,oneof" json:"userPermissionChange,omitempty"` UserPermissionChange *ACLUserPermissionChange `protobuf:"bytes,3,opt,name=userPermissionChange,proto3,oneof" json:"userPermissionChange,omitempty"`
} }
type ACLContentValue_UserInvite struct { type ACLContentValueValueOfUserInvite struct {
UserInvite *ACLUserInvite `protobuf:"bytes,4,opt,name=userInvite,proto3,oneof" json:"userInvite,omitempty"` UserInvite *ACLUserInvite `protobuf:"bytes,4,opt,name=userInvite,proto3,oneof" json:"userInvite,omitempty"`
} }
type ACLContentValue_UserJoin struct { type ACLContentValueValueOfUserJoin struct {
UserJoin *ACLUserJoin `protobuf:"bytes,5,opt,name=userJoin,proto3,oneof" json:"userJoin,omitempty"` UserJoin *ACLUserJoin `protobuf:"bytes,5,opt,name=userJoin,proto3,oneof" json:"userJoin,omitempty"`
} }
func (*ACLContentValue_UserAdd) isACLContentValue_Value() {} func (*ACLContentValueValueOfUserAdd) IsACLContentValueValue() {}
func (*ACLContentValue_UserRemove) isACLContentValue_Value() {} func (*ACLContentValueValueOfUserRemove) IsACLContentValueValue() {}
func (*ACLContentValue_UserPermissionChange) isACLContentValue_Value() {} func (*ACLContentValueValueOfUserPermissionChange) IsACLContentValueValue() {}
func (*ACLContentValue_UserInvite) isACLContentValue_Value() {} func (*ACLContentValueValueOfUserInvite) IsACLContentValueValue() {}
func (*ACLContentValue_UserJoin) isACLContentValue_Value() {} func (*ACLContentValueValueOfUserJoin) IsACLContentValueValue() {}
func (m *ACLContentValue) GetValue() isACLContentValue_Value { func (m *ACLContentValue) GetValue() IsACLContentValueValue {
if m != nil { if m != nil {
return m.Value return m.Value
} }
@ -402,35 +401,35 @@ func (m *ACLContentValue) GetValue() isACLContentValue_Value {
} }
func (m *ACLContentValue) GetUserAdd() *ACLUserAdd { func (m *ACLContentValue) GetUserAdd() *ACLUserAdd {
if x, ok := m.GetValue().(*ACLContentValue_UserAdd); ok { if x, ok := m.GetValue().(*ACLContentValueValueOfUserAdd); ok {
return x.UserAdd return x.UserAdd
} }
return nil return nil
} }
func (m *ACLContentValue) GetUserRemove() *ACLUserRemove { func (m *ACLContentValue) GetUserRemove() *ACLUserRemove {
if x, ok := m.GetValue().(*ACLContentValue_UserRemove); ok { if x, ok := m.GetValue().(*ACLContentValueValueOfUserRemove); ok {
return x.UserRemove return x.UserRemove
} }
return nil return nil
} }
func (m *ACLContentValue) GetUserPermissionChange() *ACLUserPermissionChange { func (m *ACLContentValue) GetUserPermissionChange() *ACLUserPermissionChange {
if x, ok := m.GetValue().(*ACLContentValue_UserPermissionChange); ok { if x, ok := m.GetValue().(*ACLContentValueValueOfUserPermissionChange); ok {
return x.UserPermissionChange return x.UserPermissionChange
} }
return nil return nil
} }
func (m *ACLContentValue) GetUserInvite() *ACLUserInvite { func (m *ACLContentValue) GetUserInvite() *ACLUserInvite {
if x, ok := m.GetValue().(*ACLContentValue_UserInvite); ok { if x, ok := m.GetValue().(*ACLContentValueValueOfUserInvite); ok {
return x.UserInvite return x.UserInvite
} }
return nil return nil
} }
func (m *ACLContentValue) GetUserJoin() *ACLUserJoin { func (m *ACLContentValue) GetUserJoin() *ACLUserJoin {
if x, ok := m.GetValue().(*ACLContentValue_UserJoin); ok { if x, ok := m.GetValue().(*ACLContentValueValueOfUserJoin); ok {
return x.UserJoin return x.UserJoin
} }
return nil return nil
@ -439,11 +438,11 @@ func (m *ACLContentValue) GetUserJoin() *ACLUserJoin {
// XXX_OneofWrappers is for the internal use of the proto package. // XXX_OneofWrappers is for the internal use of the proto package.
func (*ACLContentValue) XXX_OneofWrappers() []interface{} { func (*ACLContentValue) XXX_OneofWrappers() []interface{} {
return []interface{}{ return []interface{}{
(*ACLContentValue_UserAdd)(nil), (*ACLContentValueValueOfUserAdd)(nil),
(*ACLContentValue_UserRemove)(nil), (*ACLContentValueValueOfUserRemove)(nil),
(*ACLContentValue_UserPermissionChange)(nil), (*ACLContentValueValueOfUserPermissionChange)(nil),
(*ACLContentValue_UserInvite)(nil), (*ACLContentValueValueOfUserInvite)(nil),
(*ACLContentValue_UserJoin)(nil), (*ACLContentValueValueOfUserJoin)(nil),
} }
} }
@ -1304,12 +1303,12 @@ func (m *ACLContentValue) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *ACLContentValue_UserAdd) MarshalTo(dAtA []byte) (int, error) { func (m *ACLContentValueValueOfUserAdd) MarshalTo(dAtA []byte) (int, error) {
size := m.Size() size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size]) return m.MarshalToSizedBuffer(dAtA[:size])
} }
func (m *ACLContentValue_UserAdd) MarshalToSizedBuffer(dAtA []byte) (int, error) { func (m *ACLContentValueValueOfUserAdd) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA) i := len(dAtA)
if m.UserAdd != nil { if m.UserAdd != nil {
{ {
@ -1325,12 +1324,12 @@ func (m *ACLContentValue_UserAdd) MarshalToSizedBuffer(dAtA []byte) (int, error)
} }
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *ACLContentValue_UserRemove) MarshalTo(dAtA []byte) (int, error) { func (m *ACLContentValueValueOfUserRemove) MarshalTo(dAtA []byte) (int, error) {
size := m.Size() size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size]) return m.MarshalToSizedBuffer(dAtA[:size])
} }
func (m *ACLContentValue_UserRemove) MarshalToSizedBuffer(dAtA []byte) (int, error) { func (m *ACLContentValueValueOfUserRemove) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA) i := len(dAtA)
if m.UserRemove != nil { if m.UserRemove != nil {
{ {
@ -1346,12 +1345,12 @@ func (m *ACLContentValue_UserRemove) MarshalToSizedBuffer(dAtA []byte) (int, err
} }
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *ACLContentValue_UserPermissionChange) MarshalTo(dAtA []byte) (int, error) { func (m *ACLContentValueValueOfUserPermissionChange) MarshalTo(dAtA []byte) (int, error) {
size := m.Size() size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size]) return m.MarshalToSizedBuffer(dAtA[:size])
} }
func (m *ACLContentValue_UserPermissionChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { func (m *ACLContentValueValueOfUserPermissionChange) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA) i := len(dAtA)
if m.UserPermissionChange != nil { if m.UserPermissionChange != nil {
{ {
@ -1367,12 +1366,12 @@ func (m *ACLContentValue_UserPermissionChange) MarshalToSizedBuffer(dAtA []byte)
} }
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *ACLContentValue_UserInvite) MarshalTo(dAtA []byte) (int, error) { func (m *ACLContentValueValueOfUserInvite) MarshalTo(dAtA []byte) (int, error) {
size := m.Size() size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size]) return m.MarshalToSizedBuffer(dAtA[:size])
} }
func (m *ACLContentValue_UserInvite) MarshalToSizedBuffer(dAtA []byte) (int, error) { func (m *ACLContentValueValueOfUserInvite) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA) i := len(dAtA)
if m.UserInvite != nil { if m.UserInvite != nil {
{ {
@ -1388,12 +1387,12 @@ func (m *ACLContentValue_UserInvite) MarshalToSizedBuffer(dAtA []byte) (int, err
} }
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *ACLContentValue_UserJoin) MarshalTo(dAtA []byte) (int, error) { func (m *ACLContentValueValueOfUserJoin) MarshalTo(dAtA []byte) (int, error) {
size := m.Size() size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size]) return m.MarshalToSizedBuffer(dAtA[:size])
} }
func (m *ACLContentValue_UserJoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { func (m *ACLContentValueValueOfUserJoin) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA) i := len(dAtA)
if m.UserJoin != nil { if m.UserJoin != nil {
{ {
@ -1980,7 +1979,7 @@ func (m *ACLContentValue) Size() (n int) {
return n return n
} }
func (m *ACLContentValue_UserAdd) Size() (n int) { func (m *ACLContentValueValueOfUserAdd) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
} }
@ -1992,7 +1991,7 @@ func (m *ACLContentValue_UserAdd) Size() (n int) {
} }
return n return n
} }
func (m *ACLContentValue_UserRemove) Size() (n int) { func (m *ACLContentValueValueOfUserRemove) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
} }
@ -2004,7 +2003,7 @@ func (m *ACLContentValue_UserRemove) Size() (n int) {
} }
return n return n
} }
func (m *ACLContentValue_UserPermissionChange) Size() (n int) { func (m *ACLContentValueValueOfUserPermissionChange) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
} }
@ -2016,7 +2015,7 @@ func (m *ACLContentValue_UserPermissionChange) Size() (n int) {
} }
return n return n
} }
func (m *ACLContentValue_UserInvite) Size() (n int) { func (m *ACLContentValueValueOfUserInvite) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
} }
@ -2028,7 +2027,7 @@ func (m *ACLContentValue_UserInvite) Size() (n int) {
} }
return n return n
} }
func (m *ACLContentValue_UserJoin) Size() (n int) { func (m *ACLContentValueValueOfUserJoin) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
} }
@ -2997,7 +2996,7 @@ func (m *ACLContentValue) Unmarshal(dAtA []byte) error {
if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err return err
} }
m.Value = &ACLContentValue_UserAdd{v} m.Value = &ACLContentValueValueOfUserAdd{v}
iNdEx = postIndex iNdEx = postIndex
case 2: case 2:
if wireType != 2 { if wireType != 2 {
@ -3032,7 +3031,7 @@ func (m *ACLContentValue) Unmarshal(dAtA []byte) error {
if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err return err
} }
m.Value = &ACLContentValue_UserRemove{v} m.Value = &ACLContentValueValueOfUserRemove{v}
iNdEx = postIndex iNdEx = postIndex
case 3: case 3:
if wireType != 2 { if wireType != 2 {
@ -3067,7 +3066,7 @@ func (m *ACLContentValue) Unmarshal(dAtA []byte) error {
if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err return err
} }
m.Value = &ACLContentValue_UserPermissionChange{v} m.Value = &ACLContentValueValueOfUserPermissionChange{v}
iNdEx = postIndex iNdEx = postIndex
case 4: case 4:
if wireType != 2 { if wireType != 2 {
@ -3102,7 +3101,7 @@ func (m *ACLContentValue) Unmarshal(dAtA []byte) error {
if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err return err
} }
m.Value = &ACLContentValue_UserInvite{v} m.Value = &ACLContentValueValueOfUserInvite{v}
iNdEx = postIndex iNdEx = postIndex
case 5: case 5:
if wireType != 2 { if wireType != 2 {
@ -3137,7 +3136,7 @@ func (m *ACLContentValue) Unmarshal(dAtA []byte) error {
if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err return err
} }
m.Value = &ACLContentValue_UserJoin{v} m.Value = &ACLContentValueValueOfUserJoin{v}
iNdEx = postIndex iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex

View File

@ -22,21 +22,24 @@ var _ = math.Inf
// proto package needs to be updated. // proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type PlainTextChange struct { type TextContent struct {
// Types that are valid to be assigned to Value:
// *TextContentValueOfTextAppend
Value IsTextContentValue `protobuf_oneof:"value"`
} }
func (m *PlainTextChange) Reset() { *m = PlainTextChange{} } func (m *TextContent) Reset() { *m = TextContent{} }
func (m *PlainTextChange) String() string { return proto.CompactTextString(m) } func (m *TextContent) String() string { return proto.CompactTextString(m) }
func (*PlainTextChange) ProtoMessage() {} func (*TextContent) ProtoMessage() {}
func (*PlainTextChange) Descriptor() ([]byte, []int) { func (*TextContent) Descriptor() ([]byte, []int) {
return fileDescriptor_37f33c266ada4318, []int{0} return fileDescriptor_37f33c266ada4318, []int{0}
} }
func (m *PlainTextChange) XXX_Unmarshal(b []byte) error { func (m *TextContent) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
} }
func (m *PlainTextChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *TextContent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic { if deterministic {
return xxx_messageInfo_PlainTextChange.Marshal(b, m, deterministic) return xxx_messageInfo_TextContent.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b) n, err := m.MarshalToSizedBuffer(b)
@ -46,107 +49,67 @@ func (m *PlainTextChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, err
return b[:n], nil return b[:n], nil
} }
} }
func (m *PlainTextChange) XXX_Merge(src proto.Message) { func (m *TextContent) XXX_Merge(src proto.Message) {
xxx_messageInfo_PlainTextChange.Merge(m, src) xxx_messageInfo_TextContent.Merge(m, src)
} }
func (m *PlainTextChange) XXX_Size() int { func (m *TextContent) XXX_Size() int {
return m.Size() return m.Size()
} }
func (m *PlainTextChange) XXX_DiscardUnknown() { func (m *TextContent) XXX_DiscardUnknown() {
xxx_messageInfo_PlainTextChange.DiscardUnknown(m) xxx_messageInfo_TextContent.DiscardUnknown(m)
} }
var xxx_messageInfo_PlainTextChange proto.InternalMessageInfo var xxx_messageInfo_TextContent proto.InternalMessageInfo
type PlainTextChange_Content struct { type IsTextContentValue interface {
// Types that are valid to be assigned to Value: IsTextContentValue()
//
// *PlainTextChange_Content_TextAppend
Value isPlainTextChange_Content_Value `protobuf_oneof:"value"`
}
func (m *PlainTextChange_Content) Reset() { *m = PlainTextChange_Content{} }
func (m *PlainTextChange_Content) String() string { return proto.CompactTextString(m) }
func (*PlainTextChange_Content) ProtoMessage() {}
func (*PlainTextChange_Content) Descriptor() ([]byte, []int) {
return fileDescriptor_37f33c266ada4318, []int{0, 0}
}
func (m *PlainTextChange_Content) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *PlainTextChange_Content) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_PlainTextChange_Content.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 *PlainTextChange_Content) XXX_Merge(src proto.Message) {
xxx_messageInfo_PlainTextChange_Content.Merge(m, src)
}
func (m *PlainTextChange_Content) XXX_Size() int {
return m.Size()
}
func (m *PlainTextChange_Content) XXX_DiscardUnknown() {
xxx_messageInfo_PlainTextChange_Content.DiscardUnknown(m)
}
var xxx_messageInfo_PlainTextChange_Content proto.InternalMessageInfo
type isPlainTextChange_Content_Value interface {
isPlainTextChange_Content_Value()
MarshalTo([]byte) (int, error) MarshalTo([]byte) (int, error)
Size() int Size() int
} }
type PlainTextChange_Content_TextAppend struct { type TextContentValueOfTextAppend struct {
TextAppend *PlainTextChange_TextAppend `protobuf:"bytes,1,opt,name=textAppend,proto3,oneof" json:"textAppend,omitempty"` TextAppend *TextAppend `protobuf:"bytes,1,opt,name=textAppend,proto3,oneof" json:"textAppend,omitempty"`
} }
func (*PlainTextChange_Content_TextAppend) isPlainTextChange_Content_Value() {} func (*TextContentValueOfTextAppend) IsTextContentValue() {}
func (m *PlainTextChange_Content) GetValue() isPlainTextChange_Content_Value { func (m *TextContent) GetValue() IsTextContentValue {
if m != nil { if m != nil {
return m.Value return m.Value
} }
return nil return nil
} }
func (m *PlainTextChange_Content) GetTextAppend() *PlainTextChange_TextAppend { func (m *TextContent) GetTextAppend() *TextAppend {
if x, ok := m.GetValue().(*PlainTextChange_Content_TextAppend); ok { if x, ok := m.GetValue().(*TextContentValueOfTextAppend); ok {
return x.TextAppend return x.TextAppend
} }
return nil return nil
} }
// XXX_OneofWrappers is for the internal use of the proto package. // XXX_OneofWrappers is for the internal use of the proto package.
func (*PlainTextChange_Content) XXX_OneofWrappers() []interface{} { func (*TextContent) XXX_OneofWrappers() []interface{} {
return []interface{}{ return []interface{}{
(*PlainTextChange_Content_TextAppend)(nil), (*TextContentValueOfTextAppend)(nil),
} }
} }
type PlainTextChange_TextAppend struct { type TextAppend struct {
Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"` Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
} }
func (m *PlainTextChange_TextAppend) Reset() { *m = PlainTextChange_TextAppend{} } func (m *TextAppend) Reset() { *m = TextAppend{} }
func (m *PlainTextChange_TextAppend) String() string { return proto.CompactTextString(m) } func (m *TextAppend) String() string { return proto.CompactTextString(m) }
func (*PlainTextChange_TextAppend) ProtoMessage() {} func (*TextAppend) ProtoMessage() {}
func (*PlainTextChange_TextAppend) Descriptor() ([]byte, []int) { func (*TextAppend) Descriptor() ([]byte, []int) {
return fileDescriptor_37f33c266ada4318, []int{0, 1} return fileDescriptor_37f33c266ada4318, []int{1}
} }
func (m *PlainTextChange_TextAppend) XXX_Unmarshal(b []byte) error { func (m *TextAppend) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
} }
func (m *PlainTextChange_TextAppend) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *TextAppend) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic { if deterministic {
return xxx_messageInfo_PlainTextChange_TextAppend.Marshal(b, m, deterministic) return xxx_messageInfo_TextAppend.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b) n, err := m.MarshalToSizedBuffer(b)
@ -156,41 +119,41 @@ func (m *PlainTextChange_TextAppend) XXX_Marshal(b []byte, deterministic bool) (
return b[:n], nil return b[:n], nil
} }
} }
func (m *PlainTextChange_TextAppend) XXX_Merge(src proto.Message) { func (m *TextAppend) XXX_Merge(src proto.Message) {
xxx_messageInfo_PlainTextChange_TextAppend.Merge(m, src) xxx_messageInfo_TextAppend.Merge(m, src)
} }
func (m *PlainTextChange_TextAppend) XXX_Size() int { func (m *TextAppend) XXX_Size() int {
return m.Size() return m.Size()
} }
func (m *PlainTextChange_TextAppend) XXX_DiscardUnknown() { func (m *TextAppend) XXX_DiscardUnknown() {
xxx_messageInfo_PlainTextChange_TextAppend.DiscardUnknown(m) xxx_messageInfo_TextAppend.DiscardUnknown(m)
} }
var xxx_messageInfo_PlainTextChange_TextAppend proto.InternalMessageInfo var xxx_messageInfo_TextAppend proto.InternalMessageInfo
func (m *PlainTextChange_TextAppend) GetText() string { func (m *TextAppend) GetText() string {
if m != nil { if m != nil {
return m.Text return m.Text
} }
return "" return ""
} }
type PlainTextChange_Snapshot struct { type TextSnapshot struct {
Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"` Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
} }
func (m *PlainTextChange_Snapshot) Reset() { *m = PlainTextChange_Snapshot{} } func (m *TextSnapshot) Reset() { *m = TextSnapshot{} }
func (m *PlainTextChange_Snapshot) String() string { return proto.CompactTextString(m) } func (m *TextSnapshot) String() string { return proto.CompactTextString(m) }
func (*PlainTextChange_Snapshot) ProtoMessage() {} func (*TextSnapshot) ProtoMessage() {}
func (*PlainTextChange_Snapshot) Descriptor() ([]byte, []int) { func (*TextSnapshot) Descriptor() ([]byte, []int) {
return fileDescriptor_37f33c266ada4318, []int{0, 2} return fileDescriptor_37f33c266ada4318, []int{2}
} }
func (m *PlainTextChange_Snapshot) XXX_Unmarshal(b []byte) error { func (m *TextSnapshot) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
} }
func (m *PlainTextChange_Snapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *TextSnapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic { if deterministic {
return xxx_messageInfo_PlainTextChange_Snapshot.Marshal(b, m, deterministic) return xxx_messageInfo_TextSnapshot.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b) n, err := m.MarshalToSizedBuffer(b)
@ -200,42 +163,42 @@ func (m *PlainTextChange_Snapshot) XXX_Marshal(b []byte, deterministic bool) ([]
return b[:n], nil return b[:n], nil
} }
} }
func (m *PlainTextChange_Snapshot) XXX_Merge(src proto.Message) { func (m *TextSnapshot) XXX_Merge(src proto.Message) {
xxx_messageInfo_PlainTextChange_Snapshot.Merge(m, src) xxx_messageInfo_TextSnapshot.Merge(m, src)
} }
func (m *PlainTextChange_Snapshot) XXX_Size() int { func (m *TextSnapshot) XXX_Size() int {
return m.Size() return m.Size()
} }
func (m *PlainTextChange_Snapshot) XXX_DiscardUnknown() { func (m *TextSnapshot) XXX_DiscardUnknown() {
xxx_messageInfo_PlainTextChange_Snapshot.DiscardUnknown(m) xxx_messageInfo_TextSnapshot.DiscardUnknown(m)
} }
var xxx_messageInfo_PlainTextChange_Snapshot proto.InternalMessageInfo var xxx_messageInfo_TextSnapshot proto.InternalMessageInfo
func (m *PlainTextChange_Snapshot) GetText() string { func (m *TextSnapshot) GetText() string {
if m != nil { if m != nil {
return m.Text return m.Text
} }
return "" return ""
} }
type PlainTextChange_Data struct { type TextData struct {
Content []*PlainTextChange_Content `protobuf:"bytes,1,rep,name=content,proto3" json:"content,omitempty"` Content []*TextContent `protobuf:"bytes,1,rep,name=content,proto3" json:"content,omitempty"`
Snapshot *PlainTextChange_Snapshot `protobuf:"bytes,2,opt,name=snapshot,proto3" json:"snapshot,omitempty"` Snapshot *TextSnapshot `protobuf:"bytes,2,opt,name=snapshot,proto3" json:"snapshot,omitempty"`
} }
func (m *PlainTextChange_Data) Reset() { *m = PlainTextChange_Data{} } func (m *TextData) Reset() { *m = TextData{} }
func (m *PlainTextChange_Data) String() string { return proto.CompactTextString(m) } func (m *TextData) String() string { return proto.CompactTextString(m) }
func (*PlainTextChange_Data) ProtoMessage() {} func (*TextData) ProtoMessage() {}
func (*PlainTextChange_Data) Descriptor() ([]byte, []int) { func (*TextData) Descriptor() ([]byte, []int) {
return fileDescriptor_37f33c266ada4318, []int{0, 3} return fileDescriptor_37f33c266ada4318, []int{3}
} }
func (m *PlainTextChange_Data) XXX_Unmarshal(b []byte) error { func (m *TextData) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b) return m.Unmarshal(b)
} }
func (m *PlainTextChange_Data) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *TextData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic { if deterministic {
return xxx_messageInfo_PlainTextChange_Data.Marshal(b, m, deterministic) return xxx_messageInfo_TextData.Marshal(b, m, deterministic)
} else { } else {
b = b[:cap(b)] b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b) n, err := m.MarshalToSizedBuffer(b)
@ -245,26 +208,26 @@ func (m *PlainTextChange_Data) XXX_Marshal(b []byte, deterministic bool) ([]byte
return b[:n], nil return b[:n], nil
} }
} }
func (m *PlainTextChange_Data) XXX_Merge(src proto.Message) { func (m *TextData) XXX_Merge(src proto.Message) {
xxx_messageInfo_PlainTextChange_Data.Merge(m, src) xxx_messageInfo_TextData.Merge(m, src)
} }
func (m *PlainTextChange_Data) XXX_Size() int { func (m *TextData) XXX_Size() int {
return m.Size() return m.Size()
} }
func (m *PlainTextChange_Data) XXX_DiscardUnknown() { func (m *TextData) XXX_DiscardUnknown() {
xxx_messageInfo_PlainTextChange_Data.DiscardUnknown(m) xxx_messageInfo_TextData.DiscardUnknown(m)
} }
var xxx_messageInfo_PlainTextChange_Data proto.InternalMessageInfo var xxx_messageInfo_TextData proto.InternalMessageInfo
func (m *PlainTextChange_Data) GetContent() []*PlainTextChange_Content { func (m *TextData) GetContent() []*TextContent {
if m != nil { if m != nil {
return m.Content return m.Content
} }
return nil return nil
} }
func (m *PlainTextChange_Data) GetSnapshot() *PlainTextChange_Snapshot { func (m *TextData) GetSnapshot() *TextSnapshot {
if m != nil { if m != nil {
return m.Snapshot return m.Snapshot
} }
@ -272,11 +235,10 @@ func (m *PlainTextChange_Data) GetSnapshot() *PlainTextChange_Snapshot {
} }
func init() { func init() {
proto.RegisterType((*PlainTextChange)(nil), "anytype.PlainTextChange") proto.RegisterType((*TextContent)(nil), "anytype.TextContent")
proto.RegisterType((*PlainTextChange_Content)(nil), "anytype.PlainTextChange.Content") proto.RegisterType((*TextAppend)(nil), "anytype.TextAppend")
proto.RegisterType((*PlainTextChange_TextAppend)(nil), "anytype.PlainTextChange.TextAppend") proto.RegisterType((*TextSnapshot)(nil), "anytype.TextSnapshot")
proto.RegisterType((*PlainTextChange_Snapshot)(nil), "anytype.PlainTextChange.Snapshot") proto.RegisterType((*TextData)(nil), "anytype.TextData")
proto.RegisterType((*PlainTextChange_Data)(nil), "anytype.PlainTextChange.Data")
} }
func init() { func init() {
@ -284,27 +246,26 @@ func init() {
} }
var fileDescriptor_37f33c266ada4318 = []byte{ var fileDescriptor_37f33c266ada4318 = []byte{
// 266 bytes of a gzipped FileDescriptorProto // 252 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x2b, 0xc8, 0x4e, 0xd7, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x2b, 0xc8, 0x4e, 0xd7,
0x4f, 0x4c, 0xce, 0xd1, 0x2f, 0x49, 0x2d, 0x2e, 0x29, 0x2d, 0xc9, 0xcc, 0x29, 0x06, 0xb3, 0x92, 0x4f, 0x4c, 0xce, 0xd1, 0x2f, 0x49, 0x2d, 0x2e, 0x29, 0x2d, 0xc9, 0xcc, 0x29, 0x06, 0xb3, 0x92,
0x33, 0x12, 0xf3, 0xd2, 0x53, 0x8b, 0xf5, 0x0b, 0x8a, 0xf2, 0x4b, 0xf2, 0xc1, 0x22, 0x7a, 0x60, 0x33, 0x12, 0xf3, 0xd2, 0x53, 0x8b, 0xf5, 0x0b, 0x8a, 0xf2, 0x4b, 0xf2, 0xc1, 0x22, 0x7a, 0x60,
0xa6, 0x10, 0x7b, 0x62, 0x5e, 0x65, 0x49, 0x65, 0x41, 0xaa, 0xd2, 0x26, 0x26, 0x2e, 0xfe, 0x80, 0xa6, 0x10, 0x7b, 0x62, 0x5e, 0x65, 0x49, 0x65, 0x41, 0xaa, 0x92, 0x2f, 0x17, 0x77, 0x48, 0x6a,
0x9c, 0xc4, 0xcc, 0xbc, 0x90, 0xd4, 0x8a, 0x12, 0x67, 0xb0, 0x72, 0xa9, 0x48, 0x2e, 0x76, 0xe7, 0x45, 0x89, 0x73, 0x7e, 0x5e, 0x49, 0x6a, 0x5e, 0x89, 0x90, 0x29, 0x17, 0x57, 0x49, 0x6a, 0x45,
0xfc, 0xbc, 0x92, 0xd4, 0xbc, 0x12, 0x21, 0x57, 0x2e, 0xae, 0x92, 0xd4, 0x8a, 0x12, 0xc7, 0x82, 0x89, 0x63, 0x41, 0x41, 0x6a, 0x5e, 0x8a, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xb7, 0x91, 0xb0, 0x1e,
0x82, 0xd4, 0xbc, 0x14, 0x09, 0x46, 0x05, 0x46, 0x0d, 0x6e, 0x23, 0x65, 0x3d, 0xa8, 0x66, 0x3d, 0x54, 0xb1, 0x5e, 0x08, 0x5c, 0xca, 0x83, 0x21, 0x08, 0x49, 0xa1, 0x13, 0x3b, 0x17, 0x6b, 0x59,
0x34, 0x8d, 0x7a, 0x21, 0x70, 0xa5, 0x1e, 0x0c, 0x41, 0x48, 0x1a, 0x9d, 0xd8, 0xb9, 0x58, 0xcb, 0x62, 0x4e, 0x69, 0xaa, 0x92, 0x02, 0x17, 0x17, 0x42, 0x91, 0x90, 0x10, 0x17, 0x0b, 0x48, 0x11,
0x12, 0x73, 0x4a, 0x53, 0xa5, 0x14, 0xb8, 0xb8, 0x10, 0x8a, 0x84, 0x84, 0xb8, 0x58, 0x40, 0x8a, 0xd8, 0x1c, 0xce, 0x20, 0x30, 0x5b, 0x49, 0x89, 0x8b, 0x07, 0xa4, 0x22, 0x38, 0x2f, 0xb1, 0xa0,
0xc0, 0xe6, 0x72, 0x06, 0x81, 0xd9, 0x52, 0x72, 0x5c, 0x1c, 0xc1, 0x79, 0x89, 0x05, 0xc5, 0x19, 0x38, 0x23, 0xbf, 0x04, 0xab, 0x9a, 0x5c, 0x2e, 0x0e, 0x90, 0x1a, 0x97, 0xc4, 0x92, 0x44, 0x21,
0xf9, 0x25, 0x58, 0xe5, 0x1b, 0x19, 0xb9, 0x58, 0x5c, 0x12, 0x4b, 0x12, 0x85, 0xac, 0xb8, 0xd8, 0x3d, 0x2e, 0xf6, 0x64, 0x88, 0xe3, 0x24, 0x18, 0x15, 0x98, 0x35, 0xb8, 0x8d, 0x44, 0x50, 0x9c,
0x93, 0x21, 0xae, 0x94, 0x60, 0x54, 0x60, 0xd6, 0xe0, 0x36, 0x52, 0xc0, 0xe9, 0x2e, 0xa8, 0x6f, 0x03, 0x75, 0x78, 0x10, 0x4c, 0x91, 0x90, 0x21, 0x17, 0x47, 0x31, 0xd4, 0x6c, 0x09, 0x26, 0xb0,
0x82, 0x60, 0x1a, 0x84, 0x6c, 0xb9, 0x38, 0x8a, 0xa1, 0x96, 0x48, 0x30, 0x81, 0x3d, 0xa5, 0x88, 0xfb, 0x45, 0x51, 0x34, 0xc0, 0x2c, 0x0e, 0x82, 0x2b, 0x73, 0x52, 0x3d, 0xf1, 0x48, 0x8e, 0xf1,
0x53, 0x33, 0xcc, 0x35, 0x41, 0x70, 0x2d, 0x4e, 0xaa, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e,
0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x6e, 0xa4, 0x40, 0x4c, 0x62, 0x03, 0x07, 0x9d, 0x31, 0x20,
0x2c, 0xc7, 0x10, 0xc5, 0x8d, 0x14, 0xea, 0x49, 0x6c, 0xe0, 0xb0, 0x36, 0x06, 0x04, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdc, 0xbf, 0x78, 0xe5, 0x6c, 0x01, 0x00, 0x00,
0xff, 0xff, 0xf8, 0x8c, 0x6a, 0x1d, 0x9d, 0x01, 0x00, 0x00,
} }
func (m *PlainTextChange) Marshal() (dAtA []byte, err error) { func (m *TextContent) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size]) n, err := m.MarshalToSizedBuffer(dAtA[:size])
@ -314,35 +275,12 @@ func (m *PlainTextChange) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil return dAtA[:n], nil
} }
func (m *PlainTextChange) MarshalTo(dAtA []byte) (int, error) { func (m *TextContent) MarshalTo(dAtA []byte) (int, error) {
size := m.Size() size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size]) return m.MarshalToSizedBuffer(dAtA[:size])
} }
func (m *PlainTextChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { func (m *TextContent) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
return len(dAtA) - i, nil
}
func (m *PlainTextChange_Content) 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 *PlainTextChange_Content) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *PlainTextChange_Content) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA) i := len(dAtA)
_ = i _ = i
var l int var l int
@ -359,12 +297,12 @@ func (m *PlainTextChange_Content) MarshalToSizedBuffer(dAtA []byte) (int, error)
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *PlainTextChange_Content_TextAppend) MarshalTo(dAtA []byte) (int, error) { func (m *TextContentValueOfTextAppend) MarshalTo(dAtA []byte) (int, error) {
size := m.Size() size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size]) return m.MarshalToSizedBuffer(dAtA[:size])
} }
func (m *PlainTextChange_Content_TextAppend) MarshalToSizedBuffer(dAtA []byte) (int, error) { func (m *TextContentValueOfTextAppend) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA) i := len(dAtA)
if m.TextAppend != nil { if m.TextAppend != nil {
{ {
@ -380,7 +318,7 @@ func (m *PlainTextChange_Content_TextAppend) MarshalToSizedBuffer(dAtA []byte) (
} }
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *PlainTextChange_TextAppend) Marshal() (dAtA []byte, err error) { func (m *TextAppend) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size]) n, err := m.MarshalToSizedBuffer(dAtA[:size])
@ -390,12 +328,12 @@ func (m *PlainTextChange_TextAppend) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil return dAtA[:n], nil
} }
func (m *PlainTextChange_TextAppend) MarshalTo(dAtA []byte) (int, error) { func (m *TextAppend) MarshalTo(dAtA []byte) (int, error) {
size := m.Size() size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size]) return m.MarshalToSizedBuffer(dAtA[:size])
} }
func (m *PlainTextChange_TextAppend) MarshalToSizedBuffer(dAtA []byte) (int, error) { func (m *TextAppend) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA) i := len(dAtA)
_ = i _ = i
var l int var l int
@ -410,7 +348,7 @@ func (m *PlainTextChange_TextAppend) MarshalToSizedBuffer(dAtA []byte) (int, err
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *PlainTextChange_Snapshot) Marshal() (dAtA []byte, err error) { func (m *TextSnapshot) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size]) n, err := m.MarshalToSizedBuffer(dAtA[:size])
@ -420,12 +358,12 @@ func (m *PlainTextChange_Snapshot) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil return dAtA[:n], nil
} }
func (m *PlainTextChange_Snapshot) MarshalTo(dAtA []byte) (int, error) { func (m *TextSnapshot) MarshalTo(dAtA []byte) (int, error) {
size := m.Size() size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size]) return m.MarshalToSizedBuffer(dAtA[:size])
} }
func (m *PlainTextChange_Snapshot) MarshalToSizedBuffer(dAtA []byte) (int, error) { func (m *TextSnapshot) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA) i := len(dAtA)
_ = i _ = i
var l int var l int
@ -440,7 +378,7 @@ func (m *PlainTextChange_Snapshot) MarshalToSizedBuffer(dAtA []byte) (int, error
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *PlainTextChange_Data) Marshal() (dAtA []byte, err error) { func (m *TextData) Marshal() (dAtA []byte, err error) {
size := m.Size() size := m.Size()
dAtA = make([]byte, size) dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size]) n, err := m.MarshalToSizedBuffer(dAtA[:size])
@ -450,12 +388,12 @@ func (m *PlainTextChange_Data) Marshal() (dAtA []byte, err error) {
return dAtA[:n], nil return dAtA[:n], nil
} }
func (m *PlainTextChange_Data) MarshalTo(dAtA []byte) (int, error) { func (m *TextData) MarshalTo(dAtA []byte) (int, error) {
size := m.Size() size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size]) return m.MarshalToSizedBuffer(dAtA[:size])
} }
func (m *PlainTextChange_Data) MarshalToSizedBuffer(dAtA []byte) (int, error) { func (m *TextData) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA) i := len(dAtA)
_ = i _ = i
var l int var l int
@ -500,16 +438,7 @@ func encodeVarintTest(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v) dAtA[offset] = uint8(v)
return base return base
} }
func (m *PlainTextChange) Size() (n int) { func (m *TextContent) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func (m *PlainTextChange_Content) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
} }
@ -521,7 +450,7 @@ func (m *PlainTextChange_Content) Size() (n int) {
return n return n
} }
func (m *PlainTextChange_Content_TextAppend) Size() (n int) { func (m *TextContentValueOfTextAppend) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
} }
@ -533,7 +462,7 @@ func (m *PlainTextChange_Content_TextAppend) Size() (n int) {
} }
return n return n
} }
func (m *PlainTextChange_TextAppend) Size() (n int) { func (m *TextAppend) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
} }
@ -546,7 +475,7 @@ func (m *PlainTextChange_TextAppend) Size() (n int) {
return n return n
} }
func (m *PlainTextChange_Snapshot) Size() (n int) { func (m *TextSnapshot) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
} }
@ -559,7 +488,7 @@ func (m *PlainTextChange_Snapshot) Size() (n int) {
return n return n
} }
func (m *PlainTextChange_Data) Size() (n int) { func (m *TextData) Size() (n int) {
if m == nil { if m == nil {
return 0 return 0
} }
@ -584,7 +513,7 @@ func sovTest(x uint64) (n int) {
func sozTest(x uint64) (n int) { func sozTest(x uint64) (n int) {
return sovTest(uint64((x << 1) ^ uint64((int64(x) >> 63)))) return sovTest(uint64((x << 1) ^ uint64((int64(x) >> 63))))
} }
func (m *PlainTextChange) Unmarshal(dAtA []byte) error { func (m *TextContent) Unmarshal(dAtA []byte) error {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
for iNdEx < l { for iNdEx < l {
@ -607,60 +536,10 @@ func (m *PlainTextChange) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3) fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7) wireType := int(wire & 0x7)
if wireType == 4 { if wireType == 4 {
return fmt.Errorf("proto: PlainTextChange: wiretype end group for non-group") return fmt.Errorf("proto: TextContent: wiretype end group for non-group")
} }
if fieldNum <= 0 { if fieldNum <= 0 {
return fmt.Errorf("proto: PlainTextChange: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: TextContent: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := skipTest(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTest
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *PlainTextChange_Content) 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 ErrIntOverflowTest
}
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: Content: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Content: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 1: case 1:
@ -692,11 +571,11 @@ func (m *PlainTextChange_Content) Unmarshal(dAtA []byte) error {
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
v := &PlainTextChange_TextAppend{} v := &TextAppend{}
if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err return err
} }
m.Value = &PlainTextChange_Content_TextAppend{v} m.Value = &TextContentValueOfTextAppend{v}
iNdEx = postIndex iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
@ -719,7 +598,7 @@ func (m *PlainTextChange_Content) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *PlainTextChange_TextAppend) Unmarshal(dAtA []byte) error { func (m *TextAppend) Unmarshal(dAtA []byte) error {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
for iNdEx < l { for iNdEx < l {
@ -801,7 +680,7 @@ func (m *PlainTextChange_TextAppend) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *PlainTextChange_Snapshot) Unmarshal(dAtA []byte) error { func (m *TextSnapshot) Unmarshal(dAtA []byte) error {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
for iNdEx < l { for iNdEx < l {
@ -824,10 +703,10 @@ func (m *PlainTextChange_Snapshot) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3) fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7) wireType := int(wire & 0x7)
if wireType == 4 { if wireType == 4 {
return fmt.Errorf("proto: Snapshot: wiretype end group for non-group") return fmt.Errorf("proto: TextSnapshot: wiretype end group for non-group")
} }
if fieldNum <= 0 { if fieldNum <= 0 {
return fmt.Errorf("proto: Snapshot: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: TextSnapshot: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 1: case 1:
@ -883,7 +762,7 @@ func (m *PlainTextChange_Snapshot) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *PlainTextChange_Data) Unmarshal(dAtA []byte) error { func (m *TextData) Unmarshal(dAtA []byte) error {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0
for iNdEx < l { for iNdEx < l {
@ -906,10 +785,10 @@ func (m *PlainTextChange_Data) Unmarshal(dAtA []byte) error {
fieldNum := int32(wire >> 3) fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7) wireType := int(wire & 0x7)
if wireType == 4 { if wireType == 4 {
return fmt.Errorf("proto: Data: wiretype end group for non-group") return fmt.Errorf("proto: TextData: wiretype end group for non-group")
} }
if fieldNum <= 0 { if fieldNum <= 0 {
return fmt.Errorf("proto: Data: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: TextData: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 1: case 1:
@ -941,7 +820,7 @@ func (m *PlainTextChange_Data) Unmarshal(dAtA []byte) error {
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
m.Content = append(m.Content, &PlainTextChange_Content{}) m.Content = append(m.Content, &TextContent{})
if err := m.Content[len(m.Content)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { if err := m.Content[len(m.Content)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err return err
} }
@ -976,7 +855,7 @@ func (m *PlainTextChange_Data) Unmarshal(dAtA []byte) error {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
if m.Snapshot == nil { if m.Snapshot == nil {
m.Snapshot = &PlainTextChange_Snapshot{} m.Snapshot = &TextSnapshot{}
} }
if err := m.Snapshot.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { if err := m.Snapshot.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err return err

View File

@ -2,23 +2,21 @@ syntax = "proto3";
package anytype; package anytype;
option go_package = "testchanges"; option go_package = "testchanges";
message PlainTextChange { message TextContent {
message Content { oneof value {
oneof value { TextAppend textAppend = 1;
TextAppend textAppend = 1;
}
} }
}
message TextAppend { message TextAppend {
string text = 1; string text = 1;
} }
message Snapshot { message TextSnapshot {
string text = 1; string text = 1;
} }
message Data { message TextData {
repeated Content content = 1; repeated TextContent content = 1;
Snapshot snapshot = 2; TextSnapshot snapshot = 2;
} }
}

View File

@ -1,6 +1,7 @@
//go:generate mockgen -destination mock_ldiff/mock_ldiff.go github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/ldiff Diff,Remote
// Package ldiff provides a container of elements with fixed id and changeable content. // Package ldiff provides a container of elements with fixed id and changeable content.
// Diff can calculate the difference with another diff container (you can make it remote) with minimum hops and traffic. // Diff can calculate the difference with another diff container (you can make it remote) with minimum hops and traffic.
//
//go:generate mockgen -destination mock_ldiff/mock_ldiff.go github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/ldiff Diff,Remote
package ldiff package ldiff
import ( import (
@ -84,6 +85,10 @@ type Diff interface {
RemoveId(id string) error RemoveId(id string) error
// Diff makes diff with remote container // Diff makes diff with remote container
Diff(ctx context.Context, dl Remote) (newIds, changedIds, removedIds []string, err error) Diff(ctx context.Context, dl Remote) (newIds, changedIds, removedIds []string, err error)
// Elements retrieves all elements in the Diff
Elements() []Element
// Ids retrieves ids of all elements in the Diff
Ids() []string
} }
// Remote interface for using in the Diff // Remote interface for using in the Diff
@ -134,6 +139,34 @@ func (d *diff) Set(elements ...Element) {
} }
} }
func (d *diff) Ids() (ids []string) {
d.mu.RLock()
defer d.mu.RUnlock()
ids = make([]string, 0, d.sl.Len())
cur := d.sl.Front()
for cur != nil {
el := cur.Key().(*element).Element
ids = append(ids, el.Id)
}
return
}
func (d *diff) Elements() (elements []Element) {
d.mu.RLock()
defer d.mu.RUnlock()
elements = make([]Element, 0, d.sl.Len())
cur := d.sl.Front()
for cur != nil {
el := cur.Key().(*element).Element
elements = append(elements, el)
}
return
}
// RemoveId removes element by id // RemoveId removes element by id
func (d *diff) RemoveId(id string) error { func (d *diff) RemoveId(id string) error {
d.mu.Lock() d.mu.Lock()