Merge pull request #25 from anytypeio/naming-and-refactoring

This commit is contained in:
Mikhail Rakhmanov 2022-12-29 15:39:07 +01:00 committed by GitHub
commit 33a2b5cc84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
243 changed files with 5505 additions and 4328 deletions

View File

@ -3,11 +3,12 @@ export GOPRIVATE=github.com/anytypeio
proto:
@$(eval GOGO_START := GOGO_NO_UNDERSCORE=1 GOGO_EXPORT_ONEOF_INTERFACE=1)
$(GOGO_START) protoc --gogofaster_out=:. --go-drpc_out=protolib=github.com/gogo/protobuf:. api/apiproto/protos/*.proto
$(GOGO_START) protoc --gogofaster_out=:. --go-drpc_out=protolib=github.com/gogo/protobuf:. debug/clientdebugrpc/clientdebugrpcproto/protos/*.proto
$(GOGO_START) protoc --gogofaster_out=:. document/textchangeproto/protos/*.proto
build:
@$(eval FLAGS := $$(shell govvv -flags -pkg github.com/anytypeio/go-anytype-infrastructure-experiments/client))
go build -v -o ../bin/client -ldflags "$(FLAGS)" github.com/anytypeio/go-anytype-infrastructure-experiments/client/cmd
go build -v -o ../bin/anytype-client -ldflags "$(FLAGS)" github.com/anytypeio/go-anytype-infrastructure-experiments/client/cmd
test:
go test ./... --cover

View File

@ -1,30 +1,25 @@
package account
import (
commonaccount "github.com/anytypeio/go-anytype-infrastructure-experiments/common/account"
commonaccount "github.com/anytypeio/go-anytype-infrastructure-experiments/common/accountservice"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/config"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/account"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/accountdata"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/encryptionkey"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/signingkey"
)
type service struct {
accountData *account.AccountData
accountData *accountdata.AccountData
peerId string
}
func (s *service) Account() *account.AccountData {
return s.accountData
}
func New() app.Component {
return &service{}
}
func (s *service) Init(a *app.App) (err error) {
acc := a.MustComponent(config.CName).(commonaccount.ConfigGetter).GetAccount()
acc := a.MustComponent("config").(commonaccount.ConfigGetter).GetAccount()
decodedEncryptionKey, err := keys.DecodeKeyFromString(
acc.EncryptionKey,
@ -55,11 +50,12 @@ func (s *service) Init(a *app.App) (err error) {
return err
}
s.accountData = &account.AccountData{
s.accountData = &accountdata.AccountData{
Identity: identity,
PeerKey: decodedPeerKey,
SignKey: decodedSigningKey,
EncKey: decodedEncryptionKey,
PeerId: acc.PeerId,
}
s.peerId = acc.PeerId
@ -69,3 +65,7 @@ func (s *service) Init(a *app.App) (err error) {
func (s *service) Name() (name string) {
return commonaccount.CName
}
func (s *service) Account() *accountdata.AccountData {
return s.accountData
}

View File

@ -0,0 +1,9 @@
package badgerprovider
type configGetter interface {
GetStorage() Config
}
type Config struct {
Path string `yaml:"path"`
}

View File

@ -3,7 +3,6 @@ package badgerprovider
import (
"context"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/config"
"github.com/dgraph-io/badger/v3"
)
@ -23,8 +22,8 @@ func New() BadgerProvider {
}
func (s *service) Init(a *app.App) (err error) {
cfg := a.MustComponent(config.CName).(*config.Config)
s.db, err = badger.Open(badger.DefaultOptions(cfg.Storage.Path))
cfg := a.MustComponent("config").(configGetter).GetStorage()
s.db, err = badger.Open(badger.DefaultOptions(cfg.Path))
return
}

View File

@ -5,12 +5,12 @@ import (
"errors"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/clientspace"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/document/textdocument"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/account"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/accountservice"
"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/treegetter"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/tree"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/ocache"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/ocache"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/objecttree"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/treegetter"
"go.uber.org/zap"
"time"
)
@ -25,7 +25,7 @@ const spaceKey ctxKey = 0
type treeCache struct {
gcttl int
cache ocache.OCache
account account.Service
account accountservice.Service
clientService clientspace.Service
}
@ -37,17 +37,17 @@ type TreeCache interface {
type updateListener struct {
}
func (u *updateListener) Update(tree tree.ObjectTree) {
func (u *updateListener) Update(tree objecttree.ObjectTree) {
log.With(
zap.Strings("heads", tree.Heads()),
zap.String("tree id", tree.ID())).
zap.String("tree id", tree.Id())).
Debug("updating tree")
}
func (u *updateListener) Rebuild(tree tree.ObjectTree) {
func (u *updateListener) Rebuild(tree objecttree.ObjectTree) {
log.With(
zap.Strings("heads", tree.Heads()),
zap.String("tree id", tree.ID())).
zap.String("tree id", tree.Id())).
Debug("rebuilding tree")
}
@ -67,7 +67,7 @@ func (c *treeCache) Close(ctx context.Context) (err error) {
func (c *treeCache) Init(a *app.App) (err error) {
c.clientService = a.MustComponent(clientspace.CName).(clientspace.Service)
c.account = a.MustComponent(account.CName).(account.Service)
c.account = a.MustComponent(accountservice.CName).(accountservice.Service)
c.cache = ocache.New(
func(ctx context.Context, id string) (value ocache.Object, err error) {
spaceId := ctx.Value(spaceKey).(string)
@ -98,7 +98,7 @@ func (c *treeCache) GetDocument(ctx context.Context, spaceId, id string) (doc te
return
}
func (c *treeCache) GetTree(ctx context.Context, spaceId, id string) (tr tree.ObjectTree, err error) {
func (c *treeCache) GetTree(ctx context.Context, spaceId, id string) (tr objecttree.ObjectTree, err error) {
doc, err := c.GetDocument(ctx, spaceId, id)
if err != nil {
return

View File

@ -10,7 +10,7 @@ type rpcHandler struct {
s *service
}
func (r *rpcHandler) PullSpace(ctx context.Context, request *spacesyncproto.PullSpaceRequest) (resp *spacesyncproto.PullSpaceResponse, err error) {
func (r *rpcHandler) SpacePull(ctx context.Context, request *spacesyncproto.SpacePullRequest) (resp *spacesyncproto.SpacePullResponse, err error) {
sp, err := r.s.GetSpace(ctx, request.Id)
if err != nil {
if err != spacesyncproto.ErrSpaceMissing {
@ -25,7 +25,7 @@ func (r *rpcHandler) PullSpace(ctx context.Context, request *spacesyncproto.Pull
return
}
resp = &spacesyncproto.PullSpaceResponse{
resp = &spacesyncproto.SpacePullResponse{
Payload: &spacesyncproto.SpacePayload{
SpaceHeader: spaceDesc.SpaceHeader,
AclPayloadId: spaceDesc.AclId,
@ -37,7 +37,7 @@ func (r *rpcHandler) PullSpace(ctx context.Context, request *spacesyncproto.Pull
return
}
func (r *rpcHandler) PushSpace(ctx context.Context, req *spacesyncproto.PushSpaceRequest) (resp *spacesyncproto.PushSpaceResponse, err error) {
func (r *rpcHandler) SpacePush(ctx context.Context, req *spacesyncproto.SpacePushRequest) (resp *spacesyncproto.SpacePushResponse, err error) {
description := commonspace.SpaceDescription{
SpaceHeader: req.Payload.SpaceHeader,
AclId: req.Payload.AclPayloadId,
@ -50,7 +50,7 @@ func (r *rpcHandler) PushSpace(ctx context.Context, req *spacesyncproto.PushSpac
if err != nil {
return
}
resp = &spacesyncproto.PushSpaceResponse{}
resp = &spacesyncproto.SpacePushResponse{}
return
}
@ -62,7 +62,7 @@ func (r *rpcHandler) HeadSync(ctx context.Context, req *spacesyncproto.HeadSyncR
return sp.SpaceSyncRpc().HeadSync(ctx, req)
}
func (r *rpcHandler) Stream(stream spacesyncproto.DRPCSpace_StreamStream) error {
func (r *rpcHandler) ObjectSyncStream(stream spacesyncproto.DRPCSpaceSync_ObjectSyncStreamStream) error {
msg, err := stream.Recv()
if err != nil {
return err

View File

@ -4,12 +4,12 @@ import (
"context"
"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/ocache"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacestorage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/storage"
config2 "github.com/anytypeio/go-anytype-infrastructure-experiments/common/config"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/syncstatus"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/rpc/server"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/ocache"
"time"
)
@ -29,23 +29,23 @@ type Service interface {
}
type service struct {
conf config2.Space
conf commonspace.Config
spaceCache ocache.OCache
commonSpace commonspace.Service
spaceStorageProvider storage.SpaceStorageProvider
commonSpace commonspace.SpaceService
spaceStorageProvider spacestorage.SpaceStorageProvider
}
func (s *service) Init(a *app.App) (err error) {
s.conf = a.MustComponent(config2.CName).(*config2.Config).Space
s.commonSpace = a.MustComponent(commonspace.CName).(commonspace.Service)
s.spaceStorageProvider = a.MustComponent(storage.CName).(storage.SpaceStorageProvider)
s.conf = a.MustComponent("config").(commonspace.ConfigGetter).GetSpace()
s.commonSpace = a.MustComponent(commonspace.CName).(commonspace.SpaceService)
s.spaceStorageProvider = a.MustComponent(spacestorage.CName).(spacestorage.SpaceStorageProvider)
s.spaceCache = ocache.New(
s.loadSpace,
ocache.WithLogger(log.Sugar()),
ocache.WithGCPeriod(time.Minute),
ocache.WithTTL(time.Duration(s.conf.GCTTL)*time.Second),
)
return spacesyncproto.DRPCRegisterSpace(a.MustComponent(server.CName).(server.DRPCServer), &rpcHandler{s})
return spacesyncproto.DRPCRegisterSpaceSync(a.MustComponent(server.CName).(server.DRPCServer), &rpcHandler{s})
}
func (s *service) Name() (name string) {
@ -99,7 +99,7 @@ func (s *service) loadSpace(ctx context.Context, id string) (value ocache.Object
if err != nil {
return
}
ns.StatusService().SetUpdateReceiver(&statusReceiver{})
ns.SyncStatus().(syncstatus.StatusWatcher).SetUpdateReceiver(&statusReceiver{})
if err = ns.Init(ctx); err != nil {
return
}

View File

@ -2,15 +2,15 @@ package clientspace
import (
"context"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/statusservice"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/syncstatus"
"go.uber.org/zap"
)
type statusReceiver struct {
}
func (s *statusReceiver) UpdateTree(ctx context.Context, treeId string, status statusservice.SyncStatus) (err error) {
log.With(zap.String("treeId", treeId), zap.Bool("synced", status == statusservice.SyncStatusSynced)).
func (s *statusReceiver) UpdateTree(ctx context.Context, treeId string, status syncstatus.SyncStatus) (err error) {
log.With(zap.String("treeId", treeId), zap.Bool("synced", status == syncstatus.StatusSynced)).
Debug("updating sync status")
return nil
}

View File

@ -5,10 +5,11 @@ import (
"flag"
"fmt"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/account"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/api"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/badgerprovider"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/clientspace"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/clientspace/clientcache"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/config"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/debug/clientdebugrpc"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/document"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/filestorage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/filestorage/rpcstore"
@ -17,12 +18,11 @@ import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/logger"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonfile/fileservice"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/config"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/metric"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/dialer"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/pool"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/rpc/server"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/secure"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/secureservice"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/nodeconf"
"go.uber.org/zap"
"net/http"
@ -104,7 +104,7 @@ func Bootstrap(a *app.App) {
Register(badgerprovider.New()).
Register(storage.New()).
Register(clientcache.New(200)).
Register(secure.New()).
Register(secureservice.New()).
Register(dialer.New()).
Register(pool.New()).
Register(commonspace.New()).
@ -114,5 +114,5 @@ func Bootstrap(a *app.App) {
Register(rpcstore.New()).
Register(fileservice.New()).
Register(filestorage.New()).
Register(api.New())
Register(clientdebugrpc.New())
}

75
client/config/config.go Normal file
View File

@ -0,0 +1,75 @@
package config
import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/badgerprovider"
commonaccount "github.com/anytypeio/go-anytype-infrastructure-experiments/common/accountservice"
"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"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/metric"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/nodeconf"
"gopkg.in/yaml.v3"
"os"
)
const CName = "config"
func NewFromFile(path string) (c *Config, err error) {
c = &Config{}
data, err := os.ReadFile(path)
if err != nil {
return nil, err
}
if err = yaml.Unmarshal(data, c); err != nil {
return nil, err
}
return
}
type Config struct {
GrpcServer net.Config `yaml:"grpcServer"`
Account commonaccount.Config `yaml:"account"`
APIServer net.Config `yaml:"apiServer"`
Nodes []nodeconf.NodeConfig `yaml:"nodes"`
Space commonspace.Config `yaml:"space"`
Storage badgerprovider.Config `yaml:"storage"`
Metric metric.Config `yaml:"metric"`
Log logger.Config `yaml:"log"`
}
func (c *Config) Init(a *app.App) (err error) {
return
}
func (c Config) Name() (name string) {
return CName
}
func (c Config) GetNet() net.Config {
return c.GrpcServer
}
func (c Config) GetDebugNet() net.Config {
return c.APIServer
}
func (c Config) GetAccount() commonaccount.Config {
return c.Account
}
func (c Config) GetMetric() metric.Config {
return c.Metric
}
func (c Config) GetSpace() commonspace.Config {
return c.Space
}
func (c Config) GetStorage() badgerprovider.Config {
return c.Storage
}
func (c Config) GetNodes() []nodeconf.NodeConfig {
return c.Nodes
}

View File

@ -1,53 +1,57 @@
package api
package clientdebugrpc
import (
"context"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/api/apiproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/clientspace"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/debug/clientdebugrpc/clientdebugrpcproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/document"
clientstorage "github.com/anytypeio/go-anytype-infrastructure-experiments/client/storage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/account"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/accountservice"
"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/commonfile/fileservice"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/storage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/config"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacestorage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/rpc/server"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/secure"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/secureservice"
"storj.io/drpc"
)
const CName = "api.service"
const CName = "common.debug.clientdebugrpc"
var log = logger.NewNamed(CName)
func New() Service {
func New() ClientDebugRpc {
return &service{BaseDrpcServer: server.NewBaseDrpcServer()}
}
type Service interface {
type configGetter interface {
GetDebugNet() net.Config
}
type ClientDebugRpc interface {
app.ComponentRunnable
drpc.Mux
}
type service struct {
transport secure.Service
cfg *config.Config
transport secureservice.SecureService
cfg net.Config
spaceService clientspace.Service
storageService clientstorage.ClientStorage
docService document.Service
account account.Service
account accountservice.Service
file fileservice.FileService
*server.BaseDrpcServer
}
func (s *service) Init(a *app.App) (err error) {
s.spaceService = a.MustComponent(clientspace.CName).(clientspace.Service)
s.storageService = a.MustComponent(storage.CName).(clientstorage.ClientStorage)
s.storageService = a.MustComponent(spacestorage.CName).(clientstorage.ClientStorage)
s.docService = a.MustComponent(document.CName).(document.Service)
s.account = a.MustComponent(account.CName).(account.Service)
s.cfg = a.MustComponent(config.CName).(*config.Config)
s.transport = a.MustComponent(secure.CName).(secure.Service)
s.account = a.MustComponent(accountservice.CName).(accountservice.Service)
s.cfg = a.MustComponent("config").(configGetter).GetDebugNet()
s.transport = a.MustComponent(secureservice.CName).(secureservice.SecureService)
s.file = a.MustComponent(fileservice.CName).(fileservice.FileService)
return nil
}
@ -60,7 +64,7 @@ func (s *service) Run(ctx context.Context) (err error) {
params := server.Params{
BufferSizeMb: s.cfg.Stream.MaxMsgSizeMb,
TimeoutMillis: s.cfg.Stream.TimeoutMilliseconds,
ListenAddrs: s.cfg.APIServer.ListenAddrs,
ListenAddrs: s.cfg.Server.ListenAddrs,
Wrapper: func(handler drpc.Handler) drpc.Handler {
return handler
},
@ -70,7 +74,7 @@ func (s *service) Run(ctx context.Context) (err error) {
if err != nil {
return
}
return apiproto.DRPCRegisterClientApi(s, &rpcHandler{
return clientdebugrpcproto.DRPCRegisterClientApi(s, &rpcHandler{
spaceService: s.spaceService,
storageService: s.storageService,
docService: s.docService,

View File

@ -1,8 +1,8 @@
// Code generated by protoc-gen-go-drpc. DO NOT EDIT.
// protoc-gen-go-drpc version: v0.0.32
// source: api/apiproto/protos/api.proto
// source: debug/clientdebugrpc/clientdebugrpcproto/protos/clientdebugrpc.proto
package apiproto
package clientdebugrpcproto
import (
bytes "bytes"
@ -14,17 +14,17 @@ import (
drpcerr "storj.io/drpc/drpcerr"
)
type drpcEncoding_File_api_apiproto_protos_api_proto struct{}
type drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto struct{}
func (drpcEncoding_File_api_apiproto_protos_api_proto) Marshal(msg drpc.Message) ([]byte, error) {
func (drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto) Marshal(msg drpc.Message) ([]byte, error) {
return proto.Marshal(msg.(proto.Message))
}
func (drpcEncoding_File_api_apiproto_protos_api_proto) Unmarshal(buf []byte, msg drpc.Message) error {
func (drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto) Unmarshal(buf []byte, msg drpc.Message) error {
return proto.Unmarshal(buf, msg.(proto.Message))
}
func (drpcEncoding_File_api_apiproto_protos_api_proto) JSONMarshal(msg drpc.Message) ([]byte, error) {
func (drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto) JSONMarshal(msg drpc.Message) ([]byte, error) {
var buf bytes.Buffer
err := new(jsonpb.Marshaler).Marshal(&buf, msg.(proto.Message))
if err != nil {
@ -33,7 +33,7 @@ func (drpcEncoding_File_api_apiproto_protos_api_proto) JSONMarshal(msg drpc.Mess
return buf.Bytes(), nil
}
func (drpcEncoding_File_api_apiproto_protos_api_proto) JSONUnmarshal(buf []byte, msg drpc.Message) error {
func (drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto) JSONUnmarshal(buf []byte, msg drpc.Message) error {
return jsonpb.Unmarshal(bytes.NewReader(buf), msg.(proto.Message))
}
@ -69,7 +69,7 @@ func (c *drpcClientApiClient) DRPCConn() drpc.Conn { return c.cc }
func (c *drpcClientApiClient) CreateSpace(ctx context.Context, in *CreateSpaceRequest) (*CreateSpaceResponse, error) {
out := new(CreateSpaceResponse)
err := c.cc.Invoke(ctx, "/clientapi.ClientApi/CreateSpace", drpcEncoding_File_api_apiproto_protos_api_proto{}, in, out)
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/CreateSpace", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
if err != nil {
return nil, err
}
@ -78,7 +78,7 @@ func (c *drpcClientApiClient) CreateSpace(ctx context.Context, in *CreateSpaceRe
func (c *drpcClientApiClient) DeriveSpace(ctx context.Context, in *DeriveSpaceRequest) (*DeriveSpaceResponse, error) {
out := new(DeriveSpaceResponse)
err := c.cc.Invoke(ctx, "/clientapi.ClientApi/DeriveSpace", drpcEncoding_File_api_apiproto_protos_api_proto{}, in, out)
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/DeriveSpace", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
if err != nil {
return nil, err
}
@ -87,7 +87,7 @@ func (c *drpcClientApiClient) DeriveSpace(ctx context.Context, in *DeriveSpaceRe
func (c *drpcClientApiClient) CreateDocument(ctx context.Context, in *CreateDocumentRequest) (*CreateDocumentResponse, error) {
out := new(CreateDocumentResponse)
err := c.cc.Invoke(ctx, "/clientapi.ClientApi/CreateDocument", drpcEncoding_File_api_apiproto_protos_api_proto{}, in, out)
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/CreateDocument", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
if err != nil {
return nil, err
}
@ -96,7 +96,7 @@ func (c *drpcClientApiClient) CreateDocument(ctx context.Context, in *CreateDocu
func (c *drpcClientApiClient) DeleteDocument(ctx context.Context, in *DeleteDocumentRequest) (*DeleteDocumentResponse, error) {
out := new(DeleteDocumentResponse)
err := c.cc.Invoke(ctx, "/clientapi.ClientApi/DeleteDocument", drpcEncoding_File_api_apiproto_protos_api_proto{}, in, out)
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/DeleteDocument", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
if err != nil {
return nil, err
}
@ -105,7 +105,7 @@ func (c *drpcClientApiClient) DeleteDocument(ctx context.Context, in *DeleteDocu
func (c *drpcClientApiClient) AddText(ctx context.Context, in *AddTextRequest) (*AddTextResponse, error) {
out := new(AddTextResponse)
err := c.cc.Invoke(ctx, "/clientapi.ClientApi/AddText", drpcEncoding_File_api_apiproto_protos_api_proto{}, in, out)
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/AddText", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
if err != nil {
return nil, err
}
@ -114,7 +114,7 @@ func (c *drpcClientApiClient) AddText(ctx context.Context, in *AddTextRequest) (
func (c *drpcClientApiClient) DumpTree(ctx context.Context, in *DumpTreeRequest) (*DumpTreeResponse, error) {
out := new(DumpTreeResponse)
err := c.cc.Invoke(ctx, "/clientapi.ClientApi/DumpTree", drpcEncoding_File_api_apiproto_protos_api_proto{}, in, out)
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/DumpTree", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
if err != nil {
return nil, err
}
@ -123,7 +123,7 @@ func (c *drpcClientApiClient) DumpTree(ctx context.Context, in *DumpTreeRequest)
func (c *drpcClientApiClient) TreeParams(ctx context.Context, in *TreeParamsRequest) (*TreeParamsResponse, error) {
out := new(TreeParamsResponse)
err := c.cc.Invoke(ctx, "/clientapi.ClientApi/TreeParams", drpcEncoding_File_api_apiproto_protos_api_proto{}, in, out)
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/TreeParams", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
if err != nil {
return nil, err
}
@ -132,7 +132,7 @@ func (c *drpcClientApiClient) TreeParams(ctx context.Context, in *TreeParamsRequ
func (c *drpcClientApiClient) AllTrees(ctx context.Context, in *AllTreesRequest) (*AllTreesResponse, error) {
out := new(AllTreesResponse)
err := c.cc.Invoke(ctx, "/clientapi.ClientApi/AllTrees", drpcEncoding_File_api_apiproto_protos_api_proto{}, in, out)
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/AllTrees", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
if err != nil {
return nil, err
}
@ -141,7 +141,7 @@ func (c *drpcClientApiClient) AllTrees(ctx context.Context, in *AllTreesRequest)
func (c *drpcClientApiClient) AllSpaces(ctx context.Context, in *AllSpacesRequest) (*AllSpacesResponse, error) {
out := new(AllSpacesResponse)
err := c.cc.Invoke(ctx, "/clientapi.ClientApi/AllSpaces", drpcEncoding_File_api_apiproto_protos_api_proto{}, in, out)
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/AllSpaces", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
if err != nil {
return nil, err
}
@ -150,7 +150,7 @@ func (c *drpcClientApiClient) AllSpaces(ctx context.Context, in *AllSpacesReques
func (c *drpcClientApiClient) LoadSpace(ctx context.Context, in *LoadSpaceRequest) (*LoadSpaceResponse, error) {
out := new(LoadSpaceResponse)
err := c.cc.Invoke(ctx, "/clientapi.ClientApi/LoadSpace", drpcEncoding_File_api_apiproto_protos_api_proto{}, in, out)
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/LoadSpace", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
if err != nil {
return nil, err
}
@ -159,7 +159,7 @@ func (c *drpcClientApiClient) LoadSpace(ctx context.Context, in *LoadSpaceReques
func (c *drpcClientApiClient) Watch(ctx context.Context, in *WatchRequest) (*WatchResponse, error) {
out := new(WatchResponse)
err := c.cc.Invoke(ctx, "/clientapi.ClientApi/Watch", drpcEncoding_File_api_apiproto_protos_api_proto{}, in, out)
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/Watch", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
if err != nil {
return nil, err
}
@ -168,7 +168,7 @@ func (c *drpcClientApiClient) Watch(ctx context.Context, in *WatchRequest) (*Wat
func (c *drpcClientApiClient) Unwatch(ctx context.Context, in *UnwatchRequest) (*UnwatchResponse, error) {
out := new(UnwatchResponse)
err := c.cc.Invoke(ctx, "/clientapi.ClientApi/Unwatch", drpcEncoding_File_api_apiproto_protos_api_proto{}, in, out)
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/Unwatch", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
if err != nil {
return nil, err
}
@ -177,7 +177,7 @@ func (c *drpcClientApiClient) Unwatch(ctx context.Context, in *UnwatchRequest) (
func (c *drpcClientApiClient) PutFile(ctx context.Context, in *PutFileRequest) (*PutFileResponse, error) {
out := new(PutFileResponse)
err := c.cc.Invoke(ctx, "/clientapi.ClientApi/PutFile", drpcEncoding_File_api_apiproto_protos_api_proto{}, in, out)
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/PutFile", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
if err != nil {
return nil, err
}
@ -186,7 +186,7 @@ func (c *drpcClientApiClient) PutFile(ctx context.Context, in *PutFileRequest) (
func (c *drpcClientApiClient) GetFile(ctx context.Context, in *GetFileRequest) (*GetFileResponse, error) {
out := new(GetFileResponse)
err := c.cc.Invoke(ctx, "/clientapi.ClientApi/GetFile", drpcEncoding_File_api_apiproto_protos_api_proto{}, in, out)
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/GetFile", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
if err != nil {
return nil, err
}
@ -195,7 +195,7 @@ func (c *drpcClientApiClient) GetFile(ctx context.Context, in *GetFileRequest) (
func (c *drpcClientApiClient) DeleteFile(ctx context.Context, in *DeleteFileRequest) (*DeleteFileResponse, error) {
out := new(DeleteFileResponse)
err := c.cc.Invoke(ctx, "/clientapi.ClientApi/DeleteFile", drpcEncoding_File_api_apiproto_protos_api_proto{}, in, out)
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/DeleteFile", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
if err != nil {
return nil, err
}
@ -289,7 +289,7 @@ func (DRPCClientApiDescription) NumMethods() int { return 15 }
func (DRPCClientApiDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
switch n {
case 0:
return "/clientapi.ClientApi/CreateSpace", drpcEncoding_File_api_apiproto_protos_api_proto{},
return "/clientdebugrpc.ClientApi/CreateSpace", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCClientApiServer).
CreateSpace(
@ -298,7 +298,7 @@ func (DRPCClientApiDescription) Method(n int) (string, drpc.Encoding, drpc.Recei
)
}, DRPCClientApiServer.CreateSpace, true
case 1:
return "/clientapi.ClientApi/DeriveSpace", drpcEncoding_File_api_apiproto_protos_api_proto{},
return "/clientdebugrpc.ClientApi/DeriveSpace", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCClientApiServer).
DeriveSpace(
@ -307,7 +307,7 @@ func (DRPCClientApiDescription) Method(n int) (string, drpc.Encoding, drpc.Recei
)
}, DRPCClientApiServer.DeriveSpace, true
case 2:
return "/clientapi.ClientApi/CreateDocument", drpcEncoding_File_api_apiproto_protos_api_proto{},
return "/clientdebugrpc.ClientApi/CreateDocument", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCClientApiServer).
CreateDocument(
@ -316,7 +316,7 @@ func (DRPCClientApiDescription) Method(n int) (string, drpc.Encoding, drpc.Recei
)
}, DRPCClientApiServer.CreateDocument, true
case 3:
return "/clientapi.ClientApi/DeleteDocument", drpcEncoding_File_api_apiproto_protos_api_proto{},
return "/clientdebugrpc.ClientApi/DeleteDocument", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCClientApiServer).
DeleteDocument(
@ -325,7 +325,7 @@ func (DRPCClientApiDescription) Method(n int) (string, drpc.Encoding, drpc.Recei
)
}, DRPCClientApiServer.DeleteDocument, true
case 4:
return "/clientapi.ClientApi/AddText", drpcEncoding_File_api_apiproto_protos_api_proto{},
return "/clientdebugrpc.ClientApi/AddText", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCClientApiServer).
AddText(
@ -334,7 +334,7 @@ func (DRPCClientApiDescription) Method(n int) (string, drpc.Encoding, drpc.Recei
)
}, DRPCClientApiServer.AddText, true
case 5:
return "/clientapi.ClientApi/DumpTree", drpcEncoding_File_api_apiproto_protos_api_proto{},
return "/clientdebugrpc.ClientApi/DumpTree", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCClientApiServer).
DumpTree(
@ -343,7 +343,7 @@ func (DRPCClientApiDescription) Method(n int) (string, drpc.Encoding, drpc.Recei
)
}, DRPCClientApiServer.DumpTree, true
case 6:
return "/clientapi.ClientApi/TreeParams", drpcEncoding_File_api_apiproto_protos_api_proto{},
return "/clientdebugrpc.ClientApi/TreeParams", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCClientApiServer).
TreeParams(
@ -352,7 +352,7 @@ func (DRPCClientApiDescription) Method(n int) (string, drpc.Encoding, drpc.Recei
)
}, DRPCClientApiServer.TreeParams, true
case 7:
return "/clientapi.ClientApi/AllTrees", drpcEncoding_File_api_apiproto_protos_api_proto{},
return "/clientdebugrpc.ClientApi/AllTrees", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCClientApiServer).
AllTrees(
@ -361,7 +361,7 @@ func (DRPCClientApiDescription) Method(n int) (string, drpc.Encoding, drpc.Recei
)
}, DRPCClientApiServer.AllTrees, true
case 8:
return "/clientapi.ClientApi/AllSpaces", drpcEncoding_File_api_apiproto_protos_api_proto{},
return "/clientdebugrpc.ClientApi/AllSpaces", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCClientApiServer).
AllSpaces(
@ -370,7 +370,7 @@ func (DRPCClientApiDescription) Method(n int) (string, drpc.Encoding, drpc.Recei
)
}, DRPCClientApiServer.AllSpaces, true
case 9:
return "/clientapi.ClientApi/LoadSpace", drpcEncoding_File_api_apiproto_protos_api_proto{},
return "/clientdebugrpc.ClientApi/LoadSpace", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCClientApiServer).
LoadSpace(
@ -379,7 +379,7 @@ func (DRPCClientApiDescription) Method(n int) (string, drpc.Encoding, drpc.Recei
)
}, DRPCClientApiServer.LoadSpace, true
case 10:
return "/clientapi.ClientApi/Watch", drpcEncoding_File_api_apiproto_protos_api_proto{},
return "/clientdebugrpc.ClientApi/Watch", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCClientApiServer).
Watch(
@ -388,7 +388,7 @@ func (DRPCClientApiDescription) Method(n int) (string, drpc.Encoding, drpc.Recei
)
}, DRPCClientApiServer.Watch, true
case 11:
return "/clientapi.ClientApi/Unwatch", drpcEncoding_File_api_apiproto_protos_api_proto{},
return "/clientdebugrpc.ClientApi/Unwatch", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCClientApiServer).
Unwatch(
@ -397,7 +397,7 @@ func (DRPCClientApiDescription) Method(n int) (string, drpc.Encoding, drpc.Recei
)
}, DRPCClientApiServer.Unwatch, true
case 12:
return "/clientapi.ClientApi/PutFile", drpcEncoding_File_api_apiproto_protos_api_proto{},
return "/clientdebugrpc.ClientApi/PutFile", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCClientApiServer).
PutFile(
@ -406,7 +406,7 @@ func (DRPCClientApiDescription) Method(n int) (string, drpc.Encoding, drpc.Recei
)
}, DRPCClientApiServer.PutFile, true
case 13:
return "/clientapi.ClientApi/GetFile", drpcEncoding_File_api_apiproto_protos_api_proto{},
return "/clientdebugrpc.ClientApi/GetFile", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCClientApiServer).
GetFile(
@ -415,7 +415,7 @@ func (DRPCClientApiDescription) Method(n int) (string, drpc.Encoding, drpc.Recei
)
}, DRPCClientApiServer.GetFile, true
case 14:
return "/clientapi.ClientApi/DeleteFile", drpcEncoding_File_api_apiproto_protos_api_proto{},
return "/clientdebugrpc.ClientApi/DeleteFile", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCClientApiServer).
DeleteFile(
@ -442,7 +442,7 @@ type drpcClientApi_CreateSpaceStream struct {
}
func (x *drpcClientApi_CreateSpaceStream) SendAndClose(m *CreateSpaceResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_api_apiproto_protos_api_proto{}); err != nil {
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
return err
}
return x.CloseSend()
@ -458,7 +458,7 @@ type drpcClientApi_DeriveSpaceStream struct {
}
func (x *drpcClientApi_DeriveSpaceStream) SendAndClose(m *DeriveSpaceResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_api_apiproto_protos_api_proto{}); err != nil {
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
return err
}
return x.CloseSend()
@ -474,7 +474,7 @@ type drpcClientApi_CreateDocumentStream struct {
}
func (x *drpcClientApi_CreateDocumentStream) SendAndClose(m *CreateDocumentResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_api_apiproto_protos_api_proto{}); err != nil {
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
return err
}
return x.CloseSend()
@ -490,7 +490,7 @@ type drpcClientApi_DeleteDocumentStream struct {
}
func (x *drpcClientApi_DeleteDocumentStream) SendAndClose(m *DeleteDocumentResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_api_apiproto_protos_api_proto{}); err != nil {
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
return err
}
return x.CloseSend()
@ -506,7 +506,7 @@ type drpcClientApi_AddTextStream struct {
}
func (x *drpcClientApi_AddTextStream) SendAndClose(m *AddTextResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_api_apiproto_protos_api_proto{}); err != nil {
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
return err
}
return x.CloseSend()
@ -522,7 +522,7 @@ type drpcClientApi_DumpTreeStream struct {
}
func (x *drpcClientApi_DumpTreeStream) SendAndClose(m *DumpTreeResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_api_apiproto_protos_api_proto{}); err != nil {
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
return err
}
return x.CloseSend()
@ -538,7 +538,7 @@ type drpcClientApi_TreeParamsStream struct {
}
func (x *drpcClientApi_TreeParamsStream) SendAndClose(m *TreeParamsResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_api_apiproto_protos_api_proto{}); err != nil {
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
return err
}
return x.CloseSend()
@ -554,7 +554,7 @@ type drpcClientApi_AllTreesStream struct {
}
func (x *drpcClientApi_AllTreesStream) SendAndClose(m *AllTreesResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_api_apiproto_protos_api_proto{}); err != nil {
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
return err
}
return x.CloseSend()
@ -570,7 +570,7 @@ type drpcClientApi_AllSpacesStream struct {
}
func (x *drpcClientApi_AllSpacesStream) SendAndClose(m *AllSpacesResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_api_apiproto_protos_api_proto{}); err != nil {
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
return err
}
return x.CloseSend()
@ -586,7 +586,7 @@ type drpcClientApi_LoadSpaceStream struct {
}
func (x *drpcClientApi_LoadSpaceStream) SendAndClose(m *LoadSpaceResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_api_apiproto_protos_api_proto{}); err != nil {
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
return err
}
return x.CloseSend()
@ -602,7 +602,7 @@ type drpcClientApi_WatchStream struct {
}
func (x *drpcClientApi_WatchStream) SendAndClose(m *WatchResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_api_apiproto_protos_api_proto{}); err != nil {
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
return err
}
return x.CloseSend()
@ -618,7 +618,7 @@ type drpcClientApi_UnwatchStream struct {
}
func (x *drpcClientApi_UnwatchStream) SendAndClose(m *UnwatchResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_api_apiproto_protos_api_proto{}); err != nil {
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
return err
}
return x.CloseSend()
@ -634,7 +634,7 @@ type drpcClientApi_PutFileStream struct {
}
func (x *drpcClientApi_PutFileStream) SendAndClose(m *PutFileResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_api_apiproto_protos_api_proto{}); err != nil {
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
return err
}
return x.CloseSend()
@ -650,7 +650,7 @@ type drpcClientApi_GetFileStream struct {
}
func (x *drpcClientApi_GetFileStream) SendAndClose(m *GetFileResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_api_apiproto_protos_api_proto{}); err != nil {
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
return err
}
return x.CloseSend()
@ -666,7 +666,7 @@ type drpcClientApi_DeleteFileStream struct {
}
func (x *drpcClientApi_DeleteFileStream) SendAndClose(m *DeleteFileResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_api_apiproto_protos_api_proto{}); err != nil {
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
return err
}
return x.CloseSend()

View File

@ -1,7 +1,7 @@
syntax = "proto3";
package clientapi;
package clientdebugrpc;
option go_package = "api/apiproto";
option go_package = "debug/clientdebugrpc/clientdebugrpcproto";
service ClientApi {
rpc CreateSpace(CreateSpaceRequest) returns(CreateSpaceResponse);

View File

@ -1,14 +1,15 @@
package api
package clientdebugrpc
import (
"context"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/api/apiproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/clientspace"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/debug/clientdebugrpc/clientdebugrpcproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/document"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/storage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/account"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/accountservice"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonfile/fileservice"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/syncstatus"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/symmetric"
"github.com/ipfs/go-cid"
"go.uber.org/zap"
@ -21,41 +22,42 @@ type rpcHandler struct {
spaceService clientspace.Service
storageService storage.ClientStorage
docService document.Service
account account.Service
account accountservice.Service
file fileservice.FileService
}
func (r *rpcHandler) Watch(ctx context.Context, request *apiproto.WatchRequest) (resp *apiproto.WatchResponse, err error) {
func (r *rpcHandler) Watch(ctx context.Context, request *clientdebugrpcproto.WatchRequest) (resp *clientdebugrpcproto.WatchResponse, err error) {
space, err := r.spaceService.GetSpace(context.Background(), request.SpaceId)
if err != nil {
return
}
space.StatusService().Watch(request.TreeId)
resp = &apiproto.WatchResponse{}
watcher := space.SyncStatus().(syncstatus.StatusWatcher)
watcher.Watch(request.TreeId)
resp = &clientdebugrpcproto.WatchResponse{}
return
}
func (r *rpcHandler) Unwatch(ctx context.Context, request *apiproto.UnwatchRequest) (resp *apiproto.UnwatchResponse, err error) {
func (r *rpcHandler) Unwatch(ctx context.Context, request *clientdebugrpcproto.UnwatchRequest) (resp *clientdebugrpcproto.UnwatchResponse, err error) {
space, err := r.spaceService.GetSpace(context.Background(), request.SpaceId)
if err != nil {
return
}
space.StatusService().Unwatch(request.TreeId)
resp = &apiproto.UnwatchResponse{}
watcher := space.SyncStatus().(syncstatus.StatusWatcher)
watcher.Unwatch(request.TreeId)
resp = &clientdebugrpcproto.UnwatchResponse{}
return
}
func (r *rpcHandler) LoadSpace(ctx context.Context, request *apiproto.LoadSpaceRequest) (resp *apiproto.LoadSpaceResponse, err error) {
func (r *rpcHandler) LoadSpace(ctx context.Context, request *clientdebugrpcproto.LoadSpaceRequest) (resp *clientdebugrpcproto.LoadSpaceResponse, err error) {
_, err = r.spaceService.GetSpace(context.Background(), request.SpaceId)
if err != nil {
return
}
resp = &apiproto.LoadSpaceResponse{}
resp = &clientdebugrpcproto.LoadSpaceResponse{}
return
}
func (r *rpcHandler) CreateSpace(ctx context.Context, request *apiproto.CreateSpaceRequest) (resp *apiproto.CreateSpaceResponse, err error) {
func (r *rpcHandler) CreateSpace(ctx context.Context, request *clientdebugrpcproto.CreateSpaceRequest) (resp *clientdebugrpcproto.CreateSpaceResponse, err error) {
key, err := symmetric.NewRandom()
if err != nil {
return
@ -73,11 +75,11 @@ func (r *rpcHandler) CreateSpace(ctx context.Context, request *apiproto.CreateSp
if err != nil {
return
}
resp = &apiproto.CreateSpaceResponse{Id: id}
resp = &clientdebugrpcproto.CreateSpaceResponse{Id: id}
return
}
func (r *rpcHandler) DeriveSpace(ctx context.Context, request *apiproto.DeriveSpaceRequest) (resp *apiproto.DeriveSpaceResponse, err error) {
func (r *rpcHandler) DeriveSpace(ctx context.Context, request *clientdebugrpcproto.DeriveSpaceRequest) (resp *clientdebugrpcproto.DeriveSpaceResponse, err error) {
sp, err := r.spaceService.DeriveSpace(context.Background(), commonspace.SpaceDerivePayload{
SigningKey: r.account.Account().SignKey,
EncryptionKey: r.account.Account().EncKey,
@ -89,34 +91,34 @@ func (r *rpcHandler) DeriveSpace(ctx context.Context, request *apiproto.DeriveSp
if err != nil {
return
}
resp = &apiproto.DeriveSpaceResponse{Id: id}
resp = &clientdebugrpcproto.DeriveSpaceResponse{Id: id}
return
}
func (r *rpcHandler) CreateDocument(ctx context.Context, request *apiproto.CreateDocumentRequest) (resp *apiproto.CreateDocumentResponse, err error) {
func (r *rpcHandler) CreateDocument(ctx context.Context, request *clientdebugrpcproto.CreateDocumentRequest) (resp *clientdebugrpcproto.CreateDocumentResponse, err error) {
id, err := r.docService.CreateDocument(request.SpaceId)
if err != nil {
return
}
resp = &apiproto.CreateDocumentResponse{Id: id}
resp = &clientdebugrpcproto.CreateDocumentResponse{Id: id}
return
}
func (r *rpcHandler) DeleteDocument(ctx context.Context, request *apiproto.DeleteDocumentRequest) (resp *apiproto.DeleteDocumentResponse, err error) {
func (r *rpcHandler) DeleteDocument(ctx context.Context, request *clientdebugrpcproto.DeleteDocumentRequest) (resp *clientdebugrpcproto.DeleteDocumentResponse, err error) {
err = r.docService.DeleteDocument(request.SpaceId, request.DocumentId)
if err != nil {
return
}
resp = &apiproto.DeleteDocumentResponse{}
resp = &clientdebugrpcproto.DeleteDocumentResponse{}
return
}
func (r *rpcHandler) AddText(ctx context.Context, request *apiproto.AddTextRequest) (resp *apiproto.AddTextResponse, err error) {
func (r *rpcHandler) AddText(ctx context.Context, request *clientdebugrpcproto.AddTextRequest) (resp *clientdebugrpcproto.AddTextResponse, err error) {
root, head, err := r.docService.AddText(request.SpaceId, request.DocumentId, request.Text, request.IsSnapshot)
if err != nil {
return
}
resp = &apiproto.AddTextResponse{
resp = &clientdebugrpcproto.AddTextResponse{
DocumentId: request.DocumentId,
HeadId: head,
RootId: root,
@ -124,55 +126,55 @@ func (r *rpcHandler) AddText(ctx context.Context, request *apiproto.AddTextReque
return
}
func (r *rpcHandler) DumpTree(ctx context.Context, request *apiproto.DumpTreeRequest) (resp *apiproto.DumpTreeResponse, err error) {
func (r *rpcHandler) DumpTree(ctx context.Context, request *clientdebugrpcproto.DumpTreeRequest) (resp *clientdebugrpcproto.DumpTreeResponse, err error) {
dump, err := r.docService.DumpDocumentTree(request.SpaceId, request.DocumentId)
if err != nil {
return
}
resp = &apiproto.DumpTreeResponse{
resp = &clientdebugrpcproto.DumpTreeResponse{
Dump: dump,
}
return
}
func (r *rpcHandler) AllTrees(ctx context.Context, request *apiproto.AllTreesRequest) (resp *apiproto.AllTreesResponse, err error) {
func (r *rpcHandler) AllTrees(ctx context.Context, request *clientdebugrpcproto.AllTreesRequest) (resp *clientdebugrpcproto.AllTreesResponse, err error) {
heads, err := r.docService.AllDocumentHeads(request.SpaceId)
if err != nil {
return
}
var trees []*apiproto.Tree
var trees []*clientdebugrpcproto.Tree
for _, head := range heads {
trees = append(trees, &apiproto.Tree{
trees = append(trees, &clientdebugrpcproto.Tree{
Id: head.Id,
Heads: head.Heads,
})
}
resp = &apiproto.AllTreesResponse{Trees: trees}
resp = &clientdebugrpcproto.AllTreesResponse{Trees: trees}
return
}
func (r *rpcHandler) AllSpaces(ctx context.Context, request *apiproto.AllSpacesRequest) (resp *apiproto.AllSpacesResponse, err error) {
func (r *rpcHandler) AllSpaces(ctx context.Context, request *clientdebugrpcproto.AllSpacesRequest) (resp *clientdebugrpcproto.AllSpacesResponse, err error) {
ids, err := r.storageService.AllSpaceIds()
if err != nil {
return
}
resp = &apiproto.AllSpacesResponse{SpaceIds: ids}
resp = &clientdebugrpcproto.AllSpacesResponse{SpaceIds: ids}
return
}
func (r *rpcHandler) TreeParams(ctx context.Context, request *apiproto.TreeParamsRequest) (resp *apiproto.TreeParamsResponse, err error) {
func (r *rpcHandler) TreeParams(ctx context.Context, request *clientdebugrpcproto.TreeParamsRequest) (resp *clientdebugrpcproto.TreeParamsResponse, err error) {
root, heads, err := r.docService.TreeParams(request.SpaceId, request.DocumentId)
if err != nil {
return
}
resp = &apiproto.TreeParamsResponse{
resp = &clientdebugrpcproto.TreeParamsResponse{
RootId: root,
HeadIds: heads,
}
return
}
func (r *rpcHandler) PutFile(ctx context.Context, request *apiproto.PutFileRequest) (*apiproto.PutFileResponse, error) {
func (r *rpcHandler) PutFile(ctx context.Context, request *clientdebugrpcproto.PutFileRequest) (*clientdebugrpcproto.PutFileResponse, error) {
f, err := os.Open(request.Path)
if err != nil {
return nil, err
@ -182,12 +184,12 @@ func (r *rpcHandler) PutFile(ctx context.Context, request *apiproto.PutFileReque
if err != nil {
return nil, err
}
return &apiproto.PutFileResponse{
return &clientdebugrpcproto.PutFileResponse{
Hash: n.Cid().String(),
}, nil
}
func (r *rpcHandler) GetFile(ctx context.Context, request *apiproto.GetFileRequest) (*apiproto.GetFileResponse, error) {
func (r *rpcHandler) GetFile(ctx context.Context, request *clientdebugrpcproto.GetFileRequest) (*clientdebugrpcproto.GetFileResponse, error) {
c, err := cid.Parse(request.Hash)
if err != nil {
return nil, err
@ -209,12 +211,12 @@ func (r *rpcHandler) GetFile(ctx context.Context, request *apiproto.GetFileReque
return nil, err
}
log.Info("copied bytes", zap.Int64("size", wr))
return &apiproto.GetFileResponse{
return &clientdebugrpcproto.GetFileResponse{
Path: request.Path,
}, nil
}
func (r *rpcHandler) DeleteFile(ctx context.Context, request *apiproto.DeleteFileRequest) (*apiproto.DeleteFileResponse, error) {
func (r *rpcHandler) DeleteFile(ctx context.Context, request *clientdebugrpcproto.DeleteFileRequest) (*clientdebugrpcproto.DeleteFileResponse, error) {
//TODO implement me
panic("implement me")
}

View File

@ -5,11 +5,11 @@ import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/clientspace"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/clientspace/clientcache"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/document/textdocument"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/account"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/accountservice"
"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/diffservice"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/treegetter"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/headsync"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/treegetter"
)
type Service interface {
@ -17,7 +17,7 @@ type Service interface {
CreateDocument(spaceId string) (id string, err error)
DeleteDocument(spaceId, documentId string) (err error)
AllDocumentIds(spaceId string) (ids []string, err error)
AllDocumentHeads(spaceId string) (ids []diffservice.TreeHeads, err error)
AllDocumentHeads(spaceId string) (ids []headsync.TreeHeads, err error)
AddText(spaceId, documentId, text string, isSnapshot bool) (root, head string, err error)
DumpDocumentTree(spaceId, documentId string) (dump string, err error)
TreeParams(spaceId, documentId string) (root string, head []string, err error)
@ -28,7 +28,7 @@ const CName = "client.document"
var log = logger.NewNamed(CName)
type service struct {
account account.Service
account accountservice.Service
spaceService clientspace.Service
cache clientcache.TreeCache
}
@ -38,7 +38,7 @@ func New() Service {
}
func (s *service) Init(a *app.App) (err error) {
s.account = a.MustComponent(account.CName).(account.Service)
s.account = a.MustComponent(accountservice.CName).(accountservice.Service)
s.spaceService = a.MustComponent(clientspace.CName).(clientspace.Service)
s.cache = a.MustComponent(treegetter.CName).(clientcache.TreeCache)
return
@ -74,7 +74,7 @@ func (s *service) AllDocumentIds(spaceId string) (ids []string, err error) {
return
}
func (s *service) AllDocumentHeads(spaceId string) (ids []diffservice.TreeHeads, err error) {
func (s *service) AllDocumentHeads(spaceId string) (ids []headsync.TreeHeads, err error) {
space, err := s.spaceService.GetSpace(context.Background(), spaceId)
if err != nil {
return

View File

@ -1,6 +1,6 @@
syntax = "proto3";
package anytype;
option go_package = "testchanges";
package textchange;
option go_package = "document/textchangeproto";
message TextContent {
oneof value {

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: pkg/acl/testutils/testchanges/proto/test.proto
// source: document/textchangeproto/protos/textchange.proto
package testchanges
package textchangeproto
import (
fmt "fmt"
@ -33,7 +33,7 @@ func (m *TextContent) Reset() { *m = TextContent{} }
func (m *TextContent) String() string { return proto.CompactTextString(m) }
func (*TextContent) ProtoMessage() {}
func (*TextContent) Descriptor() ([]byte, []int) {
return fileDescriptor_37f33c266ada4318, []int{0}
return fileDescriptor_44a0c2b66e6c4b48, []int{0}
}
func (m *TextContent) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -103,7 +103,7 @@ func (m *TextAppend) Reset() { *m = TextAppend{} }
func (m *TextAppend) String() string { return proto.CompactTextString(m) }
func (*TextAppend) ProtoMessage() {}
func (*TextAppend) Descriptor() ([]byte, []int) {
return fileDescriptor_37f33c266ada4318, []int{1}
return fileDescriptor_44a0c2b66e6c4b48, []int{1}
}
func (m *TextAppend) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -147,7 +147,7 @@ func (m *TextSnapshot) Reset() { *m = TextSnapshot{} }
func (m *TextSnapshot) String() string { return proto.CompactTextString(m) }
func (*TextSnapshot) ProtoMessage() {}
func (*TextSnapshot) Descriptor() ([]byte, []int) {
return fileDescriptor_37f33c266ada4318, []int{2}
return fileDescriptor_44a0c2b66e6c4b48, []int{2}
}
func (m *TextSnapshot) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -192,7 +192,7 @@ func (m *TextData) Reset() { *m = TextData{} }
func (m *TextData) String() string { return proto.CompactTextString(m) }
func (*TextData) ProtoMessage() {}
func (*TextData) Descriptor() ([]byte, []int) {
return fileDescriptor_37f33c266ada4318, []int{3}
return fileDescriptor_44a0c2b66e6c4b48, []int{3}
}
func (m *TextData) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -236,34 +236,33 @@ func (m *TextData) GetSnapshot() *TextSnapshot {
}
func init() {
proto.RegisterType((*TextContent)(nil), "anytype.TextContent")
proto.RegisterType((*TextAppend)(nil), "anytype.TextAppend")
proto.RegisterType((*TextSnapshot)(nil), "anytype.TextSnapshot")
proto.RegisterType((*TextData)(nil), "anytype.TextData")
proto.RegisterType((*TextContent)(nil), "textchange.TextContent")
proto.RegisterType((*TextAppend)(nil), "textchange.TextAppend")
proto.RegisterType((*TextSnapshot)(nil), "textchange.TextSnapshot")
proto.RegisterType((*TextData)(nil), "textchange.TextData")
}
func init() {
proto.RegisterFile("pkg/acl/testutils/testchanges/proto/test.proto", fileDescriptor_37f33c266ada4318)
proto.RegisterFile("document/textchangeproto/protos/textchange.proto", fileDescriptor_44a0c2b66e6c4b48)
}
var fileDescriptor_37f33c266ada4318 = []byte{
// 252 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x2b, 0xc8, 0x4e, 0xd7,
0x4f, 0x4c, 0xce, 0xd1, 0x2f, 0x49, 0x2d, 0x2e, 0x29, 0x2d, 0xc9, 0xcc, 0x29, 0x06, 0xb3, 0x92,
0x33, 0x12, 0xf3, 0xd2, 0x53, 0x8b, 0xf5, 0x0b, 0x8a, 0xf2, 0x4b, 0xf2, 0xc1, 0x22, 0x7a, 0x60,
0xa6, 0x10, 0x7b, 0x62, 0x5e, 0x65, 0x49, 0x65, 0x41, 0xaa, 0x92, 0x2f, 0x17, 0x77, 0x48, 0x6a,
0x45, 0x89, 0x73, 0x7e, 0x5e, 0x49, 0x6a, 0x5e, 0x89, 0x90, 0x29, 0x17, 0x57, 0x49, 0x6a, 0x45,
0x89, 0x63, 0x41, 0x41, 0x6a, 0x5e, 0x8a, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xb7, 0x91, 0xb0, 0x1e,
0x54, 0xb1, 0x5e, 0x08, 0x5c, 0xca, 0x83, 0x21, 0x08, 0x49, 0xa1, 0x13, 0x3b, 0x17, 0x6b, 0x59,
0x62, 0x4e, 0x69, 0xaa, 0x92, 0x02, 0x17, 0x17, 0x42, 0x91, 0x90, 0x10, 0x17, 0x0b, 0x48, 0x11,
0xd8, 0x1c, 0xce, 0x20, 0x30, 0x5b, 0x49, 0x89, 0x8b, 0x07, 0xa4, 0x22, 0x38, 0x2f, 0xb1, 0xa0,
0x38, 0x23, 0xbf, 0x04, 0xab, 0x9a, 0x5c, 0x2e, 0x0e, 0x90, 0x1a, 0x97, 0xc4, 0x92, 0x44, 0x21,
0x3d, 0x2e, 0xf6, 0x64, 0x88, 0xe3, 0x24, 0x18, 0x15, 0x98, 0x35, 0xb8, 0x8d, 0x44, 0x50, 0x9c,
0x03, 0x75, 0x78, 0x10, 0x4c, 0x91, 0x90, 0x21, 0x17, 0x47, 0x31, 0xd4, 0x6c, 0x09, 0x26, 0xb0,
0xfb, 0x45, 0x51, 0x34, 0xc0, 0x2c, 0x0e, 0x82, 0x2b, 0x73, 0x52, 0x3d, 0xf1, 0x48, 0x8e, 0xf1,
0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e,
0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0x6e, 0xa4, 0x40, 0x4c, 0x62, 0x03, 0x07, 0x9d, 0x31, 0x20,
0x00, 0x00, 0xff, 0xff, 0xdc, 0xbf, 0x78, 0xe5, 0x6c, 0x01, 0x00, 0x00,
var fileDescriptor_44a0c2b66e6c4b48 = []byte{
// 239 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x48, 0xc9, 0x4f, 0x2e,
0xcd, 0x4d, 0xcd, 0x2b, 0xd1, 0x2f, 0x49, 0xad, 0x28, 0x49, 0xce, 0x48, 0xcc, 0x4b, 0x4f, 0x2d,
0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x07, 0x93, 0xc5, 0x48, 0xc2, 0x7a, 0x60, 0x11, 0x21, 0x2e, 0x84,
0x88, 0x52, 0x00, 0x17, 0x77, 0x48, 0x6a, 0x45, 0x89, 0x73, 0x7e, 0x5e, 0x49, 0x6a, 0x5e, 0x89,
0x90, 0x05, 0x17, 0x58, 0xd2, 0xb1, 0xa0, 0x20, 0x35, 0x2f, 0x45, 0x82, 0x51, 0x81, 0x51, 0x83,
0xdb, 0x48, 0x4c, 0x0f, 0xc9, 0x84, 0x10, 0xb8, 0xac, 0x07, 0x43, 0x10, 0x92, 0x5a, 0x27, 0x76,
0x2e, 0xd6, 0xb2, 0xc4, 0x9c, 0xd2, 0x54, 0x25, 0x05, 0x2e, 0x2e, 0x84, 0x22, 0x21, 0x21, 0x2e,
0x16, 0x90, 0x22, 0xb0, 0x51, 0x9c, 0x41, 0x60, 0xb6, 0x92, 0x12, 0x17, 0x0f, 0x48, 0x45, 0x70,
0x5e, 0x62, 0x41, 0x71, 0x46, 0x7e, 0x09, 0x56, 0x35, 0xc5, 0x5c, 0x1c, 0x20, 0x35, 0x2e, 0x89,
0x25, 0x89, 0x42, 0x86, 0x5c, 0xec, 0xc9, 0x10, 0xf7, 0x49, 0x30, 0x2a, 0x30, 0x6b, 0x70, 0x1b,
0x89, 0xa3, 0xbb, 0x08, 0xea, 0xfc, 0x20, 0x98, 0x3a, 0x21, 0x13, 0x2e, 0x8e, 0x62, 0xa8, 0xf1,
0x12, 0x4c, 0x60, 0x5f, 0x48, 0xa0, 0xeb, 0x81, 0x59, 0x1f, 0x04, 0x57, 0xe9, 0x64, 0x74, 0xe2,
0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70,
0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x12, 0xb8, 0x02, 0x39, 0x89, 0x0d, 0x4c,
0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x87, 0x3d, 0x8c, 0x61, 0x87, 0x01, 0x00, 0x00,
}
func (m *TextContent) Marshal() (dAtA []byte, err error) {
@ -312,7 +311,7 @@ func (m *TextContent_TextAppend) MarshalToSizedBuffer(dAtA []byte) (int, error)
return 0, err
}
i -= size
i = encodeVarintTest(dAtA, i, uint64(size))
i = encodeVarintTextchange(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
@ -342,7 +341,7 @@ func (m *TextAppend) MarshalToSizedBuffer(dAtA []byte) (int, error) {
if len(m.Text) > 0 {
i -= len(m.Text)
copy(dAtA[i:], m.Text)
i = encodeVarintTest(dAtA, i, uint64(len(m.Text)))
i = encodeVarintTextchange(dAtA, i, uint64(len(m.Text)))
i--
dAtA[i] = 0xa
}
@ -372,7 +371,7 @@ func (m *TextSnapshot) MarshalToSizedBuffer(dAtA []byte) (int, error) {
if len(m.Text) > 0 {
i -= len(m.Text)
copy(dAtA[i:], m.Text)
i = encodeVarintTest(dAtA, i, uint64(len(m.Text)))
i = encodeVarintTextchange(dAtA, i, uint64(len(m.Text)))
i--
dAtA[i] = 0xa
}
@ -406,7 +405,7 @@ func (m *TextData) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return 0, err
}
i -= size
i = encodeVarintTest(dAtA, i, uint64(size))
i = encodeVarintTextchange(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
@ -419,7 +418,7 @@ func (m *TextData) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return 0, err
}
i -= size
i = encodeVarintTest(dAtA, i, uint64(size))
i = encodeVarintTextchange(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
@ -428,8 +427,8 @@ func (m *TextData) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
func encodeVarintTest(dAtA []byte, offset int, v uint64) int {
offset -= sovTest(v)
func encodeVarintTextchange(dAtA []byte, offset int, v uint64) int {
offset -= sovTextchange(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
@ -459,7 +458,7 @@ func (m *TextContent_TextAppend) Size() (n int) {
_ = l
if m.TextAppend != nil {
l = m.TextAppend.Size()
n += 1 + l + sovTest(uint64(l))
n += 1 + l + sovTextchange(uint64(l))
}
return n
}
@ -471,7 +470,7 @@ func (m *TextAppend) Size() (n int) {
_ = l
l = len(m.Text)
if l > 0 {
n += 1 + l + sovTest(uint64(l))
n += 1 + l + sovTextchange(uint64(l))
}
return n
}
@ -484,7 +483,7 @@ func (m *TextSnapshot) Size() (n int) {
_ = l
l = len(m.Text)
if l > 0 {
n += 1 + l + sovTest(uint64(l))
n += 1 + l + sovTextchange(uint64(l))
}
return n
}
@ -498,21 +497,21 @@ func (m *TextData) Size() (n int) {
if len(m.Content) > 0 {
for _, e := range m.Content {
l = e.Size()
n += 1 + l + sovTest(uint64(l))
n += 1 + l + sovTextchange(uint64(l))
}
}
if m.Snapshot != nil {
l = m.Snapshot.Size()
n += 1 + l + sovTest(uint64(l))
n += 1 + l + sovTextchange(uint64(l))
}
return n
}
func sovTest(x uint64) (n int) {
func sovTextchange(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozTest(x uint64) (n int) {
return sovTest(uint64((x << 1) ^ uint64((int64(x) >> 63))))
func sozTextchange(x uint64) (n int) {
return sovTextchange(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *TextContent) Unmarshal(dAtA []byte) error {
l := len(dAtA)
@ -522,7 +521,7 @@ func (m *TextContent) Unmarshal(dAtA []byte) error {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTest
return ErrIntOverflowTextchange
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
@ -550,7 +549,7 @@ func (m *TextContent) Unmarshal(dAtA []byte) error {
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTest
return ErrIntOverflowTextchange
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
@ -563,11 +562,11 @@ func (m *TextContent) Unmarshal(dAtA []byte) error {
}
}
if msglen < 0 {
return ErrInvalidLengthTest
return ErrInvalidLengthTextchange
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTest
return ErrInvalidLengthTextchange
}
if postIndex > l {
return io.ErrUnexpectedEOF
@ -580,12 +579,12 @@ func (m *TextContent) Unmarshal(dAtA []byte) error {
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTest(dAtA[iNdEx:])
skippy, err := skipTextchange(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTest
return ErrInvalidLengthTextchange
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
@ -607,7 +606,7 @@ func (m *TextAppend) Unmarshal(dAtA []byte) error {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTest
return ErrIntOverflowTextchange
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
@ -635,7 +634,7 @@ func (m *TextAppend) Unmarshal(dAtA []byte) error {
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTest
return ErrIntOverflowTextchange
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
@ -649,11 +648,11 @@ func (m *TextAppend) Unmarshal(dAtA []byte) error {
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTest
return ErrInvalidLengthTextchange
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTest
return ErrInvalidLengthTextchange
}
if postIndex > l {
return io.ErrUnexpectedEOF
@ -662,12 +661,12 @@ func (m *TextAppend) Unmarshal(dAtA []byte) error {
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTest(dAtA[iNdEx:])
skippy, err := skipTextchange(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTest
return ErrInvalidLengthTextchange
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
@ -689,7 +688,7 @@ func (m *TextSnapshot) Unmarshal(dAtA []byte) error {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTest
return ErrIntOverflowTextchange
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
@ -717,7 +716,7 @@ func (m *TextSnapshot) Unmarshal(dAtA []byte) error {
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTest
return ErrIntOverflowTextchange
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
@ -731,11 +730,11 @@ func (m *TextSnapshot) Unmarshal(dAtA []byte) error {
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthTest
return ErrInvalidLengthTextchange
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthTest
return ErrInvalidLengthTextchange
}
if postIndex > l {
return io.ErrUnexpectedEOF
@ -744,12 +743,12 @@ func (m *TextSnapshot) Unmarshal(dAtA []byte) error {
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTest(dAtA[iNdEx:])
skippy, err := skipTextchange(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTest
return ErrInvalidLengthTextchange
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
@ -771,7 +770,7 @@ func (m *TextData) Unmarshal(dAtA []byte) error {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTest
return ErrIntOverflowTextchange
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
@ -799,7 +798,7 @@ func (m *TextData) Unmarshal(dAtA []byte) error {
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTest
return ErrIntOverflowTextchange
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
@ -812,11 +811,11 @@ func (m *TextData) Unmarshal(dAtA []byte) error {
}
}
if msglen < 0 {
return ErrInvalidLengthTest
return ErrInvalidLengthTextchange
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTest
return ErrInvalidLengthTextchange
}
if postIndex > l {
return io.ErrUnexpectedEOF
@ -833,7 +832,7 @@ func (m *TextData) Unmarshal(dAtA []byte) error {
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTest
return ErrIntOverflowTextchange
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
@ -846,11 +845,11 @@ func (m *TextData) Unmarshal(dAtA []byte) error {
}
}
if msglen < 0 {
return ErrInvalidLengthTest
return ErrInvalidLengthTextchange
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTest
return ErrInvalidLengthTextchange
}
if postIndex > l {
return io.ErrUnexpectedEOF
@ -864,12 +863,12 @@ func (m *TextData) Unmarshal(dAtA []byte) error {
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTest(dAtA[iNdEx:])
skippy, err := skipTextchange(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTest
return ErrInvalidLengthTextchange
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
@ -883,7 +882,7 @@ func (m *TextData) Unmarshal(dAtA []byte) error {
}
return nil
}
func skipTest(dAtA []byte) (n int, err error) {
func skipTextchange(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
@ -891,7 +890,7 @@ func skipTest(dAtA []byte) (n int, err error) {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTest
return 0, ErrIntOverflowTextchange
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
@ -908,7 +907,7 @@ func skipTest(dAtA []byte) (n int, err error) {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTest
return 0, ErrIntOverflowTextchange
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
@ -924,7 +923,7 @@ func skipTest(dAtA []byte) (n int, err error) {
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowTest
return 0, ErrIntOverflowTextchange
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
@ -937,14 +936,14 @@ func skipTest(dAtA []byte) (n int, err error) {
}
}
if length < 0 {
return 0, ErrInvalidLengthTest
return 0, ErrInvalidLengthTextchange
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupTest
return 0, ErrUnexpectedEndOfGroupTextchange
}
depth--
case 5:
@ -953,7 +952,7 @@ func skipTest(dAtA []byte) (n int, err error) {
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthTest
return 0, ErrInvalidLengthTextchange
}
if depth == 0 {
return iNdEx, nil
@ -963,7 +962,7 @@ func skipTest(dAtA []byte) (n int, err error) {
}
var (
ErrInvalidLengthTest = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowTest = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupTest = fmt.Errorf("proto: unexpected end of group")
ErrInvalidLengthTextchange = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowTextchange = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupTextchange = fmt.Errorf("proto: unexpected end of group")
)

View File

@ -2,17 +2,17 @@ package textdocument
import (
"context"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/account"
textchange "github.com/anytypeio/go-anytype-infrastructure-experiments/client/document/textchangeproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/accountservice"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace"
"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/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/objecttree"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/synctree/updatelistener"
"github.com/gogo/protobuf/proto"
)
type TextDocument interface {
tree.ObjectTree
InnerTree() tree.ObjectTree
objecttree.ObjectTree
InnerTree() objecttree.ObjectTree
AddText(text string, isSnapshot bool) (string, string, error)
Text() (string, error)
TreeDump() string
@ -20,15 +20,15 @@ type TextDocument interface {
}
type textDocument struct {
tree.ObjectTree
account account.Service
objecttree.ObjectTree
account accountservice.Service
}
func CreateTextDocument(
ctx context.Context,
space commonspace.Space,
account account.Service) (id string, err error) {
payload := tree.ObjectTreeCreatePayload{
account accountservice.Service) (id string, err error) {
payload := objecttree.ObjectTreeCreatePayload{
SignKey: account.Account().SignKey,
SpaceId: space.Id(),
Identity: account.Account().Identity,
@ -36,7 +36,7 @@ func CreateTextDocument(
return space.CreateTree(ctx, payload)
}
func NewTextDocument(ctx context.Context, space commonspace.Space, id string, listener updatelistener.UpdateListener, account account.Service) (doc TextDocument, err error) {
func NewTextDocument(ctx context.Context, space commonspace.Space, id string, listener updatelistener.UpdateListener, account accountservice.Service) (doc TextDocument, err error) {
t, err := space.BuildTree(ctx, id, listener)
if err != nil {
return
@ -47,16 +47,16 @@ func NewTextDocument(ctx context.Context, space commonspace.Space, id string, li
}, nil
}
func (t *textDocument) InnerTree() tree.ObjectTree {
func (t *textDocument) InnerTree() objecttree.ObjectTree {
return t.ObjectTree
}
func (t *textDocument) AddText(text string, isSnapshot bool) (root, head string, err error) {
content := &testchanges.TextContent_TextAppend{
TextAppend: &testchanges.TextAppend{Text: text},
content := &textchange.TextContent_TextAppend{
TextAppend: &textchange.TextAppend{Text: text},
}
change := &testchanges.TextData{
Content: []*testchanges.TextContent{
change := &textchange.TextData{
Content: []*textchange.TextContent{
{content},
},
Snapshot: nil,
@ -67,7 +67,7 @@ func (t *textDocument) AddText(text string, isSnapshot bool) (root, head string,
}
t.Lock()
defer t.Unlock()
addRes, err := t.AddContent(context.Background(), tree.SignableChangeContent{
addRes, err := t.AddContent(context.Background(), objecttree.SignableChangeContent{
Data: res,
Key: t.account.Account().SignKey,
Identity: t.account.Account().Identity,
@ -87,7 +87,7 @@ func (t *textDocument) Text() (text string, err error) {
err = t.Iterate(
func(decrypted []byte) (any, error) {
textChange := &testchanges.TextData{}
textChange := &textchange.TextData{}
err = proto.Unmarshal(decrypted, textChange)
if err != nil {
return nil, err
@ -98,7 +98,7 @@ func (t *textDocument) Text() (text string, err error) {
}
}
return textChange, nil
}, func(change *tree.Change) bool {
}, func(change *objecttree.Change) bool {
return true
})
return

View File

@ -3,7 +3,7 @@ package rpcstore
import (
"context"
"fmt"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/ocache"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/ocache"
"github.com/cheggaaa/mb/v3"
"go.uber.org/zap"
"math/rand"

View File

@ -3,12 +3,15 @@ package rpcstore
import (
"context"
"fmt"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/config"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/accountservice/mock_accountservice"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonfile/fileblockstore"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonfile/fileproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/config"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/accountdata"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/rpc/rpctest"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/nodeconf"
"github.com/golang/mock/gomock"
blocks "github.com/ipfs/go-block-format"
"github.com/ipfs/go-cid"
"github.com/stretchr/testify/assert"
@ -115,14 +118,16 @@ func newFixture(t *testing.T) *fixture {
conf := &config.Config{}
for i := 0; i < 11; i++ {
conf.Nodes = append(conf.Nodes, config.Node{
conf.Nodes = append(conf.Nodes, nodeconf.NodeConfig{
PeerId: fmt.Sprint(i),
Types: []config.NodeType{config.NodeTypeFile},
Types: []nodeconf.NodeType{nodeconf.NodeTypeFile},
})
}
rserv := rpctest.NewTestServer()
require.NoError(t, fileproto.DRPCRegisterFile(rserv.Mux, fx.serv))
fx.ctrl = gomock.NewController(t)
fx.a.Register(fx.s).
Register(mock_accountservice.NewAccountServiceWithAccount(fx.ctrl, &accountdata.AccountData{})).
Register(rpctest.NewTestPool().WithServer(rserv)).
Register(nodeconf.New()).
Register(conf)
@ -136,11 +141,13 @@ type fixture struct {
s *service
a *app.App
serv *testServer
ctrl *gomock.Controller
}
func (fx *fixture) Finish(t *testing.T) {
assert.NoError(t, fx.store.Close())
assert.NoError(t, fx.a.Close(ctx))
fx.ctrl.Finish()
}
type testServer struct {

View File

@ -5,27 +5,36 @@ replace github.com/anytypeio/go-anytype-infrastructure-experiments/common => ../
go 1.19
require (
github.com/VividCortex/ewma v1.2.0
github.com/anytypeio/go-anytype-infrastructure-experiments/common v0.0.0-00010101000000-000000000000
github.com/cheggaaa/mb/v3 v3.0.0-20221122160120-e9034545510c
github.com/dgraph-io/badger/v3 v3.2103.3
github.com/gogo/protobuf v1.3.2
github.com/golang/mock v1.6.0
github.com/ipfs/go-block-format v0.0.3
github.com/ipfs/go-cid v0.3.2
github.com/ipfs/go-ipld-format v0.4.0
github.com/stretchr/testify v1.8.1
go.uber.org/multierr v1.9.0
go.uber.org/zap v1.24.0
gopkg.in/yaml.v3 v3.0.1
storj.io/drpc v0.0.32
)
require (
github.com/VividCortex/ewma v1.2.0 // indirect
github.com/alecthomas/units v0.0.0-20210927113745-59d0afb8317a // indirect
github.com/anytypeio/go-anytype-infrastructure-experiments/consensus v0.0.0-20221217135026-4eba413631b3 // indirect
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/cheggaaa/mb/v3 v3.0.0-20221122160120-e9034545510c // indirect
github.com/davecgh/go-spew v1.1.1 // 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/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // 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
@ -33,9 +42,31 @@ require (
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/google/uuid v1.3.0 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/huandu/skiplist v1.2.0 // indirect
github.com/ipfs/go-cid v0.3.2 // indirect
github.com/ipfs/bbloom v0.0.4 // indirect
github.com/ipfs/go-bitfield v1.0.0 // indirect
github.com/ipfs/go-blockservice v0.5.0 // indirect
github.com/ipfs/go-datastore v0.6.0 // indirect
github.com/ipfs/go-ipfs-blockstore v1.2.0 // indirect
github.com/ipfs/go-ipfs-chunker v0.0.5 // indirect
github.com/ipfs/go-ipfs-ds-help v1.1.0 // indirect
github.com/ipfs/go-ipfs-exchange-interface v0.2.0 // indirect
github.com/ipfs/go-ipfs-files v0.0.3 // indirect
github.com/ipfs/go-ipfs-posinfo v0.0.1 // indirect
github.com/ipfs/go-ipfs-util v0.0.2 // indirect
github.com/ipfs/go-ipld-cbor v0.0.6 // indirect
github.com/ipfs/go-ipld-legacy v0.1.1 // indirect
github.com/ipfs/go-log v1.0.5 // indirect
github.com/ipfs/go-log/v2 v2.5.1 // indirect
github.com/ipfs/go-merkledag v0.8.1 // indirect
github.com/ipfs/go-metrics-interface v0.0.1 // indirect
github.com/ipfs/go-unixfs v0.4.1 // indirect
github.com/ipfs/go-verifcid v0.0.2 // indirect
github.com/ipld/go-codec-dagpb v1.5.0 // indirect
github.com/ipld/go-ipld-prime v0.19.0 // indirect
github.com/jbenet/goprocess v0.1.4 // indirect
github.com/klauspost/compress v1.15.10 // indirect
github.com/klauspost/cpuid/v2 v2.2.2 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
@ -53,25 +84,31 @@ require (
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.7 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/polydawn/refmt v0.89.0 // 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/whyrusleeping/cbor-gen v0.0.0-20221213004032-c09a31a7d5e8 // indirect
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f // 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.opentelemetry.io/otel v1.11.2 // indirect
go.opentelemetry.io/otel/trace v1.11.2 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/crypto v0.4.0 // indirect
golang.org/x/exp v0.0.0-20220916125017-b168a2c6b86b // indirect
golang.org/x/image v0.0.0-20200119044424-58c23975cae1 // indirect
golang.org/x/net v0.3.0 // indirect
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/blake3 v1.1.7 // indirect
)

View File

@ -42,6 +42,8 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/alecthomas/units v0.0.0-20210927113745-59d0afb8317a h1:E/8AP5dFtMhl5KPJz66Kt9G0n+7Sn41Fy1wv9/jHOrc=
github.com/alecthomas/units v0.0.0-20210927113745-59d0afb8317a/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE=
github.com/anytypeio/go-anytype-infrastructure-experiments/consensus v0.0.0-20221217135026-4eba413631b3 h1:yIyGIb7bRkEngKtQ0Ja5bome2SEnErwTaEvR8dA/WtU=
github.com/anytypeio/go-anytype-infrastructure-experiments/consensus v0.0.0-20221217135026-4eba413631b3/go.mod h1:w0i62cRB2jVpjFb2CpPNj5J+ihKqqmBBG9X2+Odekjw=
github.com/anytypeio/go-chash v0.0.0-20220629194632-4ad1154fe232 h1:kMPPZYmJgbs4AJfodbg2OCXg5cp+9LPAJcLZJqmcghk=
@ -73,6 +75,8 @@ github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee
github.com/corona10/goimagehash v1.0.2 h1:pUfB0LnsJASMPGEZLj7tGY251vF+qLGqOgEP4rUs6kA=
github.com/corona10/goimagehash v1.0.2/go.mod h1:/l9umBhvcHQXVtQO1V6Gp1yD20STawkhRnnX0D1bvVI=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cskr/pubsub v1.0.2 h1:vlOzMhl6PFn60gRlTQQsIfVwaPB/B/8MziK8FhEPt/0=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@ -93,6 +97,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fogleman/gg v1.3.0 h1:/7zJX8F6AaYQc57WQCyN9cAIz+4bCJGO9B+dyW29am8=
github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k=
github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
@ -105,10 +111,17 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0=
github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0=
github.com/goccy/go-graphviz v0.0.9 h1:s/FMMJ1Joj6La3S5ApO3Jk2cwM4LpXECC2muFx3IPQQ=
github.com/goccy/go-graphviz v0.0.9/go.mod h1:wXVsXxmyMQU6TN3zGRttjNn3h+iCAS7xQFC6TlNvLhk=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
@ -127,6 +140,7 @@ github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
@ -160,8 +174,9 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
@ -172,22 +187,106 @@ github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hf
github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU=
github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c=
github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U=
github.com/huandu/skiplist v1.2.0 h1:gox56QD77HzSC0w+Ws3MH3iie755GBJU1OER3h5VsYw=
github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w=
github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs=
github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0=
github.com/ipfs/go-bitfield v1.0.0 h1:y/XHm2GEmD9wKngheWNNCNL0pzrWXZwCdQGv1ikXknQ=
github.com/ipfs/go-bitfield v1.0.0/go.mod h1:N/UiujQy+K+ceU1EF5EkVd1TNqevLrCQMIcAEPrdtus=
github.com/ipfs/go-bitswap v0.11.0 h1:j1WVvhDX1yhG32NTC9xfxnqycqYIlhzEzLXG/cU1HyQ=
github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY=
github.com/ipfs/go-block-format v0.0.3 h1:r8t66QstRp/pd/or4dpnbVfXT5Gt7lOqRvC+/dDTpMc=
github.com/ipfs/go-block-format v0.0.3/go.mod h1:4LmD4ZUw0mhO+JSKdpWwrzATiEfM7WWgQ8H5l6P8MVk=
github.com/ipfs/go-blockservice v0.5.0 h1:B2mwhhhVQl2ntW2EIpaWPwSCxSuqr5fFA93Ms4bYLEY=
github.com/ipfs/go-blockservice v0.5.0/go.mod h1:W6brZ5k20AehbmERplmERn8o2Ni3ZZubvAxaIUeaT6w=
github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
github.com/ipfs/go-cid v0.0.4/go.mod h1:4LLaPOQwmk5z9LBgQnpkivrx8BJjUyGwTXCd5Xfj6+M=
github.com/ipfs/go-cid v0.0.5/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog=
github.com/ipfs/go-cid v0.0.6/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I=
github.com/ipfs/go-cid v0.0.7/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I=
github.com/ipfs/go-cid v0.3.2 h1:OGgOd+JCFM+y1DjWPmVH+2/4POtpDzwcr7VgnB7mZXc=
github.com/ipfs/go-cid v0.3.2/go.mod h1:gQ8pKqT/sUxGY+tIwy1RPpAojYu7jAyCp5Tz1svoupw=
github.com/ipfs/go-datastore v0.5.0/go.mod h1:9zhEApYMTl17C8YDp7JmU7sQZi2/wqiYh73hakZ90Bk=
github.com/ipfs/go-datastore v0.6.0 h1:JKyz+Gvz1QEZw0LsX1IBn+JFCJQH4SJVFtM4uWU0Myk=
github.com/ipfs/go-datastore v0.6.0/go.mod h1:rt5M3nNbSO/8q1t4LNkLyUwRs8HupMeN/8O4Vn9YAT8=
github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk=
github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps=
github.com/ipfs/go-ipfs-blockstore v1.2.0 h1:n3WTeJ4LdICWs/0VSfjHrlqpPpl6MZ+ySd3j8qz0ykw=
github.com/ipfs/go-ipfs-blockstore v1.2.0/go.mod h1:eh8eTFLiINYNSNawfZOC7HOxNTxpB1PFuA5E1m/7exE=
github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ=
github.com/ipfs/go-ipfs-chunker v0.0.5 h1:ojCf7HV/m+uS2vhUGWcogIIxiO5ubl5O57Q7NapWLY8=
github.com/ipfs/go-ipfs-chunker v0.0.5/go.mod h1:jhgdF8vxRHycr00k13FM8Y0E+6BoalYeobXmUyTreP8=
github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw=
github.com/ipfs/go-ipfs-delay v0.0.1 h1:r/UXYyRcddO6thwOnhiznIAiSvxMECGgtv35Xs1IeRQ=
github.com/ipfs/go-ipfs-ds-help v1.1.0 h1:yLE2w9RAsl31LtfMt91tRZcrx+e61O5mDxFRR994w4Q=
github.com/ipfs/go-ipfs-ds-help v1.1.0/go.mod h1:YR5+6EaebOhfcqVCyqemItCLthrpVNot+rsOU/5IatU=
github.com/ipfs/go-ipfs-exchange-interface v0.2.0 h1:8lMSJmKogZYNo2jjhUs0izT+dck05pqUw4mWNW9Pw6Y=
github.com/ipfs/go-ipfs-exchange-interface v0.2.0/go.mod h1:z6+RhJuDQbqKguVyslSOuVDhqF9JtTrO3eptSAiW2/Y=
github.com/ipfs/go-ipfs-exchange-offline v0.3.0 h1:c/Dg8GDPzixGd0MC8Jh6mjOwU57uYokgWRFidfvEkuA=
github.com/ipfs/go-ipfs-files v0.0.3 h1:ME+QnC3uOyla1ciRPezDW0ynQYK2ikOh9OCKAEg4uUA=
github.com/ipfs/go-ipfs-files v0.0.3/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4=
github.com/ipfs/go-ipfs-posinfo v0.0.1 h1:Esoxj+1JgSjX0+ylc0hUmJCOv6V2vFoZiETLR6OtpRs=
github.com/ipfs/go-ipfs-posinfo v0.0.1/go.mod h1:SwyeVP+jCwiDu0C313l/8jg6ZxM0qqtlt2a0vILTc1A=
github.com/ipfs/go-ipfs-pq v0.0.2 h1:e1vOOW6MuOwG2lqxcLA+wEn93i/9laCY8sXAw76jFOY=
github.com/ipfs/go-ipfs-routing v0.3.0 h1:9W/W3N+g+y4ZDeffSgqhgo7BsBSJwPMcyssET9OWevc=
github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc=
github.com/ipfs/go-ipfs-util v0.0.2 h1:59Sswnk1MFaiq+VcaknX7aYEyGyGDAA73ilhEK2POp8=
github.com/ipfs/go-ipfs-util v0.0.2/go.mod h1:CbPtkWJzjLdEcezDns2XYaehFVNXG9zrdrtMecczcsQ=
github.com/ipfs/go-ipld-cbor v0.0.6 h1:pYuWHyvSpIsOOLw4Jy7NbBkCyzLDcl64Bf/LZW7eBQ0=
github.com/ipfs/go-ipld-cbor v0.0.6/go.mod h1:ssdxxaLJPXH7OjF5V4NSjBbcfh+evoR4ukuru0oPXMA=
github.com/ipfs/go-ipld-format v0.0.1/go.mod h1:kyJtbkDALmFHv3QR6et67i35QzO3S0dCDnkOJhcZkms=
github.com/ipfs/go-ipld-format v0.2.0/go.mod h1:3l3C1uKoadTPbeNfrDi+xMInYKlx2Cvg1BuydPSdzQs=
github.com/ipfs/go-ipld-format v0.3.0/go.mod h1:co/SdBE8h99968X0hViiw1MNlh6fvxxnHpvVLnH7jSM=
github.com/ipfs/go-ipld-format v0.4.0 h1:yqJSaJftjmjc9jEOFYlpkwOLVKv68OD27jFLlSghBlQ=
github.com/ipfs/go-ipld-format v0.4.0/go.mod h1:co/SdBE8h99968X0hViiw1MNlh6fvxxnHpvVLnH7jSM=
github.com/ipfs/go-ipld-legacy v0.1.1 h1:BvD8PEuqwBHLTKqlGFTHSwrwFOMkVESEvwIYwR2cdcc=
github.com/ipfs/go-ipld-legacy v0.1.1/go.mod h1:8AyKFCjgRPsQFf15ZQgDB8Din4DML/fOmKZkkFkrIEg=
github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM=
github.com/ipfs/go-log v1.0.5 h1:2dOuUCB1Z7uoczMWgAyDck5JLb72zHzrMnGnCNNbvY8=
github.com/ipfs/go-log v1.0.5/go.mod h1:j0b8ZoR+7+R99LD9jZ6+AJsrzkPbSXbZfGakb5JPtIo=
github.com/ipfs/go-log/v2 v2.1.3/go.mod h1:/8d0SH3Su5Ooc31QlL1WysJhvyOTDCjcCZ9Axpmri6g=
github.com/ipfs/go-log/v2 v2.5.1 h1:1XdUzF7048prq4aBjDQQ4SL5RxftpRGdXhNRwKSAlcY=
github.com/ipfs/go-log/v2 v2.5.1/go.mod h1:prSpmC1Gpllc9UYWxDiZDreBYw7zp4Iqp1kOLU9U5UI=
github.com/ipfs/go-merkledag v0.8.1 h1:N3yrqSre/ffvdwtHL4MXy0n7XH+VzN8DlzDrJySPa94=
github.com/ipfs/go-merkledag v0.8.1/go.mod h1:uYUlWE34GhbcTjGuUDEcdPzsEtOdnOupL64NgSRjmWI=
github.com/ipfs/go-metrics-interface v0.0.1 h1:j+cpbjYvu4R8zbleSs36gvB7jR+wsL2fGD6n0jO4kdg=
github.com/ipfs/go-metrics-interface v0.0.1/go.mod h1:6s6euYU4zowdslK0GKHmqaIZ3j/b/tL7HTWtJ4VPgWY=
github.com/ipfs/go-peertaskqueue v0.8.0 h1:JyNO144tfu9bx6Hpo119zvbEL9iQ760FHOiJYsUjqaU=
github.com/ipfs/go-unixfs v0.4.1 h1:nmJFKvF+khK03PIWyCxxydD/nkQX315NZDcgvRqMXf0=
github.com/ipfs/go-unixfs v0.4.1/go.mod h1:2SUDFhUSzrcL408B1qpIkJJ5HznnyTzweViPXUAvkNg=
github.com/ipfs/go-verifcid v0.0.2 h1:XPnUv0XmdH+ZIhLGKg6U2vaPaRDXb9urMyNVCE7uvTs=
github.com/ipfs/go-verifcid v0.0.2/go.mod h1:40cD9x1y4OWnFXbLNJYRe7MpNvWlMn3LZAG5Wb4xnPU=
github.com/ipld/go-codec-dagpb v1.5.0 h1:RspDRdsJpLfgCI0ONhTAnbHdySGD4t+LHSPK4X1+R0k=
github.com/ipld/go-codec-dagpb v1.5.0/go.mod h1:0yRIutEFD8o1DGVqw4RSHh+BUTlJA9XWldxaaWR/o4g=
github.com/ipld/go-ipld-prime v0.9.1-0.20210324083106-dc342a9917db/go.mod h1:KvBLMr4PX1gWptgkzRjVZCrLmSGcZCb/jioOQwCqZN8=
github.com/ipld/go-ipld-prime v0.19.0 h1:5axC7rJmPc17Emw6TelxGwnzALk0PdupZ2oj2roDj04=
github.com/ipld/go-ipld-prime v0.19.0/go.mod h1:Q9j3BaVXwaA3o5JUDNvptDDr/x8+F7FG6XJ8WI3ILg4=
github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus=
github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA=
github.com/jbenet/goprocess v0.1.4 h1:DRGOFReOMqqDNXwW70QkacFW0YN9QnwLV0Vqk+3oU0o=
github.com/jbenet/goprocess v0.1.4/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
@ -196,8 +295,12 @@ github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
@ -206,24 +309,36 @@ github.com/klauspost/compress v1.15.10/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrD
github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c=
github.com/klauspost/cpuid/v2 v2.1.1 h1:t0wUqjowdm8ezddV5k0tLWVklVuvLJpoHeb4WBdydm0=
github.com/klauspost/cpuid/v2 v2.1.1/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
github.com/klauspost/cpuid/v2 v2.2.2 h1:xPMwiykqNK9VK0NYC3+jTMYv9I6Vl3YdjZgPZKG3zO0=
github.com/klauspost/cpuid/v2 v2.2.2/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/koron/go-ssdp v0.0.3 h1:JivLMY45N76b4p/vsWGOKewBQu6uf39y8l+AQ7sDKx8=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM=
github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8=
github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg=
github.com/libp2p/go-cidranger v1.1.0 h1:ewPN8EZ0dd1LSnrtuwd4709PXVcITVeuwbag38yPW7c=
github.com/libp2p/go-libp2p v0.23.2 h1:yqyTeKQJyofWXxEv/eEVUvOrGdt/9x+0PIQ4N1kaxmE=
github.com/libp2p/go-libp2p v0.23.2/go.mod h1:s9DEa5NLR4g+LZS+md5uGU4emjMWFiqkZr6hBTY8UxI=
github.com/libp2p/go-libp2p-asn-util v0.2.0 h1:rg3+Os8jbnO5DxkC7K/Utdi+DkY3q/d1/1q+8WeNAsw=
github.com/libp2p/go-libp2p-record v0.2.0 h1:oiNUOCWno2BFuxt3my4i1frNrt7PerzB3queqa1NkQ0=
github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
github.com/libp2p/go-msgio v0.2.0 h1:W6shmB+FeynDrUVl2dgFQvzfBZcXiyqY4VmpQLu9FqU=
github.com/libp2p/go-nat v0.1.0 h1:MfVsH6DLcpa04Xr+p8hmVRG4juse0s3J8HyNWYHffXg=
github.com/libp2p/go-netroute v0.2.0 h1:0FpsbsvuSnAhXFnCY0VLFbJOzaK0VnP0r1QT/o4nWRE=
github.com/libp2p/go-openssl v0.1.0 h1:LBkKEcUv6vtZIQLVTegAil8jbNpJErQ9AnT+bWV+Ooo=
github.com/libp2p/go-openssl v0.1.0/go.mod h1:OiOxwPpL3n4xlenjx2h7AwSGaFSC/KZvf6gNdOBQMtc=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
@ -231,6 +346,10 @@ github.com/mattn/go-pointer v0.0.1 h1:n+XhsuGeVO6MEAp7xyEukFINEa+Quek5psIR/ylA6o
github.com/mattn/go-pointer v0.0.1/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc=
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/miekg/dns v1.1.50 h1:DQUfb9uc6smULcREF09Uc+/Gd46YWqJd5DbpPE9xkcA=
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ=
github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U=
github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM=
github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g=
github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
@ -240,28 +359,46 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8=
github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA=
github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aGkbLYxPE=
github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI=
github.com/multiformats/go-base36 v0.1.0 h1:JR6TyF7JjGd3m6FbLU2cOxhC0Li8z8dLNGQ89tUg4F4=
github.com/multiformats/go-base36 v0.1.0/go.mod h1:kFGE83c6s80PklsHO9sRn2NCoffoRdUUOENyW/Vv6sM=
github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0=
github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4=
github.com/multiformats/go-multiaddr v0.7.0 h1:gskHcdaCyPtp9XskVwtvEeQOG465sCohbQIirSyqxrc=
github.com/multiformats/go-multiaddr v0.7.0/go.mod h1:Fs50eBDWvZu+l3/9S6xAE7ZYj6yhxlvaVZjakWN7xRs=
github.com/multiformats/go-multiaddr-dns v0.3.1 h1:QgQgR+LQVt3NPTjbrLLpsaT2ufAA2y0Mkk+QRVJbW3A=
github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E=
github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs=
github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPwIdYQD509ZjSb5y9Oc=
github.com/multiformats/go-multibase v0.1.1 h1:3ASCDsuLX8+j4kx58qnJ4YFq/JWTJpCyDW27ztsVTOI=
github.com/multiformats/go-multibase v0.1.1/go.mod h1:ZEjHE+IsUrgp5mhlEAYjMtZwK1k4haNkcaPg9aoe1a8=
github.com/multiformats/go-multicodec v0.6.0 h1:KhH2kSuCARyuJraYMFxrNO3DqIaYhOdS039kbhgVwpE=
github.com/multiformats/go-multicodec v0.6.0/go.mod h1:GUC8upxSBE4oG+q3kWZRw/+6yC1BqO550bjhWsJbZlw=
github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U=
github.com/multiformats/go-multihash v0.0.10/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew=
github.com/multiformats/go-multihash v0.0.13/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc=
github.com/multiformats/go-multihash v0.0.14/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc=
github.com/multiformats/go-multihash v0.0.15/go.mod h1:D6aZrWNLFTV/ynMpKsNtB40mJzmCl4jb1alC0OvHiHg=
github.com/multiformats/go-multihash v0.2.1 h1:aem8ZT0VA2nCHHk7bPJ1BjUbHNciqZC/d16Vve9l108=
github.com/multiformats/go-multihash v0.2.1/go.mod h1:WxoMcYG85AZVQUyRyo9s4wULvW5qrI9vb2Lt6evduFc=
github.com/multiformats/go-varint v0.0.6 h1:gk85QWKxh3TazbLxED/NlDVv8+q+ReFJk7Y2W/KhfNY=
github.com/multiformats/go-multistream v0.3.3 h1:d5PZpjwRgVlbwfdTDjife7XszfZd8KYWfROYFlGcR8o=
github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8=
github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5 h1:BvoENQQU+fZ9uukda/RzCAL/191HHwJA5b13R6diVlY=
github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
@ -269,6 +406,10 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o=
github.com/polydawn/refmt v0.0.0-20190807091052-3d65705ee9f1/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o=
github.com/polydawn/refmt v0.89.0 h1:ADJTApkvkeBZsN0tBTx8QjpD9JkmxbKp0cxfr9qszm4=
github.com/polydawn/refmt v0.89.0/go.mod h1:/zvteZs/GwLtCgZ4BL6CBsk9IKIlexP43ObX9AxTqTw=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
@ -295,10 +436,20 @@ github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1
github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo=
github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs=
github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa/go.mod h1:2RVY1rIf+2J2o/IM9+vPq9RzmHDSseB7FoXiSNIUsoU=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg=
github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM=
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU=
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
@ -320,10 +471,22 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
github.com/urfave/cli v1.22.10/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/warpfork/go-testmark v0.10.0 h1:E86YlUMYfwIacEsQGlnTvjk1IgYkyTGjPhF0RnwTCmw=
github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw=
github.com/warpfork/go-wish v0.0.0-20200122115046-b9ea61034e4a/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw=
github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0 h1:GDDkbFiaK8jsSDJfjId/PEGEShv6ugrt4kYsC5UIDaQ=
github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw=
github.com/whyrusleeping/cbor-gen v0.0.0-20200123233031-1cdf64d27158/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI=
github.com/whyrusleeping/cbor-gen v0.0.0-20221213004032-c09a31a7d5e8 h1:wGJHI5UqTlrtrgpA5kaQACNegkEHGhG/6Lmc7QORfqI=
github.com/whyrusleeping/cbor-gen v0.0.0-20221213004032-c09a31a7d5e8/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E=
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f/go.mod h1:p9UJB6dDgdPgMJZs7UjUOdulKyRr9fqkS+6JKAInPy8=
github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
@ -346,29 +509,37 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M=
go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0=
go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI=
go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0=
go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA=
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ=
go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA=
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8=
go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak=
go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=
go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ=
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ=
go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI=
go.uber.org/zap v1.23.0 h1:OjGQ5KQDEUawVHxNwQgPpiypGHOxo2mNZsOqTak4fFY=
go.uber.org/zap v1.23.0/go.mod h1:D+nX8jyLsMHMYrln8A0rJjFt/T/9/bGgIhAqxv5URuY=
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200204104054-c9f3fb736b72/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8=
golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@ -405,11 +576,13 @@ golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzB
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
@ -439,8 +612,7 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220920183852-bf014ff85ad5 h1:KafLifaRFIuSJ5C+7CyFJOF9haxKNC1CEIDk8GX6X0k=
golang.org/x/net v0.0.0-20220920183852-bf014ff85ad5/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/net v0.3.0 h1:VWL6FNY2bEEmsGVKabSlHu5Irp34xmMRoqb/9lF9lxk=
golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@ -460,11 +632,16 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190302025703-b6889370fb10/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@ -474,6 +651,7 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@ -495,6 +673,7 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@ -505,9 +684,10 @@ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20221010170243-090e33056c14 h1:k5II8e6QD8mITdi+okbbmR/cIyEbeXLBhy5Ha4nevyc=
golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@ -520,12 +700,14 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
@ -535,6 +717,8 @@ golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgw
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
@ -562,11 +746,15 @@ golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk=
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
@ -658,6 +846,7 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@ -1,7 +1,7 @@
package storage
import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treestorage"
)
type aclKeys struct {
@ -10,11 +10,11 @@ type aclKeys struct {
headKey []byte
}
func newACLKeys(spaceId string) aclKeys {
func newAclKeys(spaceId string) aclKeys {
return aclKeys{
spaceId: spaceId,
rootKey: storage.JoinStringsToBytes("space", spaceId, "a", "rootId"),
headKey: storage.JoinStringsToBytes("space", spaceId, "a", "headId"),
rootKey: treestorage.JoinStringsToBytes("space", spaceId, "a", "rootId"),
headKey: treestorage.JoinStringsToBytes("space", spaceId, "a", "headId"),
}
}
@ -27,7 +27,7 @@ func (a aclKeys) RootIdKey() []byte {
}
func (a aclKeys) RawRecordKey(id string) []byte {
return storage.JoinStringsToBytes("space", a.spaceId, "a", id)
return treestorage.JoinStringsToBytes("space", a.spaceId, "a", id)
}
type treeKeys struct {
@ -42,9 +42,9 @@ func newTreeKeys(spaceId, id string) treeKeys {
return treeKeys{
id: id,
spaceId: spaceId,
headsKey: storage.JoinStringsToBytes("space", spaceId, "t", id, "heads"),
rootKey: storage.JoinStringsToBytes("space", spaceId, "t", "rootId", id),
rawChangePrefix: storage.JoinStringsToBytes("space", spaceId, "t", id),
headsKey: treestorage.JoinStringsToBytes("space", spaceId, "t", id, "heads"),
rootKey: treestorage.JoinStringsToBytes("space", spaceId, "t", "rootId", id),
rawChangePrefix: treestorage.JoinStringsToBytes("space", spaceId, "t", id),
}
}
@ -57,7 +57,7 @@ func (t treeKeys) RootIdKey() []byte {
}
func (t treeKeys) RawChangeKey(id string) []byte {
return storage.JoinStringsToBytes("space", t.spaceId, "t", t.id, id)
return treestorage.JoinStringsToBytes("space", t.spaceId, "t", t.id, id)
}
func (t treeKeys) RawChangePrefix() []byte {
@ -74,9 +74,9 @@ type spaceKeys struct {
func newSpaceKeys(spaceId string) spaceKeys {
return spaceKeys{
spaceId: spaceId,
headerKey: storage.JoinStringsToBytes("space", "header", spaceId),
treePrefixKey: storage.JoinStringsToBytes("space", spaceId, "t", "rootId"),
spaceSettingsIdKey: storage.JoinStringsToBytes("space", spaceId, "spaceSettingsId"),
headerKey: treestorage.JoinStringsToBytes("space", "header", spaceId),
treePrefixKey: treestorage.JoinStringsToBytes("space", spaceId, "t", "rootId"),
spaceSettingsIdKey: treestorage.JoinStringsToBytes("space", spaceId, "spaceSettingsId"),
}
}
@ -93,7 +93,7 @@ func (s spaceKeys) SpaceSettingsId() []byte {
}
func (s spaceKeys) TreeDeletedKey(id string) []byte {
return storage.JoinStringsToBytes("space", s.spaceId, "deleted", id)
return treestorage.JoinStringsToBytes("space", s.spaceId, "deleted", id)
}
type storageServiceKeys struct {

View File

@ -3,8 +3,8 @@ package storage
import (
"context"
"errors"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/aclrecordproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/liststorage"
"github.com/dgraph-io/badger/v3"
)
@ -14,11 +14,11 @@ type listStorage struct {
db *badger.DB
keys aclKeys
id string
root *aclrecordproto.RawACLRecordWithId
root *aclrecordproto.RawAclRecordWithId
}
func newListStorage(spaceId string, db *badger.DB, txn *badger.Txn) (ls storage.ListStorage, err error) {
keys := newACLKeys(spaceId)
func newListStorage(spaceId string, db *badger.DB, txn *badger.Txn) (ls liststorage.ListStorage, err error) {
keys := newAclKeys(spaceId)
rootId, err := getTxn(txn, keys.RootIdKey())
if err != nil {
return
@ -30,7 +30,7 @@ func newListStorage(spaceId string, db *badger.DB, txn *badger.Txn) (ls storage.
return
}
rootWithId := &aclrecordproto.RawACLRecordWithId{
rootWithId := &aclrecordproto.RawAclRecordWithId{
Payload: value,
Id: stringId,
}
@ -44,8 +44,8 @@ func newListStorage(spaceId string, db *badger.DB, txn *badger.Txn) (ls storage.
return
}
func createListStorage(spaceId string, db *badger.DB, txn *badger.Txn, root *aclrecordproto.RawACLRecordWithId) (ls storage.ListStorage, err error) {
keys := newACLKeys(spaceId)
func createListStorage(spaceId string, db *badger.DB, txn *badger.Txn, root *aclrecordproto.RawAclRecordWithId) (ls liststorage.ListStorage, err error) {
keys := newAclKeys(spaceId)
_, err = getTxn(txn, keys.RootIdKey())
if err != badger.ErrKeyNotFound {
if err == nil {
@ -81,7 +81,7 @@ func (l *listStorage) Id() string {
return l.id
}
func (l *listStorage) Root() (*aclrecordproto.RawACLRecordWithId, error) {
func (l *listStorage) Root() (*aclrecordproto.RawAclRecordWithId, error) {
return l.root, nil
}
@ -94,16 +94,16 @@ func (l *listStorage) Head() (head string, err error) {
return
}
func (l *listStorage) GetRawRecord(ctx context.Context, id string) (raw *aclrecordproto.RawACLRecordWithId, err error) {
func (l *listStorage) GetRawRecord(ctx context.Context, id string) (raw *aclrecordproto.RawAclRecordWithId, err error) {
res, err := getDB(l.db, l.keys.RawRecordKey(id))
if err != nil {
if err == badger.ErrKeyNotFound {
err = storage.ErrUnknownRecord
err = liststorage.ErrUnknownRecord
}
return
}
raw = &aclrecordproto.RawACLRecordWithId{
raw = &aclrecordproto.RawAclRecordWithId{
Payload: res,
Id: id,
}
@ -114,6 +114,6 @@ func (l *listStorage) SetHead(headId string) (err error) {
return putDB(l.db, l.keys.HeadIdKey(), []byte(headId))
}
func (l *listStorage) AddRawRecord(ctx context.Context, rec *aclrecordproto.RawACLRecordWithId) error {
func (l *listStorage) AddRawRecord(ctx context.Context, rec *aclrecordproto.RawAclRecordWithId) error {
return putDB(l.db, l.keys.RawRecordKey(rec.Id), rec.Payload)
}

View File

@ -2,14 +2,14 @@ package storage
import (
"context"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/aclrecordproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/liststorage"
"github.com/dgraph-io/badger/v3"
"github.com/stretchr/testify/require"
"testing"
)
func testList(t *testing.T, store storage.ListStorage, root *aclrecordproto.RawACLRecordWithId, head string) {
func testList(t *testing.T, store liststorage.ListStorage, root *aclrecordproto.RawAclRecordWithId, head string) {
require.Equal(t, store.Id(), root.Id)
aclRoot, err := store.Root()
@ -26,7 +26,7 @@ func TestListStorage(t *testing.T) {
fx.open(t)
defer fx.stop(t)
spaceId := "spaceId"
aclRoot := &aclrecordproto.RawACLRecordWithId{Payload: []byte("root"), Id: "someRootId"}
aclRoot := &aclrecordproto.RawAclRecordWithId{Payload: []byte("root"), Id: "someRootId"}
fx.db.Update(func(txn *badger.Txn) error {
_, err := createListStorage(spaceId, fx.db, txn, aclRoot)
@ -34,7 +34,7 @@ func TestListStorage(t *testing.T) {
return nil
})
var listStore storage.ListStorage
var listStore liststorage.ListStorage
fx.db.View(func(txn *badger.Txn) (err error) {
listStore, err = newListStorage(spaceId, fx.db, txn)
require.NoError(t, err)
@ -63,7 +63,7 @@ func TestListStorage(t *testing.T) {
})
t.Run("add raw record and get raw record", func(t *testing.T) {
newRec := &aclrecordproto.RawACLRecordWithId{Payload: []byte("rec"), Id: "someRecId"}
newRec := &aclrecordproto.RawAclRecordWithId{Payload: []byte("rec"), Id: "someRecId"}
require.NoError(t, listStore.AddRawRecord(context.Background(), newRec))
aclRec, err := listStore.GetRawRecord(context.Background(), newRec.Id)
require.NoError(t, err)

View File

@ -1,10 +1,11 @@
package storage
import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/liststorage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treechangeproto"
storage "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treestorage"
spacestorage "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacestorage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto"
spacestorage "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/storage"
storage "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/treechangeproto"
"github.com/dgraph-io/badger/v3"
)
@ -13,7 +14,7 @@ type spaceStorage struct {
spaceSettingsId string
objDb *badger.DB
keys spaceKeys
aclStorage storage.ListStorage
aclStorage liststorage.ListStorage
header *spacesyncproto.RawSpaceHeaderWithId
}
@ -119,7 +120,7 @@ func (s *spaceStorage) CreateTreeStorage(payload storage.TreeStorageCreatePayloa
return createTreeStorage(s.objDb, s.spaceId, payload)
}
func (s *spaceStorage) ACLStorage() (storage.ListStorage, error) {
func (s *spaceStorage) AclStorage() (liststorage.ListStorage, error) {
return s.aclStorage, nil
}

View File

@ -1,10 +1,10 @@
package storage
import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treechangeproto"
spacestorage "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacestorage"
"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/pkg/acl/aclrecordproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/treechangeproto"
"github.com/stretchr/testify/require"
"sort"
"strconv"
@ -16,7 +16,7 @@ func spaceTestPayload() spacestorage.SpaceStorageCreatePayload {
RawHeader: []byte("header"),
Id: "headerId",
}
aclRoot := &aclrecordproto.RawACLRecordWithId{
aclRoot := &aclrecordproto.RawAclRecordWithId{
Payload: []byte("aclRoot"),
Id: "aclRootId",
}
@ -36,7 +36,7 @@ func testSpace(t *testing.T, store spacestorage.SpaceStorage, payload spacestora
require.NoError(t, err)
require.Equal(t, payload.SpaceHeaderWithId, header)
aclStorage, err := store.ACLStorage()
aclStorage, err := store.AclStorage()
require.NoError(t, err)
testList(t, aclStorage, payload.AclWithId, payload.AclWithId.Id)
}

View File

@ -4,7 +4,7 @@ import (
"context"
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/badgerprovider"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/storage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacestorage"
"github.com/dgraph-io/badger/v3"
)
@ -14,7 +14,7 @@ type storageService struct {
}
type ClientStorage interface {
storage.SpaceStorageProvider
spacestorage.SpaceStorageProvider
app.ComponentRunnable
AllSpaceIds() (ids []string, err error)
}
@ -31,14 +31,14 @@ func (s *storageService) Init(a *app.App) (err error) {
}
func (s *storageService) Name() (name string) {
return storage.CName
return spacestorage.CName
}
func (s *storageService) SpaceStorage(id string) (storage.SpaceStorage, error) {
func (s *storageService) SpaceStorage(id string) (spacestorage.SpaceStorage, error) {
return newSpaceStorage(s.db, id)
}
func (s *storageService) CreateSpaceStorage(payload storage.SpaceStorageCreatePayload) (storage.SpaceStorage, error) {
func (s *storageService) CreateSpaceStorage(payload spacestorage.SpaceStorageCreatePayload) (spacestorage.SpaceStorage, error) {
return createSpaceStorage(s.db, payload)
}

View File

@ -2,8 +2,8 @@ package storage
import (
"context"
"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/commonspace/object/tree/treechangeproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treestorage"
"github.com/dgraph-io/badger/v3"
)
@ -14,7 +14,7 @@ type treeStorage struct {
root *treechangeproto.RawTreeChangeWithId
}
func newTreeStorage(db *badger.DB, spaceId, treeId string) (ts storage.TreeStorage, err error) {
func newTreeStorage(db *badger.DB, spaceId, treeId string) (ts treestorage.TreeStorage, err error) {
keys := newTreeKeys(spaceId, treeId)
err = db.View(func(txn *badger.Txn) error {
_, err := txn.Get(keys.RootIdKey())
@ -41,19 +41,19 @@ func newTreeStorage(db *badger.DB, spaceId, treeId string) (ts storage.TreeStora
return nil
})
if err == badger.ErrKeyNotFound {
err = storage.ErrUnknownTreeId
err = treestorage.ErrUnknownTreeId
}
return
}
func createTreeStorage(db *badger.DB, spaceId string, payload storage.TreeStorageCreatePayload) (ts storage.TreeStorage, err error) {
func createTreeStorage(db *badger.DB, spaceId string, payload treestorage.TreeStorageCreatePayload) (ts treestorage.TreeStorage, err error) {
keys := newTreeKeys(spaceId, payload.RootRawChange.Id)
if hasDB(db, keys.RootIdKey()) {
err = storage.ErrTreeExists
err = treestorage.ErrTreeExists
return
}
err = db.Update(func(txn *badger.Txn) error {
heads := storage.CreateHeadsPayload(payload.Heads)
heads := treestorage.CreateHeadsPayload(payload.Heads)
for _, ch := range payload.Changes {
err = txn.Set(keys.RawChangeKey(ch.Id), ch.GetRawChange())
@ -100,16 +100,16 @@ func (t *treeStorage) Heads() (heads []string, err error) {
headsBytes, err := getDB(t.db, t.keys.HeadsKey())
if err != nil {
if err == badger.ErrKeyNotFound {
err = storage.ErrUnknownTreeId
err = treestorage.ErrUnknownTreeId
}
return
}
heads = storage.ParseHeads(headsBytes)
heads = treestorage.ParseHeads(headsBytes)
return
}
func (t *treeStorage) SetHeads(heads []string) (err error) {
payload := storage.CreateHeadsPayload(heads)
payload := treestorage.CreateHeadsPayload(heads)
return putDB(t.db, t.keys.HeadsKey(), payload)
}
@ -121,7 +121,7 @@ func (t *treeStorage) GetRawChange(ctx context.Context, id string) (raw *treecha
res, err := getDB(t.db, t.keys.RawChangeKey(id))
if err != nil {
if err == badger.ErrKeyNotFound {
err = storage.ErrUnknownTreeId
err = treestorage.ErrUnknownTreeId
}
return
}

View File

@ -2,19 +2,19 @@ package storage
import (
"context"
"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/commonspace/object/tree/treechangeproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treestorage"
"github.com/dgraph-io/badger/v3"
"github.com/stretchr/testify/require"
"os"
"testing"
)
func treeTestPayload() storage.TreeStorageCreatePayload {
func treeTestPayload() treestorage.TreeStorageCreatePayload {
rootRawChange := &treechangeproto.RawTreeChangeWithId{RawChange: []byte("some"), Id: "someRootId"}
otherChange := &treechangeproto.RawTreeChangeWithId{RawChange: []byte("some other"), Id: "otherId"}
changes := []*treechangeproto.RawTreeChangeWithId{rootRawChange, otherChange}
return storage.TreeStorageCreatePayload{
return treestorage.TreeStorageCreatePayload{
RootRawChange: rootRawChange,
Changes: changes,
Heads: []string{rootRawChange.Id},
@ -26,7 +26,7 @@ type fixture struct {
db *badger.DB
}
func testTreePayload(t *testing.T, store storage.TreeStorage, payload storage.TreeStorageCreatePayload) {
func testTreePayload(t *testing.T, store treestorage.TreeStorage, payload treestorage.TreeStorageCreatePayload) {
require.Equal(t, payload.RootRawChange.Id, store.Id())
root, err := store.Root()
@ -181,7 +181,7 @@ func TestTreeStorage_Delete(t *testing.T) {
require.NoError(t, err)
_, err = newTreeStorage(fx.db, spaceId, payload.RootRawChange.Id)
require.Equal(t, err, storage.ErrUnknownTreeId)
require.Equal(t, err, treestorage.ErrUnknownTreeId)
fx.testNoKeysExist(t, spaceId, payload.RootRawChange.Id)
})

View File

@ -5,20 +5,16 @@ proto:
@echo 'Generating protobuf packages (Go)...'
@$(eval GOGO_START := GOGO_NO_UNDERSCORE=1 GOGO_EXPORT_ONEOF_INTERFACE=1)
@$(eval P_ACL_RECORDS_PATH_PB := pkg/acl/aclrecordproto)
@$(eval P_TREE_CHANGES_PATH_PB := pkg/acl/treechangeproto)
@$(eval P_SYNC_CHANGES_PATH_PB := syncproto)
@$(eval P_TEST_CHANGES_PATH_PB := pkg/acl/testutils/testchanges)
@$(eval P_ACL_RECORDS_PATH_PB := commonspace/object/acl/aclrecordproto)
@$(eval P_TREE_CHANGES_PATH_PB := commonspace/object/tree/treechangeproto)
@$(eval P_ACL_RECORDS := M$(P_ACL_RECORDS_PATH_PB)/protos/aclrecord.proto=github.com/anytypeio/go-anytype-infrastructure-experiments/common/$(P_ACL_RECORDS_PATH_PB))
@$(eval P_TREE_CHANGES := M$(P_TREE_CHANGES_PATH_PB)/protos/treechange.proto=github.com/anytypeio/go-anytype-infrastructure-experiments/common/$(P_TREE_CHANGES_PATH_PB))
$(GOGO_START) protoc --gogofaster_out=:. $(P_ACL_RECORDS_PATH_PB)/protos/*.proto
$(GOGO_START) protoc --gogofaster_out=:. $(P_TREE_CHANGES_PATH_PB)/protos/*.proto
$(GOGO_START) protoc --gogofaster_out=:. $(P_TEST_CHANGES_PATH_PB)/proto/*.proto
$(eval PKGMAP := $$(P_TREE_CHANGES),$$(P_ACL_RECORDS))
$(GOGO_START) protoc --gogofaster_out=$(PKGMAP):. --go-drpc_out=protolib=github.com/gogo/protobuf:. commonspace/spacesyncproto/protos/*.proto
$(GOGO_START) protoc --gogofaster_out=$(PKGMAP):. --go-drpc_out=protolib=github.com/gogo/protobuf:. commonfile/fileproto/protos/*.proto
test:
go test ./... --cover

View File

@ -1,19 +0,0 @@
//go:generate mockgen -destination mock_account/mock_account.go github.com/anytypeio/go-anytype-infrastructure-experiments/common/account Service
package account
import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/config"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/account"
)
const CName = "common.account"
type Service interface {
app.Component
Account() *account.AccountData
}
type ConfigGetter interface {
GetAccount() config.Account
}

View File

@ -0,0 +1,25 @@
//go:generate mockgen -destination mock_accountservice/mock_accountservice.go github.com/anytypeio/go-anytype-infrastructure-experiments/common/accountservice Service
package accountservice
import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/accountdata"
)
const CName = "common.accountservice"
type Service interface {
app.Component
Account() *accountdata.AccountData
}
type Config struct {
PeerId string `yaml:"peerId"`
PeerKey string `yaml:"peerKey"`
SigningKey string `yaml:"signingKey"`
EncryptionKey string `yaml:"encryptionKey"`
}
type ConfigGetter interface {
GetAccount() Config
}

View File

@ -0,0 +1,15 @@
package mock_accountservice
import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/accountservice"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/accountdata"
"github.com/golang/mock/gomock"
)
func NewAccountServiceWithAccount(ctrl *gomock.Controller, acc *accountdata.AccountData) *MockService {
mock := NewMockService(ctrl)
mock.EXPECT().Name().Return(accountservice.CName).AnyTimes()
mock.EXPECT().Init(gomock.Any()).AnyTimes()
mock.EXPECT().Account().Return(acc).AnyTimes()
return mock
}

View File

@ -1,14 +1,14 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/anytypeio/go-anytype-infrastructure-experiments/common/account (interfaces: Service)
// Source: github.com/anytypeio/go-anytype-infrastructure-experiments/common/accountservice (interfaces: Service)
// Package mock_account is a generated GoMock package.
package mock_account
// Package mock_accountservice is a generated GoMock package.
package mock_accountservice
import (
reflect "reflect"
app "github.com/anytypeio/go-anytype-infrastructure-experiments/common/app"
account "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/account"
accountdata "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/accountdata"
gomock "github.com/golang/mock/gomock"
)
@ -36,10 +36,10 @@ func (m *MockService) EXPECT() *MockServiceMockRecorder {
}
// Account mocks base method.
func (m *MockService) Account() *account.AccountData {
func (m *MockService) Account() *accountdata.AccountData {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Account")
ret0, _ := ret[0].(*account.AccountData)
ret0, _ := ret[0].(*accountdata.AccountData)
return ret0
}

View File

@ -1,7 +1,7 @@
// 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.
//
//go:generate mockgen -destination mock_ldiff/mock_ldiff.go github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/ldiff Diff,Remote
//go:generate mockgen -destination mock_ldiff/mock_ldiff.go github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/ldiff Diff,Remote
package ldiff
import (

View File

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/ldiff (interfaces: Diff,Remote)
// Source: github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/ldiff (interfaces: Diff,Remote)
// Package mock_ldiff is a generated GoMock package.
package mock_ldiff
@ -8,7 +8,7 @@ import (
context "context"
reflect "reflect"
ldiff "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/ldiff"
ldiff "github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/ldiff"
gomock "github.com/golang/mock/gomock"
)

View File

@ -1,17 +1,14 @@
package config
package logger
import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/logger"
"go.uber.org/zap"
)
import "go.uber.org/zap"
type Log struct {
type Config struct {
Production bool `yaml:"production"`
DefaultLevel string `yaml:"defaultLevel"`
NamedLevels map[string]string `yaml:"namedLevels"`
}
func (l Log) ApplyGlobal() {
func (l Config) ApplyGlobal() {
var conf zap.Config
if l.Production {
conf = zap.NewProductionConfig()
@ -29,8 +26,8 @@ func (l Log) ApplyGlobal() {
}
defaultLogger, err := conf.Build()
if err != nil {
logger.Default().Fatal("can't build logger", zap.Error(err))
Default().Fatal("can't build logger", zap.Error(err))
}
logger.SetDefault(defaultLogger)
logger.SetNamedLevels(levels)
SetDefault(defaultLogger)
SetNamedLevels(levels)
}

View File

@ -8,7 +8,7 @@ import (
"github.com/ipfs/go-cid"
)
var log = logger.NewNamed("filenode.fileblockstore")
var log = logger.NewNamed(CName)
var (
ErrCIDNotFound = fileprotoerr.ErrCIDNotFound

View File

@ -2,20 +2,20 @@ 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"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/syncacl"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/syncobjectgetter"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/treegetter"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/settings"
)
type commonSpaceGetter struct {
spaceId string
aclList *syncacl.SyncACL
aclList *syncacl.SyncAcl
treeGetter treegetter.TreeGetter
settings settingsdocument.SettingsDocument
settings settings.SettingsObject
}
func newCommonSpaceGetter(spaceId string, aclList *syncacl.SyncACL, treeGetter treegetter.TreeGetter, settings settingsdocument.SettingsDocument) objectgetter.ObjectGetter {
func newCommonSpaceGetter(spaceId string, aclList *syncacl.SyncAcl, treeGetter treegetter.TreeGetter, settings settings.SettingsObject) syncobjectgetter.SyncObjectGetter {
return &commonSpaceGetter{
spaceId: spaceId,
aclList: aclList,
@ -24,19 +24,19 @@ func newCommonSpaceGetter(spaceId string, aclList *syncacl.SyncACL, treeGetter t
}
}
func (c *commonSpaceGetter) GetObject(ctx context.Context, objectId string) (obj objectgetter.Object, err error) {
if c.aclList.ID() == objectId {
func (c *commonSpaceGetter) GetObject(ctx context.Context, objectId string) (obj syncobjectgetter.SyncObject, err error) {
if c.aclList.Id() == objectId {
obj = c.aclList
return
}
if c.settings.ID() == objectId {
obj = c.settings.(objectgetter.Object)
if c.settings.Id() == objectId {
obj = c.settings.(syncobjectgetter.SyncObject)
return
}
t, err := c.treeGetter.GetTree(ctx, c.spaceId, objectId)
if err != nil {
return
}
obj = t.(objectgetter.Object)
obj = t.(syncobjectgetter.SyncObject)
return
}

View File

@ -1,15 +1,15 @@
package commonspace
import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/storage"
treestorage "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treestorage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacestorage"
)
type commonStorage struct {
storage.SpaceStorage
spacestorage.SpaceStorage
}
func newCommonStorage(spaceStorage storage.SpaceStorage) storage.SpaceStorage {
func newCommonStorage(spaceStorage spacestorage.SpaceStorage) spacestorage.SpaceStorage {
return &commonStorage{
SpaceStorage: spaceStorage,
}
@ -23,6 +23,6 @@ func (c *commonStorage) CreateTreeStorage(payload treestorage.TreeStorageCreateP
if status == "" {
return c.SpaceStorage.CreateTreeStorage(payload)
}
err = storage.ErrTreeStorageAlreadyDeleted
err = spacestorage.ErrTreeStorageAlreadyDeleted
return
}

View File

@ -1,29 +1,30 @@
package nodeconf
package confconnector
import (
"context"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/peer"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/pool"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/nodeconf"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/slice"
)
type ConfConnector interface {
Configuration() Configuration
Configuration() nodeconf.Configuration
Pool() pool.Pool
GetResponsiblePeers(ctx context.Context, spaceId string) ([]peer.Peer, error)
DialInactiveResponsiblePeers(ctx context.Context, spaceId string, activeNodeIds []string) ([]peer.Peer, error)
}
type confConnector struct {
conf Configuration
conf nodeconf.Configuration
pool pool.Pool
}
func NewConfConnector(conf Configuration, pool pool.Pool) ConfConnector {
func NewConfConnector(conf nodeconf.Configuration, pool pool.Pool) ConfConnector {
return &confConnector{conf: conf, pool: pool}
}
func (s *confConnector) Configuration() Configuration {
func (s *confConnector) Configuration() nodeconf.Configuration {
// TODO: think about rewriting this, because these deps should not be exposed
return s.conf
}

View File

@ -0,0 +1,10 @@
package commonspace
type ConfigGetter interface {
GetSpace() Config
}
type Config struct {
GCTTL int `yaml:"gcTTL"`
SyncPeriod int `yaml:"syncPeriod"`
}

View File

@ -1,18 +1,17 @@
package diffservice
package headsync
import (
"context"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/remotediff"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/settingsdocument/deletionstate"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/ldiff"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/confconnector"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/synctree"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/treegetter"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/settings/deletionstate"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacestorage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/statusservice"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/storage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/synctree"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/treegetter"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/syncstatus"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/peer"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/rpc/rpcerr"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/nodeconf"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/ldiff"
"go.uber.org/zap"
"time"
)
@ -27,11 +26,11 @@ type DiffSyncer interface {
func newDiffSyncer(
spaceId string,
diff ldiff.Diff,
confConnector nodeconf.ConfConnector,
confConnector confconnector.ConfConnector,
cache treegetter.TreeGetter,
storage storage.SpaceStorage,
storage spacestorage.SpaceStorage,
clientFactory spacesyncproto.ClientFactory,
statusService statusservice.StatusService,
syncStatus syncstatus.StatusUpdater,
log *zap.Logger) DiffSyncer {
return &diffSyncer{
diff: diff,
@ -41,20 +40,20 @@ func newDiffSyncer(
confConnector: confConnector,
clientFactory: clientFactory,
log: log,
statusService: statusService,
syncStatus: syncStatus,
}
}
type diffSyncer struct {
spaceId string
diff ldiff.Diff
confConnector nodeconf.ConfConnector
confConnector confconnector.ConfConnector
cache treegetter.TreeGetter
storage storage.SpaceStorage
storage spacestorage.SpaceStorage
clientFactory spacesyncproto.ClientFactory
log *zap.Logger
deletionState deletionstate.DeletionState
statusService statusservice.StatusService
syncStatus syncstatus.StatusUpdater
}
func (d *diffSyncer) Init(deletionState deletionstate.DeletionState) {
@ -97,25 +96,27 @@ func (d *diffSyncer) Sync(ctx context.Context) error {
func (d *diffSyncer) syncWithPeer(ctx context.Context, p peer.Peer) (err error) {
var (
cl = d.clientFactory.Client(p)
rdiff = remotediff.NewRemoteDiff(d.spaceId, cl)
stateCounter uint64 = 0
rdiff = NewRemoteDiff(d.spaceId, cl)
stateCounter = d.syncStatus.StateCounter()
)
stateCounter = d.statusService.StateCounter()
newIds, changedIds, removedIds, err := d.diff.Diff(ctx, rdiff)
err = rpcerr.Unwrap(err)
if err != nil && err != spacesyncproto.ErrSpaceMissing {
d.statusService.SetNodesOnline(p.Id(), false)
d.syncStatus.SetNodesOnline(p.Id(), false)
return err
}
d.statusService.SetNodesOnline(p.Id(), true)
d.syncStatus.SetNodesOnline(p.Id(), true)
if err == spacesyncproto.ErrSpaceMissing {
return d.sendPushSpaceRequest(ctx, cl)
}
totalLen := len(newIds) + len(changedIds) + len(removedIds)
// not syncing ids which were removed through settings document
filteredIds := d.deletionState.FilterJoin(newIds, changedIds, removedIds)
d.statusService.RemoveAllExcept(p.Id(), filteredIds, stateCounter)
d.syncStatus.RemoveAllExcept(p.Id(), filteredIds, stateCounter)
ctx = peer.CtxWithPeerId(ctx, p.Id())
d.pingTreesInCache(ctx, filteredIds)
@ -145,8 +146,8 @@ func (d *diffSyncer) pingTreesInCache(ctx context.Context, trees []string) {
}
}
func (d *diffSyncer) sendPushSpaceRequest(ctx context.Context, cl spacesyncproto.DRPCSpaceClient) (err error) {
aclStorage, err := d.storage.ACLStorage()
func (d *diffSyncer) sendPushSpaceRequest(ctx context.Context, cl spacesyncproto.DRPCSpaceSyncClient) (err error) {
aclStorage, err := d.storage.AclStorage()
if err != nil {
return
}
@ -177,7 +178,7 @@ func (d *diffSyncer) sendPushSpaceRequest(ctx context.Context, cl spacesyncproto
SpaceSettingsPayload: spaceSettingsRoot.RawChange,
SpaceSettingsPayloadId: spaceSettingsRoot.Id,
}
_, err = cl.PushSpace(ctx, &spacesyncproto.PushSpaceRequest{
_, err = cl.SpacePush(ctx, &spacesyncproto.SpacePushRequest{
Payload: spacePayload,
})
return

View File

@ -1,24 +1,22 @@
package diffservice
package headsync
import (
"context"
"fmt"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/ldiff"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/ldiff/mock_ldiff"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/logger"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/remotediff"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/settingsdocument/deletionstate/mock_deletionstate"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treechangeproto"
mock_treestorage "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treestorage/mock_treestorage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/treegetter/mock_treegetter"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/settings/deletionstate/mock_deletionstate"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacestorage/mock_spacestorage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto/mock_spacesyncproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/statusservice"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/storage/mock_storage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/treegetter/mock_treegetter"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/syncstatus"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/peer"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/nodeconf/mock_nodeconf"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/aclrecordproto"
mock_aclstorage "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage/mock_storage"
mock_treestorage "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage/mock_storage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/treechangeproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/ldiff"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/ldiff/mock_ldiff"
"github.com/golang/mock/gomock"
"github.com/libp2p/go-libp2p/core/sec"
"github.com/stretchr/testify/require"
@ -35,7 +33,7 @@ type pushSpaceRequestMatcher struct {
}
func (p pushSpaceRequestMatcher) Matches(x interface{}) bool {
res, ok := x.(*spacesyncproto.PushSpaceRequest)
res, ok := x.(*spacesyncproto.SpacePushRequest)
if !ok {
return false
}
@ -102,16 +100,16 @@ func TestDiffSyncer_Sync(t *testing.T) {
diffMock := mock_ldiff.NewMockDiff(ctrl)
connectorMock := mock_nodeconf.NewMockConfConnector(ctrl)
cacheMock := mock_treegetter.NewMockTreeGetter(ctrl)
stMock := mock_storage.NewMockSpaceStorage(ctrl)
clientMock := mock_spacesyncproto.NewMockDRPCSpaceClient(ctrl)
factory := spacesyncproto.ClientFactoryFunc(func(cc drpc.Conn) spacesyncproto.DRPCSpaceClient {
stMock := mock_spacestorage.NewMockSpaceStorage(ctrl)
clientMock := mock_spacesyncproto.NewMockDRPCSpaceSyncClient(ctrl)
factory := spacesyncproto.ClientFactoryFunc(func(cc drpc.Conn) spacesyncproto.DRPCSpaceSyncClient {
return clientMock
})
delState := mock_deletionstate.NewMockDeletionState(ctrl)
spaceId := "spaceId"
aclRootId := "aclRootId"
l := logger.NewNamed(spaceId)
diffSyncer := newDiffSyncer(spaceId, diffMock, connectorMock, cacheMock, stMock, factory, statusservice.NewNoOpStatusService(), l)
diffSyncer := newDiffSyncer(spaceId, diffMock, connectorMock, cacheMock, stMock, factory, syncstatus.NewNoOpSyncStatus(), l)
delState.EXPECT().AddObserver(gomock.Any())
diffSyncer.Init(delState)
@ -120,7 +118,7 @@ func TestDiffSyncer_Sync(t *testing.T) {
GetResponsiblePeers(gomock.Any(), spaceId).
Return([]peer.Peer{mockPeer{}}, nil)
diffMock.EXPECT().
Diff(gomock.Any(), gomock.Eq(remotediff.NewRemoteDiff(spaceId, clientMock))).
Diff(gomock.Any(), gomock.Eq(NewRemoteDiff(spaceId, clientMock))).
Return([]string{"new"}, []string{"changed"}, nil, nil)
delState.EXPECT().FilterJoin(gomock.Any()).Return([]string{"new", "changed"})
for _, arg := range []string{"new", "changed"} {
@ -159,10 +157,10 @@ func TestDiffSyncer_Sync(t *testing.T) {
})
t.Run("diff syncer sync space missing", func(t *testing.T) {
aclStorageMock := mock_aclstorage.NewMockListStorage(ctrl)
aclStorageMock := mock_treestorage.NewMockListStorage(ctrl)
settingsStorage := mock_treestorage.NewMockTreeStorage(ctrl)
settingsId := "settingsId"
aclRoot := &aclrecordproto.RawACLRecordWithId{
aclRoot := &aclrecordproto.RawAclRecordWithId{
Id: aclRootId,
}
settingsRoot := &treechangeproto.RawTreeChangeWithId{
@ -175,10 +173,10 @@ func TestDiffSyncer_Sync(t *testing.T) {
GetResponsiblePeers(gomock.Any(), spaceId).
Return([]peer.Peer{mockPeer{}}, nil)
diffMock.EXPECT().
Diff(gomock.Any(), gomock.Eq(remotediff.NewRemoteDiff(spaceId, clientMock))).
Diff(gomock.Any(), gomock.Eq(NewRemoteDiff(spaceId, clientMock))).
Return(nil, nil, nil, spacesyncproto.ErrSpaceMissing)
stMock.EXPECT().ACLStorage().Return(aclStorageMock, nil)
stMock.EXPECT().AclStorage().Return(aclStorageMock, nil)
stMock.EXPECT().SpaceHeader().Return(spaceHeader, nil)
stMock.EXPECT().SpaceSettingsId().Return(spaceSettingsId)
stMock.EXPECT().TreeStorage(spaceSettingsId).Return(settingsStorage, nil)
@ -188,7 +186,7 @@ func TestDiffSyncer_Sync(t *testing.T) {
Root().
Return(aclRoot, nil)
clientMock.EXPECT().
PushSpace(gomock.Any(), newPushSpaceRequestMatcher(spaceId, aclRootId, settingsId, spaceHeader)).
SpacePush(gomock.Any(), newPushSpaceRequestMatcher(spaceId, aclRootId, settingsId, spaceHeader)).
Return(nil, nil)
require.NoError(t, diffSyncer.Sync(ctx))
@ -199,7 +197,7 @@ func TestDiffSyncer_Sync(t *testing.T) {
GetResponsiblePeers(gomock.Any(), spaceId).
Return([]peer.Peer{mockPeer{}}, nil)
diffMock.EXPECT().
Diff(gomock.Any(), gomock.Eq(remotediff.NewRemoteDiff(spaceId, clientMock))).
Diff(gomock.Any(), gomock.Eq(NewRemoteDiff(spaceId, clientMock))).
Return(nil, nil, nil, spacesyncproto.ErrUnexpected)
require.NoError(t, diffSyncer.Sync(ctx))

View File

@ -1,16 +1,15 @@
//go:generate mockgen -destination mock_diffservice/mock_diffservice.go github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/diffservice DiffSyncer
package diffservice
//go:generate mockgen -destination mock_headsync/mock_headsync.go github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/headsync DiffSyncer
package headsync
import (
"context"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/remotediff"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/settingsdocument/deletionstate"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/ldiff"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/confconnector"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/treegetter"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/settings/deletionstate"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacestorage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/statusservice"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/storage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/treegetter"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/nodeconf"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/ldiff"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/syncstatus"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/periodicsync"
"go.uber.org/zap"
"strings"
@ -22,7 +21,7 @@ type TreeHeads struct {
Heads []string
}
type DiffService interface {
type HeadSync interface {
UpdateHeads(id string, heads []string)
HandleRangeRequest(ctx context.Context, req *spacesyncproto.HeadSyncRequest) (resp *spacesyncproto.HeadSyncResponse, err error)
RemoveObjects(ids []string)
@ -33,10 +32,10 @@ type DiffService interface {
Close() (err error)
}
type diffService struct {
type headSync struct {
spaceId string
periodicSync periodicsync.PeriodicSync
storage storage.SpaceStorage
storage spacestorage.SpaceStorage
diff ldiff.Diff
log *zap.Logger
syncer DiffSyncer
@ -44,22 +43,22 @@ type diffService struct {
syncPeriod int
}
func NewDiffService(
func NewHeadSync(
spaceId string,
syncPeriod int,
storage storage.SpaceStorage,
confConnector nodeconf.ConfConnector,
storage spacestorage.SpaceStorage,
confConnector confconnector.ConfConnector,
cache treegetter.TreeGetter,
statusService statusservice.StatusService,
log *zap.Logger) DiffService {
syncStatus syncstatus.StatusUpdater,
log *zap.Logger) HeadSync {
diff := ldiff.New(16, 16)
l := log.With(zap.String("spaceId", spaceId))
factory := spacesyncproto.ClientFactoryFunc(spacesyncproto.NewDRPCSpaceClient)
syncer := newDiffSyncer(spaceId, diff, confConnector, cache, storage, factory, statusService, l)
factory := spacesyncproto.ClientFactoryFunc(spacesyncproto.NewDRPCSpaceSyncClient)
syncer := newDiffSyncer(spaceId, diff, confConnector, cache, storage, factory, syncStatus, l)
periodicSync := periodicsync.NewPeriodicSync(syncPeriod, time.Minute, syncer.Sync, l)
return &diffService{
return &headSync{
spaceId: spaceId,
storage: storage,
syncer: syncer,
@ -70,25 +69,25 @@ func NewDiffService(
}
}
func (d *diffService) Init(objectIds []string, deletionState deletionstate.DeletionState) {
func (d *headSync) Init(objectIds []string, deletionState deletionstate.DeletionState) {
d.fillDiff(objectIds)
d.syncer.Init(deletionState)
d.periodicSync.Run()
}
func (d *diffService) HandleRangeRequest(ctx context.Context, req *spacesyncproto.HeadSyncRequest) (resp *spacesyncproto.HeadSyncResponse, err error) {
return remotediff.HandleRangeRequest(ctx, d.diff, req)
func (d *headSync) HandleRangeRequest(ctx context.Context, req *spacesyncproto.HeadSyncRequest) (resp *spacesyncproto.HeadSyncResponse, err error) {
return HandleRangeRequest(ctx, d.diff, req)
}
func (d *diffService) UpdateHeads(id string, heads []string) {
func (d *headSync) UpdateHeads(id string, heads []string) {
d.syncer.UpdateHeads(id, heads)
}
func (d *diffService) AllIds() []string {
func (d *headSync) AllIds() []string {
return d.diff.Ids()
}
func (d *diffService) DebugAllHeads() (res []TreeHeads) {
func (d *headSync) DebugAllHeads() (res []TreeHeads) {
els := d.diff.Elements()
for _, el := range els {
idHead := TreeHeads{
@ -100,16 +99,16 @@ func (d *diffService) DebugAllHeads() (res []TreeHeads) {
return
}
func (d *diffService) RemoveObjects(ids []string) {
func (d *headSync) RemoveObjects(ids []string) {
d.syncer.RemoveObjects(ids)
}
func (d *diffService) Close() (err error) {
func (d *headSync) Close() (err error) {
d.periodicSync.Close()
return nil
}
func (d *diffService) fillDiff(objectIds []string) {
func (d *headSync) fillDiff(objectIds []string) {
var els = make([]ldiff.Element, 0, len(objectIds))
for _, id := range objectIds {
st, err := d.storage.TreeStorage(id)

View File

@ -1,13 +1,13 @@
package diffservice
package headsync
import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/ldiff"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/ldiff/mock_ldiff"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/logger"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/diffservice/mock_diffservice"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/settingsdocument/deletionstate/mock_deletionstate"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/storage/mock_storage"
mock_storage2 "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage/mock_storage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/ldiff"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/ldiff/mock_ldiff"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/headsync/mock_headsync"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treestorage/mock_treestorage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/settings/deletionstate/mock_deletionstate"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacestorage/mock_spacestorage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/periodicsync/mock_periodicsync"
"github.com/golang/mock/gomock"
"testing"
@ -20,15 +20,15 @@ func TestDiffService(t *testing.T) {
spaceId := "spaceId"
l := logger.NewNamed("sync")
pSyncMock := mock_periodicsync.NewMockPeriodicSync(ctrl)
storageMock := mock_storage.NewMockSpaceStorage(ctrl)
treeStorageMock := mock_storage2.NewMockTreeStorage(ctrl)
storageMock := mock_spacestorage.NewMockSpaceStorage(ctrl)
treeStorageMock := mock_treestorage.NewMockTreeStorage(ctrl)
diffMock := mock_ldiff.NewMockDiff(ctrl)
syncer := mock_diffservice.NewMockDiffSyncer(ctrl)
syncer := mock_headsync.NewMockDiffSyncer(ctrl)
delState := mock_deletionstate.NewMockDeletionState(ctrl)
syncPeriod := 1
initId := "initId"
service := &diffService{
service := &headSync{
spaceId: spaceId,
storage: storageMock,
periodicSync: pSyncMock,

View File

@ -1,14 +1,14 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/diffservice (interfaces: DiffSyncer)
// Source: github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/headsync (interfaces: DiffSyncer)
// Package mock_diffservice is a generated GoMock package.
package mock_diffservice
// Package mock_headsync is a generated GoMock package.
package mock_headsync
import (
context "context"
reflect "reflect"
deletionstate "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/settingsdocument/deletionstate"
deletionstate "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/settings/deletionstate"
gomock "github.com/golang/mock/gomock"
)

View File

@ -1,9 +1,9 @@
package remotediff
package headsync
import (
"context"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/ldiff"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/ldiff"
)
type Client interface {

View File

@ -1,10 +1,10 @@
package remotediff
package headsync
import (
"context"
"fmt"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/ldiff"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/ldiff"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"testing"

View File

@ -1,4 +1,4 @@
package account
package accountdata
import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/encryptionkey"
@ -10,4 +10,5 @@ type AccountData struct { // TODO: create a convenient constructor for this
PeerKey signingkey.PrivKey
SignKey signingkey.PrivKey
EncKey encryptionkey.PrivKey
PeerId string
}

View File

@ -4,7 +4,7 @@ import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/symmetric"
)
func ACLReadKeyDerive(signKey []byte, encKey []byte) (*symmetric.Key, error) {
func AclReadKeyDerive(signKey []byte, encKey []byte) (*symmetric.Key, error) {
concBuf := make([]byte, 0, len(signKey)+len(encKey))
concBuf = append(concBuf, signKey...)
concBuf = append(concBuf, encKey...)

View File

@ -1,20 +1,20 @@
syntax = "proto3";
package aclrecord;
option go_package = "pkg/acl/aclrecordproto";
option go_package = "commonspace/object/acl/aclrecordproto";
message RawACLRecord {
message RawAclRecord {
bytes payload = 1;
bytes signature = 2;
bytes acceptorIdentity = 3;
bytes acceptorSignature = 4;
}
message RawACLRecordWithId {
message RawAclRecordWithId {
bytes payload = 1;
string id = 2;
}
message ACLRecord {
message AclRecord {
string prevId = 1;
bytes identity = 2;
bytes data = 3;
@ -22,7 +22,7 @@ message ACLRecord {
int64 timestamp = 5;
}
message ACLRoot {
message AclRoot {
bytes identity = 1;
bytes encryptionKey = 2;
string spaceId = 3;
@ -32,47 +32,47 @@ message ACLRoot {
int64 timestamp = 7;
}
message ACLContentValue {
message AclContentValue {
oneof value {
ACLUserAdd userAdd = 1;
ACLUserRemove userRemove = 2;
ACLUserPermissionChange userPermissionChange = 3;
ACLUserInvite userInvite = 4;
ACLUserJoin userJoin = 5;
AclUserAdd userAdd = 1;
AclUserRemove userRemove = 2;
AclUserPermissionChange userPermissionChange = 3;
AclUserInvite userInvite = 4;
AclUserJoin userJoin = 5;
}
}
message ACLData {
repeated ACLContentValue aclContent = 1;
message AclData {
repeated AclContentValue aclContent = 1;
}
message ACLState {
message AclState {
repeated uint64 readKeyHashes = 1;
repeated ACLUserState userStates = 2;
map<string, ACLUserInvite> invites = 3;
repeated AclUserState userStates = 2;
map<string, AclUserInvite> invites = 3;
}
message ACLUserState {
message AclUserState {
bytes identity = 1;
bytes encryptionKey = 2;
ACLUserPermissions permissions = 3;
AclUserPermissions permissions = 3;
}
message ACLUserAdd {
message AclUserAdd {
bytes identity = 1;
bytes encryptionKey = 2;
repeated bytes encryptedReadKeys = 3;
ACLUserPermissions permissions = 4;
AclUserPermissions permissions = 4;
}
message ACLUserInvite {
message AclUserInvite {
bytes acceptPublicKey = 1;
uint64 encryptSymKeyHash = 2;
repeated bytes encryptedReadKeys = 3;
ACLUserPermissions permissions = 4;
AclUserPermissions permissions = 4;
}
message ACLUserJoin {
message AclUserJoin {
bytes identity = 1;
bytes encryptionKey = 2;
bytes acceptSignature = 3;
@ -80,39 +80,39 @@ message ACLUserJoin {
repeated bytes encryptedReadKeys = 5;
}
message ACLUserRemove {
message AclUserRemove {
bytes identity = 1;
repeated ACLReadKeyReplace readKeyReplaces = 2;
repeated AclReadKeyReplace readKeyReplaces = 2;
}
message ACLReadKeyReplace {
message AclReadKeyReplace {
bytes identity = 1;
bytes encryptionKey = 2;
bytes encryptedReadKey = 3;
}
message ACLUserPermissionChange {
message AclUserPermissionChange {
bytes identity = 1;
ACLUserPermissions permissions = 2;
AclUserPermissions permissions = 2;
}
enum ACLUserPermissions {
enum AclUserPermissions {
Admin = 0;
Writer = 1;
Reader = 2;
}
message ACLSyncMessage {
ACLSyncContentValue content = 2;
message AclSyncMessage {
AclSyncContentValue content = 2;
}
// ACLSyncContentValue provides different types for acl sync
message ACLSyncContentValue {
// AclSyncContentValue provides different types for acl sync
message AclSyncContentValue {
oneof value {
ACLAddRecords addRecords = 1;
AclAddRecords addRecords = 1;
}
}
message ACLAddRecords {
repeated RawACLRecordWithId records = 1;
message AclAddRecords {
repeated RawAclRecordWithId records = 1;
}

View File

@ -1,9 +1,9 @@
package list
import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/aclrecordproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/common"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/cid"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/keychain"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/cidutil"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/signingkey"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/symmetric"
"github.com/gogo/protobuf/proto"
@ -11,24 +11,24 @@ import (
)
// remove interface
type ACLRecordBuilder interface {
ConvertFromRaw(rawIdRecord *aclrecordproto.RawACLRecordWithId) (rec *ACLRecord, err error)
BuildUserJoin(acceptPrivKeyBytes []byte, encSymKeyBytes []byte, state *ACLState) (rec *aclrecordproto.RawACLRecord, err error)
type AclRecordBuilder interface {
ConvertFromRaw(rawIdRecord *aclrecordproto.RawAclRecordWithId) (rec *AclRecord, err error)
BuildUserJoin(acceptPrivKeyBytes []byte, encSymKeyBytes []byte, state *AclState) (rec *aclrecordproto.RawAclRecord, err error)
}
type aclRecordBuilder struct {
id string
keychain *common.Keychain
keychain *keychain.Keychain
}
func newACLRecordBuilder(id string, keychain *common.Keychain) ACLRecordBuilder {
func newAclRecordBuilder(id string, keychain *keychain.Keychain) AclRecordBuilder {
return &aclRecordBuilder{
id: id,
keychain: keychain,
}
}
func (a *aclRecordBuilder) BuildUserJoin(acceptPrivKeyBytes []byte, encSymKeyBytes []byte, state *ACLState) (rec *aclrecordproto.RawACLRecord, err error) {
func (a *aclRecordBuilder) BuildUserJoin(acceptPrivKeyBytes []byte, encSymKeyBytes []byte, state *AclState) (rec *aclrecordproto.RawAclRecord, err error) {
acceptPrivKey, err := signingkey.NewSigningEd25519PrivKeyFromBytes(acceptPrivKeyBytes)
if err != nil {
return
@ -69,21 +69,21 @@ func (a *aclRecordBuilder) BuildUserJoin(acceptPrivKeyBytes []byte, encSymKeyByt
return
}
userJoin := &aclrecordproto.ACLUserJoin{
userJoin := &aclrecordproto.AclUserJoin{
Identity: state.Identity(),
EncryptionKey: encPubKeyBytes,
AcceptSignature: idSignature,
AcceptPubKey: acceptPubKeyBytes,
EncryptedReadKeys: symKeys,
}
aclData := &aclrecordproto.ACLData{AclContent: []*aclrecordproto.ACLContentValue{
{Value: &aclrecordproto.ACLContentValue_UserJoin{UserJoin: userJoin}},
aclData := &aclrecordproto.AclData{AclContent: []*aclrecordproto.AclContentValue{
{Value: &aclrecordproto.AclContentValue_UserJoin{UserJoin: userJoin}},
}}
marshalledJoin, err := aclData.Marshal()
if err != nil {
return
}
aclRecord := &aclrecordproto.ACLRecord{
aclRecord := &aclrecordproto.AclRecord{
PrevId: state.LastRecordId(),
Identity: state.Identity(),
Data: marshalledJoin,
@ -98,28 +98,28 @@ func (a *aclRecordBuilder) BuildUserJoin(acceptPrivKeyBytes []byte, encSymKeyByt
if err != nil {
return
}
rec = &aclrecordproto.RawACLRecord{
rec = &aclrecordproto.RawAclRecord{
Payload: marshalledRecord,
Signature: recSignature,
}
return
}
func (a *aclRecordBuilder) ConvertFromRaw(rawIdRecord *aclrecordproto.RawACLRecordWithId) (rec *ACLRecord, err error) {
rawRec := &aclrecordproto.RawACLRecord{}
func (a *aclRecordBuilder) ConvertFromRaw(rawIdRecord *aclrecordproto.RawAclRecordWithId) (rec *AclRecord, err error) {
rawRec := &aclrecordproto.RawAclRecord{}
err = proto.Unmarshal(rawIdRecord.Payload, rawRec)
if err != nil {
return
}
if rawIdRecord.Id == a.id {
aclRoot := &aclrecordproto.ACLRoot{}
aclRoot := &aclrecordproto.AclRoot{}
err = proto.Unmarshal(rawRec.Payload, aclRoot)
if err != nil {
return
}
rec = &ACLRecord{
rec = &AclRecord{
Id: rawIdRecord.Id,
CurrentReadKeyHash: aclRoot.CurrentReadKeyHash,
Timestamp: aclRoot.Timestamp,
@ -128,13 +128,13 @@ func (a *aclRecordBuilder) ConvertFromRaw(rawIdRecord *aclrecordproto.RawACLReco
Model: aclRoot,
}
} else {
aclRecord := &aclrecordproto.ACLRecord{}
aclRecord := &aclrecordproto.AclRecord{}
err = proto.Unmarshal(rawRec.Payload, aclRecord)
if err != nil {
return
}
rec = &ACLRecord{
rec = &AclRecord{
Id: rawIdRecord.Id,
PrevId: aclRecord.PrevId,
CurrentReadKeyHash: aclRecord.CurrentReadKeyHash,
@ -150,9 +150,9 @@ func (a *aclRecordBuilder) ConvertFromRaw(rawIdRecord *aclrecordproto.RawACLReco
}
func verifyRaw(
keychain *common.Keychain,
rawRec *aclrecordproto.RawACLRecord,
recWithId *aclrecordproto.RawACLRecordWithId,
keychain *keychain.Keychain,
rawRec *aclrecordproto.RawAclRecord,
recWithId *aclrecordproto.RawAclRecordWithId,
identity []byte) (err error) {
identityKey, err := keychain.GetOrAdd(string(identity))
if err != nil {
@ -170,7 +170,7 @@ func verifyRaw(
}
// verifying ID
if !cid.VerifyCID(recWithId.Payload, recWithId.Id) {
if !cidutil.VerifyCid(recWithId.Payload, recWithId.Id) {
err = ErrIncorrectCID
}
return

View File

@ -0,0 +1,50 @@
package list
import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/accountdata"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
acllistbuilder2 "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/testutils/acllistbuilder"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/keychain"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/cidutil"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/signingkey"
"github.com/stretchr/testify/require"
"testing"
)
func TestAclRecordBuilder_BuildUserJoin(t *testing.T) {
st, err := acllistbuilder2.NewListStorageWithTestName("userjoinexample.yml")
require.NoError(t, err, "building storage should not result in error")
testKeychain := st.(*acllistbuilder2.AclListStorageBuilder).GetKeychain()
identity := testKeychain.GeneratedIdentities["D"]
signPrivKey := testKeychain.SigningKeysByYAMLName["D"]
encPrivKey := testKeychain.EncryptionKeysByYAMLName["D"]
acc := &accountdata.AccountData{
Identity: []byte(identity),
SignKey: signPrivKey,
EncKey: encPrivKey,
}
aclList, err := BuildAclListWithIdentity(acc, st)
require.NoError(t, err, "building acl list should be without error")
recordBuilder := newAclRecordBuilder(aclList.Id(), keychain.NewKeychain())
rk, err := testKeychain.GetKey("key.Read.EncKey").(*acllistbuilder2.SymKey).Key.Raw()
require.NoError(t, err)
privKey, err := testKeychain.GetKey("key.Sign.Onetime1").(signingkey.PrivKey).Raw()
require.NoError(t, err)
userJoin, err := recordBuilder.BuildUserJoin(privKey, rk, aclList.AclState())
require.NoError(t, err)
marshalledJoin, err := userJoin.Marshal()
require.NoError(t, err)
id, err := cidutil.NewCidFromBytes(marshalledJoin)
require.NoError(t, err)
rawRec := &aclrecordproto.RawAclRecordWithId{
Payload: marshalledJoin,
Id: id,
}
res, err := aclList.AddRawRecord(rawRec)
require.True(t, res)
require.NoError(t, err)
require.Equal(t, aclrecordproto.AclUserPermissions_Writer, aclList.AclState().UserStates()[identity].Permissions)
}

View File

@ -5,8 +5,8 @@ import (
"errors"
"fmt"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/logger"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/aclrecordproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/common"
aclrecordproto2 "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/keychain"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/encryptionkey"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/signingkey"
@ -18,31 +18,33 @@ import (
var log = logger.NewNamed("acllist").Sugar()
var ErrNoSuchUser = errors.New("no such user")
var ErrFailedToDecrypt = errors.New("failed to decrypt key")
var ErrUserRemoved = errors.New("user was removed from the document")
var ErrDocumentForbidden = errors.New("your user was forbidden access to the document")
var ErrUserAlreadyExists = errors.New("user already exists")
var ErrNoSuchRecord = errors.New("no such record")
var ErrNoSuchInvite = errors.New("no such invite")
var ErrOldInvite = errors.New("invite is too old")
var ErrInsufficientPermissions = errors.New("insufficient permissions")
var ErrNoReadKey = errors.New("acl state doesn't have a read key")
var ErrInvalidSignature = errors.New("signature is invalid")
var ErrIncorrectRoot = errors.New("incorrect root")
var ErrIncorrectRecordSequence = errors.New("incorrect prev id of a record")
var (
ErrNoSuchUser = errors.New("no such user")
ErrFailedToDecrypt = errors.New("failed to decrypt key")
ErrUserRemoved = errors.New("user was removed from the document")
ErrDocumentForbidden = errors.New("your user was forbidden access to the document")
ErrUserAlreadyExists = errors.New("user already exists")
ErrNoSuchRecord = errors.New("no such record")
ErrNoSuchInvite = errors.New("no such invite")
ErrOldInvite = errors.New("invite is too old")
ErrInsufficientPermissions = errors.New("insufficient permissions")
ErrNoReadKey = errors.New("acl state doesn't have a read key")
ErrInvalidSignature = errors.New("signature is invalid")
ErrIncorrectRoot = errors.New("incorrect root")
ErrIncorrectRecordSequence = errors.New("incorrect prev id of a record")
)
type UserPermissionPair struct {
Identity string
Permission aclrecordproto.ACLUserPermissions
Permission aclrecordproto2.AclUserPermissions
}
type ACLState struct {
type AclState struct {
id string
currentReadKeyHash uint64
userReadKeys map[uint64]*symmetric.Key
userStates map[string]*aclrecordproto.ACLUserState
userInvites map[string]*aclrecordproto.ACLUserInvite
userStates map[string]*aclrecordproto2.AclUserState
userInvites map[string]*aclrecordproto2.AclUserInvite
encryptionKey encryptionkey.PrivKey
signingKey signingkey.PrivKey
totalReadKeys int
@ -51,44 +53,44 @@ type ACLState struct {
permissionsAtRecord map[string][]UserPermissionPair
lastRecordId string
keychain *common.Keychain
keychain *keychain.Keychain
}
func newACLStateWithKeys(
func newAclStateWithKeys(
id string,
signingKey signingkey.PrivKey,
encryptionKey encryptionkey.PrivKey) (*ACLState, error) {
encryptionKey encryptionkey.PrivKey) (*AclState, error) {
identity, err := signingKey.GetPublic().Raw()
if err != nil {
return nil, err
}
return &ACLState{
return &AclState{
id: id,
identity: string(identity),
signingKey: signingKey,
encryptionKey: encryptionKey,
userReadKeys: make(map[uint64]*symmetric.Key),
userStates: make(map[string]*aclrecordproto.ACLUserState),
userInvites: make(map[string]*aclrecordproto.ACLUserInvite),
userStates: make(map[string]*aclrecordproto2.AclUserState),
userInvites: make(map[string]*aclrecordproto2.AclUserInvite),
permissionsAtRecord: make(map[string][]UserPermissionPair),
}, nil
}
func newACLState(id string) *ACLState {
return &ACLState{
func newAclState(id string) *AclState {
return &AclState{
id: id,
userReadKeys: make(map[uint64]*symmetric.Key),
userStates: make(map[string]*aclrecordproto.ACLUserState),
userInvites: make(map[string]*aclrecordproto.ACLUserInvite),
userStates: make(map[string]*aclrecordproto2.AclUserState),
userInvites: make(map[string]*aclrecordproto2.AclUserInvite),
permissionsAtRecord: make(map[string][]UserPermissionPair),
}
}
func (st *ACLState) CurrentReadKeyHash() uint64 {
func (st *AclState) CurrentReadKeyHash() uint64 {
return st.currentReadKeyHash
}
func (st *ACLState) CurrentReadKey() (*symmetric.Key, error) {
func (st *AclState) CurrentReadKey() (*symmetric.Key, error) {
key, exists := st.userReadKeys[st.currentReadKeyHash]
if !exists {
return nil, ErrNoReadKey
@ -96,11 +98,11 @@ func (st *ACLState) CurrentReadKey() (*symmetric.Key, error) {
return key, nil
}
func (st *ACLState) UserReadKeys() map[uint64]*symmetric.Key {
func (st *AclState) UserReadKeys() map[uint64]*symmetric.Key {
return st.userReadKeys
}
func (st *ACLState) PermissionsAtRecord(id string, identity string) (UserPermissionPair, error) {
func (st *AclState) PermissionsAtRecord(id string, identity string) (UserPermissionPair, error) {
permissions, ok := st.permissionsAtRecord[id]
if !ok {
log.Errorf("missing record at id %s", id)
@ -115,7 +117,7 @@ func (st *ACLState) PermissionsAtRecord(id string, identity string) (UserPermiss
return UserPermissionPair{}, ErrNoSuchUser
}
func (st *ACLState) applyRecord(record *ACLRecord) (err error) {
func (st *AclState) applyRecord(record *AclRecord) (err error) {
defer func() {
if err == nil {
st.lastRecordId = record.Id
@ -126,7 +128,7 @@ func (st *ACLState) applyRecord(record *ACLRecord) (err error) {
return
}
if record.Id == st.id {
root, ok := record.Model.(*aclrecordproto.ACLRoot)
root, ok := record.Model.(*aclrecordproto2.AclRoot)
if !ok {
return ErrIncorrectRoot
}
@ -135,14 +137,14 @@ func (st *ACLState) applyRecord(record *ACLRecord) (err error) {
return
}
st.permissionsAtRecord[record.Id] = []UserPermissionPair{
{Identity: string(root.Identity), Permission: aclrecordproto.ACLUserPermissions_Admin},
{Identity: string(root.Identity), Permission: aclrecordproto2.AclUserPermissions_Admin},
}
return
}
aclData := &aclrecordproto.ACLData{}
aclData := &aclrecordproto2.AclData{}
if record.Model != nil {
aclData = record.Model.(*aclrecordproto.ACLData)
aclData = record.Model.(*aclrecordproto2.AclData)
} else {
err = proto.Unmarshal(record.Data, aclData)
if err != nil {
@ -170,7 +172,7 @@ func (st *ACLState) applyRecord(record *ACLRecord) (err error) {
return
}
func (st *ACLState) applyRoot(root *aclrecordproto.ACLRoot) (err error) {
func (st *AclState) applyRoot(root *aclrecordproto2.AclRoot) (err error) {
if st.signingKey != nil && st.encryptionKey != nil && st.identity == string(root.Identity) {
err = st.saveReadKeyFromRoot(root)
if err != nil {
@ -179,10 +181,10 @@ func (st *ACLState) applyRoot(root *aclrecordproto.ACLRoot) (err error) {
}
// adding user to the list
userState := &aclrecordproto.ACLUserState{
userState := &aclrecordproto2.AclUserState{
Identity: root.Identity,
EncryptionKey: root.EncryptionKey,
Permissions: aclrecordproto.ACLUserPermissions_Admin,
Permissions: aclrecordproto2.AclUserPermissions_Admin,
}
st.currentReadKeyHash = root.CurrentReadKeyHash
st.userStates[string(root.Identity)] = userState
@ -190,7 +192,7 @@ func (st *ACLState) applyRoot(root *aclrecordproto.ACLRoot) (err error) {
return
}
func (st *ACLState) saveReadKeyFromRoot(root *aclrecordproto.ACLRoot) (err error) {
func (st *AclState) saveReadKeyFromRoot(root *aclrecordproto2.AclRoot) (err error) {
var readKey *symmetric.Key
if len(root.GetDerivationScheme()) != 0 {
var encPrivKey []byte
@ -204,7 +206,7 @@ func (st *ACLState) saveReadKeyFromRoot(root *aclrecordproto.ACLRoot) (err error
return
}
readKey, err = aclrecordproto.ACLReadKeyDerive(signPrivKey, encPrivKey)
readKey, err = aclrecordproto2.AclReadKeyDerive(signPrivKey, encPrivKey)
if err != nil {
return
}
@ -228,7 +230,7 @@ func (st *ACLState) saveReadKeyFromRoot(root *aclrecordproto.ACLRoot) (err error
return
}
func (st *ACLState) applyChangeData(changeData *aclrecordproto.ACLData, hash uint64, identity []byte) (err error) {
func (st *AclState) applyChangeData(changeData *aclrecordproto2.AclData, hash uint64, identity []byte) (err error) {
defer func() {
if err != nil {
return
@ -246,7 +248,7 @@ func (st *ACLState) applyChangeData(changeData *aclrecordproto.ACLData, hash uin
return
}
if !st.HasPermission(identity, aclrecordproto.ACLUserPermissions_Admin) {
if !st.HasPermission(identity, aclrecordproto2.AclUserPermissions_Admin) {
err = fmt.Errorf("user %s must have admin permissions", identity)
return
}
@ -262,7 +264,7 @@ func (st *ACLState) applyChangeData(changeData *aclrecordproto.ACLData, hash uin
return nil
}
func (st *ACLState) applyChangeContent(ch *aclrecordproto.ACLContentValue) error {
func (st *AclState) applyChangeContent(ch *aclrecordproto2.AclContentValue) error {
switch {
case ch.GetUserPermissionChange() != nil:
return st.applyUserPermissionChange(ch.GetUserPermissionChange())
@ -279,7 +281,7 @@ func (st *ACLState) applyChangeContent(ch *aclrecordproto.ACLContentValue) error
}
}
func (st *ACLState) applyUserPermissionChange(ch *aclrecordproto.ACLUserPermissionChange) error {
func (st *AclState) applyUserPermissionChange(ch *aclrecordproto2.AclUserPermissionChange) error {
chIdentity := string(ch.Identity)
state, exists := st.userStates[chIdentity]
if !exists {
@ -290,12 +292,12 @@ func (st *ACLState) applyUserPermissionChange(ch *aclrecordproto.ACLUserPermissi
return nil
}
func (st *ACLState) applyUserInvite(ch *aclrecordproto.ACLUserInvite) error {
func (st *AclState) applyUserInvite(ch *aclrecordproto2.AclUserInvite) error {
st.userInvites[string(ch.AcceptPublicKey)] = ch
return nil
}
func (st *ACLState) applyUserJoin(ch *aclrecordproto.ACLUserJoin) error {
func (st *AclState) applyUserJoin(ch *aclrecordproto2.AclUserJoin) error {
invite, exists := st.userInvites[string(ch.AcceptPubKey)]
if !exists {
return fmt.Errorf("no such invite with such public key %s", keys.EncodeBytesToString(ch.AcceptPubKey))
@ -334,7 +336,7 @@ func (st *ACLState) applyUserJoin(ch *aclrecordproto.ACLUserJoin) error {
}
// adding user to the list
userState := &aclrecordproto.ACLUserState{
userState := &aclrecordproto2.AclUserState{
Identity: ch.Identity,
EncryptionKey: ch.EncryptionKey,
Permissions: invite.Permissions,
@ -343,13 +345,13 @@ func (st *ACLState) applyUserJoin(ch *aclrecordproto.ACLUserJoin) error {
return nil
}
func (st *ACLState) applyUserAdd(ch *aclrecordproto.ACLUserAdd) error {
func (st *AclState) applyUserAdd(ch *aclrecordproto2.AclUserAdd) error {
chIdentity := string(ch.Identity)
if _, exists := st.userStates[chIdentity]; exists {
return ErrUserAlreadyExists
}
st.userStates[chIdentity] = &aclrecordproto.ACLUserState{
st.userStates[chIdentity] = &aclrecordproto2.AclUserState{
Identity: ch.Identity,
EncryptionKey: ch.EncryptionKey,
Permissions: ch.Permissions,
@ -369,7 +371,7 @@ func (st *ACLState) applyUserAdd(ch *aclrecordproto.ACLUserAdd) error {
return nil
}
func (st *ACLState) applyUserRemove(ch *aclrecordproto.ACLUserRemove) error {
func (st *AclState) applyUserRemove(ch *aclrecordproto2.AclUserRemove) error {
chIdentity := string(ch.Identity)
if chIdentity == st.identity {
return ErrDocumentForbidden
@ -397,7 +399,7 @@ func (st *ACLState) applyUserRemove(ch *aclrecordproto.ACLUserRemove) error {
return nil
}
func (st *ACLState) decryptReadKeyAndHash(msg []byte) (*symmetric.Key, uint64, error) {
func (st *AclState) decryptReadKeyAndHash(msg []byte) (*symmetric.Key, uint64, error) {
decrypted, err := st.encryptionKey.Decrypt(msg)
if err != nil {
return nil, 0, ErrFailedToDecrypt
@ -413,7 +415,7 @@ func (st *ACLState) decryptReadKeyAndHash(msg []byte) (*symmetric.Key, uint64, e
return key, hasher.Sum64(), nil
}
func (st *ACLState) HasPermission(identity []byte, permission aclrecordproto.ACLUserPermissions) bool {
func (st *AclState) HasPermission(identity []byte, permission aclrecordproto2.AclUserPermissions) bool {
state, exists := st.userStates[string(identity)]
if !exists {
return false
@ -422,22 +424,22 @@ func (st *ACLState) HasPermission(identity []byte, permission aclrecordproto.ACL
return state.Permissions == permission
}
func (st *ACLState) isUserJoin(data *aclrecordproto.ACLData) bool {
func (st *AclState) isUserJoin(data *aclrecordproto2.AclData) bool {
// if we have a UserJoin, then it should always be the first one applied
return data.GetAclContent() != nil && data.GetAclContent()[0].GetUserJoin() != nil
}
func (st *ACLState) isUserAdd(data *aclrecordproto.ACLData, identity []byte) bool {
func (st *AclState) isUserAdd(data *aclrecordproto2.AclData, identity []byte) bool {
// if we have a UserAdd, then it should always be the first one applied
userAdd := data.GetAclContent()[0].GetUserAdd()
return data.GetAclContent() != nil && userAdd != nil && bytes.Compare(userAdd.GetIdentity(), identity) == 0
}
func (st *ACLState) UserStates() map[string]*aclrecordproto.ACLUserState {
func (st *AclState) UserStates() map[string]*aclrecordproto2.AclUserState {
return st.userStates
}
func (st *ACLState) Invite(acceptPubKey []byte) (invite *aclrecordproto.ACLUserInvite, err error) {
func (st *AclState) Invite(acceptPubKey []byte) (invite *aclrecordproto2.AclUserInvite, err error) {
invite, exists := st.userInvites[string(acceptPubKey)]
if !exists {
err = ErrNoSuchInvite
@ -449,14 +451,14 @@ func (st *ACLState) Invite(acceptPubKey []byte) (invite *aclrecordproto.ACLUserI
return
}
func (st *ACLState) UserKeys() (encKey encryptionkey.PrivKey, signKey signingkey.PrivKey) {
func (st *AclState) UserKeys() (encKey encryptionkey.PrivKey, signKey signingkey.PrivKey) {
return st.encryptionKey, st.signingKey
}
func (st *ACLState) Identity() []byte {
func (st *AclState) Identity() []byte {
return []byte(st.identity)
}
func (st *ACLState) LastRecordId() string {
func (st *AclState) LastRecordId() string {
return st.lastRecordId
}

View File

@ -1,7 +1,7 @@
package list
import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/account"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/accountdata"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/encryptionkey"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/signingkey"
)
@ -12,14 +12,14 @@ type aclStateBuilder struct {
id string
}
func newACLStateBuilderWithIdentity(accountData *account.AccountData) *aclStateBuilder {
func newAclStateBuilderWithIdentity(accountData *accountdata.AccountData) *aclStateBuilder {
return &aclStateBuilder{
signPrivKey: accountData.SignKey,
encPrivKey: accountData.EncKey,
}
}
func newACLStateBuilder() *aclStateBuilder {
func newAclStateBuilder() *aclStateBuilder {
return &aclStateBuilder{}
}
@ -27,14 +27,14 @@ func (sb *aclStateBuilder) Init(id string) {
sb.id = id
}
func (sb *aclStateBuilder) Build(records []*ACLRecord) (state *ACLState, err error) {
func (sb *aclStateBuilder) Build(records []*AclRecord) (state *AclState, err error) {
if sb.encPrivKey != nil && sb.signPrivKey != nil {
state, err = newACLStateWithKeys(sb.id, sb.signPrivKey, sb.encPrivKey)
state, err = newAclStateWithKeys(sb.id, sb.signPrivKey, sb.encPrivKey)
if err != nil {
return
}
} else {
state = newACLState(sb.id)
state = newAclState(sb.id)
}
for _, rec := range records {
err = state.applyRecord(rec)
@ -46,7 +46,7 @@ func (sb *aclStateBuilder) Build(records []*ACLRecord) (state *ACLState, err err
return state, err
}
func (sb *aclStateBuilder) Append(state *ACLState, records []*ACLRecord) (err error) {
func (sb *aclStateBuilder) Append(state *AclState, records []*AclRecord) (err error) {
for _, rec := range records {
err = state.applyRecord(rec)
if err != nil {

View File

@ -1,18 +1,18 @@
//go:generate mockgen -destination mock_list/mock_list.go github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/list ACLList
//go:generate mockgen -destination mock_list/mock_list.go github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/list AclList
package list
import (
"context"
"errors"
"fmt"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/account"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/aclrecordproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/common"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/accountdata"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/liststorage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/keychain"
"sync"
)
type IterFunc = func(record *ACLRecord) (IsContinue bool)
type IterFunc = func(record *AclRecord) (IsContinue bool)
var ErrIncorrectCID = errors.New("incorrect CID")
@ -22,48 +22,48 @@ type RWLocker interface {
RUnlock()
}
type ACLList interface {
type AclList interface {
RWLocker
ID() string
Root() *aclrecordproto.RawACLRecordWithId
Records() []*ACLRecord
ACLState() *ACLState
Id() string
Root() *aclrecordproto.RawAclRecordWithId
Records() []*AclRecord
AclState() *AclState
IsAfter(first string, second string) (bool, error)
Head() *ACLRecord
Get(id string) (*ACLRecord, error)
Head() *AclRecord
Get(id string) (*AclRecord, error)
Iterate(iterFunc IterFunc)
IterateFrom(startId string, iterFunc IterFunc)
AddRawRecord(rawRec *aclrecordproto.RawACLRecordWithId) (added bool, err error)
AddRawRecord(rawRec *aclrecordproto.RawAclRecordWithId) (added bool, err error)
Close() (err error)
}
type aclList struct {
root *aclrecordproto.RawACLRecordWithId
records []*ACLRecord
root *aclrecordproto.RawAclRecordWithId
records []*AclRecord
indexes map[string]int
id string
stateBuilder *aclStateBuilder
recordBuilder ACLRecordBuilder
aclState *ACLState
keychain *common.Keychain
storage storage.ListStorage
recordBuilder AclRecordBuilder
aclState *AclState
keychain *keychain.Keychain
storage liststorage.ListStorage
sync.RWMutex
}
func BuildACLListWithIdentity(acc *account.AccountData, storage storage.ListStorage) (ACLList, error) {
builder := newACLStateBuilderWithIdentity(acc)
return build(storage.Id(), builder, newACLRecordBuilder(storage.Id(), common.NewKeychain()), storage)
func BuildAclListWithIdentity(acc *accountdata.AccountData, storage liststorage.ListStorage) (AclList, error) {
builder := newAclStateBuilderWithIdentity(acc)
return build(storage.Id(), builder, newAclRecordBuilder(storage.Id(), keychain.NewKeychain()), storage)
}
func BuildACLList(storage storage.ListStorage) (ACLList, error) {
return build(storage.Id(), newACLStateBuilder(), newACLRecordBuilder(storage.Id(), common.NewKeychain()), storage)
func BuildAclList(storage liststorage.ListStorage) (AclList, error) {
return build(storage.Id(), newAclStateBuilder(), newAclRecordBuilder(storage.Id(), keychain.NewKeychain()), storage)
}
func build(id string, stateBuilder *aclStateBuilder, recBuilder ACLRecordBuilder, storage storage.ListStorage) (list ACLList, err error) {
func build(id string, stateBuilder *aclStateBuilder, recBuilder AclRecordBuilder, storage liststorage.ListStorage) (list AclList, err error) {
head, err := storage.Head()
if err != nil {
return
@ -78,7 +78,7 @@ func build(id string, stateBuilder *aclStateBuilder, recBuilder ACLRecordBuilder
if err != nil {
return
}
records := []*ACLRecord{record}
records := []*AclRecord{record}
for record.PrevId != "" {
rawRecordWithId, err = storage.GetRawRecord(context.Background(), record.PrevId)
@ -129,11 +129,11 @@ func build(id string, stateBuilder *aclStateBuilder, recBuilder ACLRecordBuilder
return
}
func (a *aclList) Records() []*ACLRecord {
func (a *aclList) Records() []*AclRecord {
return a.records
}
func (a *aclList) AddRawRecord(rawRec *aclrecordproto.RawACLRecordWithId) (added bool, err error) {
func (a *aclList) AddRawRecord(rawRec *aclrecordproto.RawAclRecordWithId) (added bool, err error) {
if _, ok := a.indexes[rawRec.Id]; ok {
return
}
@ -155,7 +155,7 @@ func (a *aclList) AddRawRecord(rawRec *aclrecordproto.RawACLRecordWithId) (added
return true, nil
}
func (a *aclList) IsValidNext(rawRec *aclrecordproto.RawACLRecordWithId) (err error) {
func (a *aclList) IsValidNext(rawRec *aclrecordproto.RawAclRecordWithId) (err error) {
_, err = a.recordBuilder.ConvertFromRaw(rawRec)
if err != nil {
return
@ -164,15 +164,15 @@ func (a *aclList) IsValidNext(rawRec *aclrecordproto.RawACLRecordWithId) (err er
return
}
func (a *aclList) ID() string {
func (a *aclList) Id() string {
return a.id
}
func (a *aclList) Root() *aclrecordproto.RawACLRecordWithId {
func (a *aclList) Root() *aclrecordproto.RawAclRecordWithId {
return a.root
}
func (a *aclList) ACLState() *ACLState {
func (a *aclList) AclState() *AclState {
return a.aclState
}
@ -185,11 +185,11 @@ func (a *aclList) IsAfter(first string, second string) (bool, error) {
return firstRec >= secondRec, nil
}
func (a *aclList) Head() *ACLRecord {
func (a *aclList) Head() *AclRecord {
return a.records[len(a.records)-1]
}
func (a *aclList) Get(id string) (*ACLRecord, error) {
func (a *aclList) Get(id string) (*AclRecord, error) {
recIdx, ok := a.indexes[id]
if !ok {
return nil, fmt.Errorf("no such record")

View File

@ -1,20 +1,20 @@
package list
import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/aclrecordproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/testutils/acllistbuilder"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/testutils/acllistbuilder"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"testing"
)
func TestAclList_ACLState_UserInviteAndJoin(t *testing.T) {
func TestAclList_AclState_UserInviteAndJoin(t *testing.T) {
st, err := acllistbuilder.NewListStorageWithTestName("userjoinexample.yml")
require.NoError(t, err, "building storage should not result in error")
keychain := st.(*acllistbuilder.ACLListStorageBuilder).GetKeychain()
keychain := st.(*acllistbuilder.AclListStorageBuilder).GetKeychain()
aclList, err := BuildACLList(st)
aclList, err := BuildAclList(st)
require.NoError(t, err, "building acl list should be without error")
idA := keychain.GetIdentity("A")
@ -22,13 +22,13 @@ func TestAclList_ACLState_UserInviteAndJoin(t *testing.T) {
idC := keychain.GetIdentity("C")
// checking final state
assert.Equal(t, aclrecordproto.ACLUserPermissions_Admin, aclList.ACLState().UserStates()[idA].Permissions)
assert.Equal(t, aclrecordproto.ACLUserPermissions_Writer, aclList.ACLState().UserStates()[idB].Permissions)
assert.Equal(t, aclrecordproto.ACLUserPermissions_Reader, aclList.ACLState().UserStates()[idC].Permissions)
assert.Equal(t, aclList.Head().CurrentReadKeyHash, aclList.ACLState().CurrentReadKeyHash())
assert.Equal(t, aclrecordproto.AclUserPermissions_Admin, aclList.AclState().UserStates()[idA].Permissions)
assert.Equal(t, aclrecordproto.AclUserPermissions_Writer, aclList.AclState().UserStates()[idB].Permissions)
assert.Equal(t, aclrecordproto.AclUserPermissions_Reader, aclList.AclState().UserStates()[idC].Permissions)
assert.Equal(t, aclList.Head().CurrentReadKeyHash, aclList.AclState().CurrentReadKeyHash())
var records []*ACLRecord
aclList.Iterate(func(record *ACLRecord) (IsContinue bool) {
var records []*AclRecord
aclList.Iterate(func(record *AclRecord) (IsContinue bool) {
records = append(records, record)
return true
})
@ -36,24 +36,24 @@ func TestAclList_ACLState_UserInviteAndJoin(t *testing.T) {
// checking permissions at specific records
assert.Equal(t, 3, len(records))
_, err = aclList.ACLState().PermissionsAtRecord(records[1].Id, idB)
_, err = aclList.AclState().PermissionsAtRecord(records[1].Id, idB)
assert.Error(t, err, "B should have no permissions at record 1")
perm, err := aclList.ACLState().PermissionsAtRecord(records[2].Id, idB)
perm, err := aclList.AclState().PermissionsAtRecord(records[2].Id, idB)
assert.NoError(t, err, "should have no error with permissions of B in the record 2")
assert.Equal(t, UserPermissionPair{
Identity: idB,
Permission: aclrecordproto.ACLUserPermissions_Writer,
Permission: aclrecordproto.AclUserPermissions_Writer,
}, perm)
}
func TestAclList_ACLState_UserJoinAndRemove(t *testing.T) {
func TestAclList_AclState_UserJoinAndRemove(t *testing.T) {
st, err := acllistbuilder.NewListStorageWithTestName("userremoveexample.yml")
require.NoError(t, err, "building storage should not result in error")
keychain := st.(*acllistbuilder.ACLListStorageBuilder).GetKeychain()
keychain := st.(*acllistbuilder.AclListStorageBuilder).GetKeychain()
aclList, err := BuildACLList(st)
aclList, err := BuildAclList(st)
require.NoError(t, err, "building acl list should be without error")
idA := keychain.GetIdentity("A")
@ -61,15 +61,15 @@ func TestAclList_ACLState_UserJoinAndRemove(t *testing.T) {
idC := keychain.GetIdentity("C")
// checking final state
assert.Equal(t, aclrecordproto.ACLUserPermissions_Admin, aclList.ACLState().UserStates()[idA].Permissions)
assert.Equal(t, aclrecordproto.ACLUserPermissions_Reader, aclList.ACLState().UserStates()[idC].Permissions)
assert.Equal(t, aclList.Head().CurrentReadKeyHash, aclList.ACLState().CurrentReadKeyHash())
assert.Equal(t, aclrecordproto.AclUserPermissions_Admin, aclList.AclState().UserStates()[idA].Permissions)
assert.Equal(t, aclrecordproto.AclUserPermissions_Reader, aclList.AclState().UserStates()[idC].Permissions)
assert.Equal(t, aclList.Head().CurrentReadKeyHash, aclList.AclState().CurrentReadKeyHash())
_, exists := aclList.ACLState().UserStates()[idB]
_, exists := aclList.AclState().UserStates()[idB]
assert.Equal(t, false, exists)
var records []*ACLRecord
aclList.Iterate(func(record *ACLRecord) (IsContinue bool) {
var records []*AclRecord
aclList.Iterate(func(record *AclRecord) (IsContinue bool) {
records = append(records, record)
return true
})
@ -77,15 +77,15 @@ func TestAclList_ACLState_UserJoinAndRemove(t *testing.T) {
// checking permissions at specific records
assert.Equal(t, 4, len(records))
assert.NotEqual(t, records[2].CurrentReadKeyHash, aclList.ACLState().CurrentReadKeyHash())
assert.NotEqual(t, records[2].CurrentReadKeyHash, aclList.AclState().CurrentReadKeyHash())
perm, err := aclList.ACLState().PermissionsAtRecord(records[2].Id, idB)
perm, err := aclList.AclState().PermissionsAtRecord(records[2].Id, idB)
assert.NoError(t, err, "should have no error with permissions of B in the record 2")
assert.Equal(t, UserPermissionPair{
Identity: idB,
Permission: aclrecordproto.ACLUserPermissions_Writer,
Permission: aclrecordproto.AclUserPermissions_Writer,
}, perm)
_, err = aclList.ACLState().PermissionsAtRecord(records[3].Id, idB)
_, err = aclList.AclState().PermissionsAtRecord(records[3].Id, idB)
assert.Error(t, err, "B should have no permissions at record 3, because user should be removed")
}

View File

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/list (interfaces: ACLList)
// Source: github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/list (interfaces: AclList)
// Package mock_list is a generated GoMock package.
package mock_list
@ -7,50 +7,50 @@ package mock_list
import (
reflect "reflect"
aclrecordproto "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/aclrecordproto"
list "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/list"
aclrecordproto "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
list "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/list"
gomock "github.com/golang/mock/gomock"
)
// MockACLList is a mock of ACLList interface.
type MockACLList struct {
// MockAclList is a mock of AclList interface.
type MockAclList struct {
ctrl *gomock.Controller
recorder *MockACLListMockRecorder
recorder *MockAclListMockRecorder
}
// MockACLListMockRecorder is the mock recorder for MockACLList.
type MockACLListMockRecorder struct {
mock *MockACLList
// MockAclListMockRecorder is the mock recorder for MockAclList.
type MockAclListMockRecorder struct {
mock *MockAclList
}
// NewMockACLList creates a new mock instance.
func NewMockACLList(ctrl *gomock.Controller) *MockACLList {
mock := &MockACLList{ctrl: ctrl}
mock.recorder = &MockACLListMockRecorder{mock}
// NewMockAclList creates a new mock instance.
func NewMockAclList(ctrl *gomock.Controller) *MockAclList {
mock := &MockAclList{ctrl: ctrl}
mock.recorder = &MockAclListMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockACLList) EXPECT() *MockACLListMockRecorder {
func (m *MockAclList) EXPECT() *MockAclListMockRecorder {
return m.recorder
}
// ACLState mocks base method.
func (m *MockACLList) ACLState() *list.ACLState {
// AclState mocks base method.
func (m *MockAclList) AclState() *list.AclState {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ACLState")
ret0, _ := ret[0].(*list.ACLState)
ret := m.ctrl.Call(m, "AclState")
ret0, _ := ret[0].(*list.AclState)
return ret0
}
// ACLState indicates an expected call of ACLState.
func (mr *MockACLListMockRecorder) ACLState() *gomock.Call {
// AclState indicates an expected call of AclState.
func (mr *MockAclListMockRecorder) AclState() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ACLState", reflect.TypeOf((*MockACLList)(nil).ACLState))
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AclState", reflect.TypeOf((*MockAclList)(nil).AclState))
}
// AddRawRecord mocks base method.
func (m *MockACLList) AddRawRecord(arg0 *aclrecordproto.RawACLRecordWithId) (bool, error) {
func (m *MockAclList) AddRawRecord(arg0 *aclrecordproto.RawAclRecordWithId) (bool, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AddRawRecord", arg0)
ret0, _ := ret[0].(bool)
@ -59,13 +59,13 @@ func (m *MockACLList) AddRawRecord(arg0 *aclrecordproto.RawACLRecordWithId) (boo
}
// AddRawRecord indicates an expected call of AddRawRecord.
func (mr *MockACLListMockRecorder) AddRawRecord(arg0 interface{}) *gomock.Call {
func (mr *MockAclListMockRecorder) AddRawRecord(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddRawRecord", reflect.TypeOf((*MockACLList)(nil).AddRawRecord), arg0)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddRawRecord", reflect.TypeOf((*MockAclList)(nil).AddRawRecord), arg0)
}
// Close mocks base method.
func (m *MockACLList) Close() error {
func (m *MockAclList) Close() error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Close")
ret0, _ := ret[0].(error)
@ -73,56 +73,56 @@ func (m *MockACLList) Close() error {
}
// Close indicates an expected call of Close.
func (mr *MockACLListMockRecorder) Close() *gomock.Call {
func (mr *MockAclListMockRecorder) Close() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockACLList)(nil).Close))
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockAclList)(nil).Close))
}
// Get mocks base method.
func (m *MockACLList) Get(arg0 string) (*list.ACLRecord, error) {
func (m *MockAclList) Get(arg0 string) (*list.AclRecord, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Get", arg0)
ret0, _ := ret[0].(*list.ACLRecord)
ret0, _ := ret[0].(*list.AclRecord)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Get indicates an expected call of Get.
func (mr *MockACLListMockRecorder) Get(arg0 interface{}) *gomock.Call {
func (mr *MockAclListMockRecorder) Get(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockACLList)(nil).Get), arg0)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockAclList)(nil).Get), arg0)
}
// Head mocks base method.
func (m *MockACLList) Head() *list.ACLRecord {
func (m *MockAclList) Head() *list.AclRecord {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Head")
ret0, _ := ret[0].(*list.ACLRecord)
ret0, _ := ret[0].(*list.AclRecord)
return ret0
}
// Head indicates an expected call of Head.
func (mr *MockACLListMockRecorder) Head() *gomock.Call {
func (mr *MockAclListMockRecorder) Head() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Head", reflect.TypeOf((*MockACLList)(nil).Head))
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Head", reflect.TypeOf((*MockAclList)(nil).Head))
}
// ID mocks base method.
func (m *MockACLList) ID() string {
// Id mocks base method.
func (m *MockAclList) Id() string {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ID")
ret := m.ctrl.Call(m, "Id")
ret0, _ := ret[0].(string)
return ret0
}
// ID indicates an expected call of ID.
func (mr *MockACLListMockRecorder) ID() *gomock.Call {
// Id indicates an expected call of Id.
func (mr *MockAclListMockRecorder) Id() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ID", reflect.TypeOf((*MockACLList)(nil).ID))
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Id", reflect.TypeOf((*MockAclList)(nil).Id))
}
// IsAfter mocks base method.
func (m *MockACLList) IsAfter(arg0, arg1 string) (bool, error) {
func (m *MockAclList) IsAfter(arg0, arg1 string) (bool, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "IsAfter", arg0, arg1)
ret0, _ := ret[0].(bool)
@ -131,107 +131,107 @@ func (m *MockACLList) IsAfter(arg0, arg1 string) (bool, error) {
}
// IsAfter indicates an expected call of IsAfter.
func (mr *MockACLListMockRecorder) IsAfter(arg0, arg1 interface{}) *gomock.Call {
func (mr *MockAclListMockRecorder) IsAfter(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsAfter", reflect.TypeOf((*MockACLList)(nil).IsAfter), arg0, arg1)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsAfter", reflect.TypeOf((*MockAclList)(nil).IsAfter), arg0, arg1)
}
// Iterate mocks base method.
func (m *MockACLList) Iterate(arg0 func(*list.ACLRecord) bool) {
func (m *MockAclList) Iterate(arg0 func(*list.AclRecord) bool) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "Iterate", arg0)
}
// Iterate indicates an expected call of Iterate.
func (mr *MockACLListMockRecorder) Iterate(arg0 interface{}) *gomock.Call {
func (mr *MockAclListMockRecorder) Iterate(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Iterate", reflect.TypeOf((*MockACLList)(nil).Iterate), arg0)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Iterate", reflect.TypeOf((*MockAclList)(nil).Iterate), arg0)
}
// IterateFrom mocks base method.
func (m *MockACLList) IterateFrom(arg0 string, arg1 func(*list.ACLRecord) bool) {
func (m *MockAclList) IterateFrom(arg0 string, arg1 func(*list.AclRecord) bool) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "IterateFrom", arg0, arg1)
}
// IterateFrom indicates an expected call of IterateFrom.
func (mr *MockACLListMockRecorder) IterateFrom(arg0, arg1 interface{}) *gomock.Call {
func (mr *MockAclListMockRecorder) IterateFrom(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IterateFrom", reflect.TypeOf((*MockACLList)(nil).IterateFrom), arg0, arg1)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IterateFrom", reflect.TypeOf((*MockAclList)(nil).IterateFrom), arg0, arg1)
}
// Lock mocks base method.
func (m *MockACLList) Lock() {
func (m *MockAclList) Lock() {
m.ctrl.T.Helper()
m.ctrl.Call(m, "Lock")
}
// Lock indicates an expected call of Lock.
func (mr *MockACLListMockRecorder) Lock() *gomock.Call {
func (mr *MockAclListMockRecorder) Lock() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Lock", reflect.TypeOf((*MockACLList)(nil).Lock))
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Lock", reflect.TypeOf((*MockAclList)(nil).Lock))
}
// RLock mocks base method.
func (m *MockACLList) RLock() {
func (m *MockAclList) RLock() {
m.ctrl.T.Helper()
m.ctrl.Call(m, "RLock")
}
// RLock indicates an expected call of RLock.
func (mr *MockACLListMockRecorder) RLock() *gomock.Call {
func (mr *MockAclListMockRecorder) RLock() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RLock", reflect.TypeOf((*MockACLList)(nil).RLock))
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RLock", reflect.TypeOf((*MockAclList)(nil).RLock))
}
// RUnlock mocks base method.
func (m *MockACLList) RUnlock() {
func (m *MockAclList) RUnlock() {
m.ctrl.T.Helper()
m.ctrl.Call(m, "RUnlock")
}
// RUnlock indicates an expected call of RUnlock.
func (mr *MockACLListMockRecorder) RUnlock() *gomock.Call {
func (mr *MockAclListMockRecorder) RUnlock() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RUnlock", reflect.TypeOf((*MockACLList)(nil).RUnlock))
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RUnlock", reflect.TypeOf((*MockAclList)(nil).RUnlock))
}
// Records mocks base method.
func (m *MockACLList) Records() []*list.ACLRecord {
func (m *MockAclList) Records() []*list.AclRecord {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Records")
ret0, _ := ret[0].([]*list.ACLRecord)
ret0, _ := ret[0].([]*list.AclRecord)
return ret0
}
// Records indicates an expected call of Records.
func (mr *MockACLListMockRecorder) Records() *gomock.Call {
func (mr *MockAclListMockRecorder) Records() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Records", reflect.TypeOf((*MockACLList)(nil).Records))
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Records", reflect.TypeOf((*MockAclList)(nil).Records))
}
// Root mocks base method.
func (m *MockACLList) Root() *aclrecordproto.RawACLRecordWithId {
func (m *MockAclList) Root() *aclrecordproto.RawAclRecordWithId {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Root")
ret0, _ := ret[0].(*aclrecordproto.RawACLRecordWithId)
ret0, _ := ret[0].(*aclrecordproto.RawAclRecordWithId)
return ret0
}
// Root indicates an expected call of Root.
func (mr *MockACLListMockRecorder) Root() *gomock.Call {
func (mr *MockAclListMockRecorder) Root() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Root", reflect.TypeOf((*MockACLList)(nil).Root))
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Root", reflect.TypeOf((*MockAclList)(nil).Root))
}
// Unlock mocks base method.
func (m *MockACLList) Unlock() {
func (m *MockAclList) Unlock() {
m.ctrl.T.Helper()
m.ctrl.Call(m, "Unlock")
}
// Unlock indicates an expected call of Unlock.
func (mr *MockACLListMockRecorder) Unlock() *gomock.Call {
func (mr *MockAclListMockRecorder) Unlock() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Unlock", reflect.TypeOf((*MockACLList)(nil).Unlock))
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Unlock", reflect.TypeOf((*MockAclList)(nil).Unlock))
}

View File

@ -1,6 +1,6 @@
package list
type ACLRecord struct {
type AclRecord struct {
Id string
PrevId string
CurrentReadKeyHash uint64

View File

@ -0,0 +1,78 @@
package liststorage
import (
"context"
"fmt"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
"sync"
)
type inMemoryAclListStorage struct {
id string
root *aclrecordproto.RawAclRecordWithId
head string
records map[string]*aclrecordproto.RawAclRecordWithId
sync.RWMutex
}
func NewInMemoryAclListStorage(
id string,
records []*aclrecordproto.RawAclRecordWithId) (ListStorage, error) {
allRecords := make(map[string]*aclrecordproto.RawAclRecordWithId)
for _, ch := range records {
allRecords[ch.Id] = ch
}
root := records[0]
head := records[len(records)-1]
return &inMemoryAclListStorage{
id: root.Id,
root: root,
head: head.Id,
records: allRecords,
}, nil
}
func (t *inMemoryAclListStorage) Id() string {
t.RLock()
defer t.RUnlock()
return t.id
}
func (t *inMemoryAclListStorage) Root() (*aclrecordproto.RawAclRecordWithId, error) {
t.RLock()
defer t.RUnlock()
return t.root, nil
}
func (t *inMemoryAclListStorage) Head() (string, error) {
t.RLock()
defer t.RUnlock()
return t.head, nil
}
func (t *inMemoryAclListStorage) SetHead(head string) error {
t.Lock()
defer t.Unlock()
t.head = head
return nil
}
func (t *inMemoryAclListStorage) AddRawRecord(ctx context.Context, record *aclrecordproto.RawAclRecordWithId) error {
t.Lock()
defer t.Unlock()
// TODO: better to do deep copy
t.records[record.Id] = record
return nil
}
func (t *inMemoryAclListStorage) GetRawRecord(ctx context.Context, recordId string) (*aclrecordproto.RawAclRecordWithId, error) {
t.RLock()
defer t.RUnlock()
if res, exists := t.records[recordId]; exists {
return res, nil
}
return nil, fmt.Errorf("could not get record with id: %s", recordId)
}

View File

@ -0,0 +1,24 @@
//go:generate mockgen -destination mock_liststorage/mock_liststorage.go github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/liststorage ListStorage
package liststorage
import (
"context"
"errors"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
)
var (
ErrUnknownAclId = errors.New("acl does not exist")
ErrAclExists = errors.New("acl already exists")
ErrUnknownRecord = errors.New("record doesn't exist")
)
type ListStorage interface {
Id() string
Root() (*aclrecordproto.RawAclRecordWithId, error)
Head() (string, error)
SetHead(headId string) error
GetRawRecord(ctx context.Context, id string) (*aclrecordproto.RawAclRecordWithId, error)
AddRawRecord(ctx context.Context, rec *aclrecordproto.RawAclRecordWithId) error
}

View File

@ -0,0 +1,123 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/liststorage (interfaces: ListStorage)
// Package mock_liststorage is a generated GoMock package.
package mock_liststorage
import (
context "context"
reflect "reflect"
aclrecordproto "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
gomock "github.com/golang/mock/gomock"
)
// MockListStorage is a mock of ListStorage interface.
type MockListStorage struct {
ctrl *gomock.Controller
recorder *MockListStorageMockRecorder
}
// MockListStorageMockRecorder is the mock recorder for MockListStorage.
type MockListStorageMockRecorder struct {
mock *MockListStorage
}
// NewMockListStorage creates a new mock instance.
func NewMockListStorage(ctrl *gomock.Controller) *MockListStorage {
mock := &MockListStorage{ctrl: ctrl}
mock.recorder = &MockListStorageMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockListStorage) EXPECT() *MockListStorageMockRecorder {
return m.recorder
}
// AddRawRecord mocks base method.
func (m *MockListStorage) AddRawRecord(arg0 context.Context, arg1 *aclrecordproto.RawAclRecordWithId) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AddRawRecord", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
}
// AddRawRecord indicates an expected call of AddRawRecord.
func (mr *MockListStorageMockRecorder) AddRawRecord(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddRawRecord", reflect.TypeOf((*MockListStorage)(nil).AddRawRecord), arg0, arg1)
}
// GetRawRecord mocks base method.
func (m *MockListStorage) GetRawRecord(arg0 context.Context, arg1 string) (*aclrecordproto.RawAclRecordWithId, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetRawRecord", arg0, arg1)
ret0, _ := ret[0].(*aclrecordproto.RawAclRecordWithId)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// GetRawRecord indicates an expected call of GetRawRecord.
func (mr *MockListStorageMockRecorder) GetRawRecord(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRawRecord", reflect.TypeOf((*MockListStorage)(nil).GetRawRecord), arg0, arg1)
}
// Head mocks base method.
func (m *MockListStorage) Head() (string, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Head")
ret0, _ := ret[0].(string)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Head indicates an expected call of Head.
func (mr *MockListStorageMockRecorder) Head() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Head", reflect.TypeOf((*MockListStorage)(nil).Head))
}
// Id mocks base method.
func (m *MockListStorage) Id() string {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Id")
ret0, _ := ret[0].(string)
return ret0
}
// Id indicates an expected call of Id.
func (mr *MockListStorageMockRecorder) Id() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Id", reflect.TypeOf((*MockListStorage)(nil).Id))
}
// Root mocks base method.
func (m *MockListStorage) Root() (*aclrecordproto.RawAclRecordWithId, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Root")
ret0, _ := ret[0].(*aclrecordproto.RawAclRecordWithId)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Root indicates an expected call of Root.
func (mr *MockListStorageMockRecorder) Root() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Root", reflect.TypeOf((*MockListStorage)(nil).Root))
}
// SetHead mocks base method.
func (m *MockListStorage) SetHead(arg0 string) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SetHead", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// SetHead indicates an expected call of SetHead.
func (mr *MockListStorageMockRecorder) SetHead(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetHead", reflect.TypeOf((*MockListStorage)(nil).SetHead), arg0)
}

View File

@ -1,20 +1,20 @@
package syncacl
import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/syncservice"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/syncservice/synchandler"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/list"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/list"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/objectsync"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/objectsync/synchandler"
)
type SyncACL struct {
list.ACLList
type SyncAcl struct {
list.AclList
synchandler.SyncHandler
streamPool syncservice.StreamPool
streamPool objectsync.StreamPool
}
func NewSyncACL(aclList list.ACLList, streamPool syncservice.StreamPool) *SyncACL {
return &SyncACL{
ACLList: aclList,
func NewSyncAcl(aclList list.AclList, streamPool objectsync.StreamPool) *SyncAcl {
return &SyncAcl{
AclList: aclList,
SyncHandler: nil,
streamPool: streamPool,
}

View File

@ -3,17 +3,17 @@ package syncacl
import (
"context"
"fmt"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/list"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/aclrecordproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/list"
)
type syncAclHandler struct {
acl list.ACLList
acl list.AclList
}
func (s *syncAclHandler) HandleMessage(ctx context.Context, senderId string, req *spacesyncproto.ObjectSyncMessage) (err error) {
aclMsg := &aclrecordproto.ACLSyncMessage{}
aclMsg := &aclrecordproto.AclSyncMessage{}
if err = aclMsg.Unmarshal(req.Payload); err != nil {
return
}
@ -26,6 +26,6 @@ func (s *syncAclHandler) HandleMessage(ctx context.Context, senderId string, req
}
}
func (s *syncAclHandler) handleAddRecords(ctx context.Context, senderId string, addRecord *aclrecordproto.ACLAddRecords) (err error) {
func (s *syncAclHandler) handleAddRecords(ctx context.Context, senderId string, addRecord *aclrecordproto.AclAddRecords) (err error) {
return
}

View File

@ -1,10 +1,10 @@
package acllistbuilder
import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/aclrecordproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys"
encryptionkey2 "github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/encryptionkey"
signingkey2 "github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/signingkey"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/encryptionkey"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/signingkey"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/symmetric"
"hash/fnv"
"strings"
@ -16,9 +16,9 @@ type SymKey struct {
}
type YAMLKeychain struct {
SigningKeysByYAMLName map[string]signingkey2.PrivKey
SigningKeysByRealIdentity map[string]signingkey2.PrivKey
EncryptionKeysByYAMLName map[string]encryptionkey2.PrivKey
SigningKeysByYAMLName map[string]signingkey.PrivKey
SigningKeysByRealIdentity map[string]signingkey.PrivKey
EncryptionKeysByYAMLName map[string]encryptionkey.PrivKey
ReadKeysByYAMLName map[string]*SymKey
ReadKeysByHash map[uint64]*SymKey
GeneratedIdentities map[string]string
@ -26,9 +26,9 @@ type YAMLKeychain struct {
func NewKeychain() *YAMLKeychain {
return &YAMLKeychain{
SigningKeysByYAMLName: map[string]signingkey2.PrivKey{},
SigningKeysByRealIdentity: map[string]signingkey2.PrivKey{},
EncryptionKeysByYAMLName: map[string]encryptionkey2.PrivKey{},
SigningKeysByYAMLName: map[string]signingkey.PrivKey{},
SigningKeysByRealIdentity: map[string]signingkey.PrivKey{},
EncryptionKeysByYAMLName: map[string]encryptionkey.PrivKey{},
GeneratedIdentities: map[string]string{},
ReadKeysByYAMLName: map[string]*SymKey{},
ReadKeysByHash: map[uint64]*SymKey{},
@ -54,16 +54,16 @@ func (k *YAMLKeychain) AddEncryptionKey(key *Key) {
return
}
var (
newPrivKey encryptionkey2.PrivKey
newPrivKey encryptionkey.PrivKey
err error
)
if key.Value == "generated" {
newPrivKey, _, err = encryptionkey2.GenerateRandomRSAKeyPair(2048)
newPrivKey, _, err = encryptionkey.GenerateRandomRSAKeyPair(2048)
if err != nil {
panic(err)
}
} else {
newPrivKey, err = keys.DecodeKeyFromString(key.Value, encryptionkey2.NewEncryptionRsaPrivKeyFromBytes, nil)
newPrivKey, err = keys.DecodeKeyFromString(key.Value, encryptionkey.NewEncryptionRsaPrivKeyFromBytes, nil)
if err != nil {
panic(err)
}
@ -76,17 +76,17 @@ func (k *YAMLKeychain) AddSigningKey(key *Key) {
return
}
var (
newPrivKey signingkey2.PrivKey
pubKey signingkey2.PubKey
newPrivKey signingkey.PrivKey
pubKey signingkey.PubKey
err error
)
if key.Value == "generated" {
newPrivKey, pubKey, err = signingkey2.GenerateRandomEd25519KeyPair()
newPrivKey, pubKey, err = signingkey.GenerateRandomEd25519KeyPair()
if err != nil {
panic(err)
}
} else {
newPrivKey, err = keys.DecodeKeyFromString(key.Value, signingkey2.NewSigningEd25519PrivKeyFromBytes, nil)
newPrivKey, err = keys.DecodeKeyFromString(key.Value, signingkey.NewSigningEd25519PrivKeyFromBytes, nil)
if err != nil {
panic(err)
}
@ -121,7 +121,7 @@ func (k *YAMLKeychain) AddReadKey(key *Key) {
} else if key.Value == "derived" {
signKey, _ := k.SigningKeysByYAMLName[key.Name].Raw()
encKey, _ := k.EncryptionKeysByYAMLName[key.Name].Raw()
rkey, err = aclrecordproto.ACLReadKeyDerive(signKey, encKey)
rkey, err = aclrecordproto.AclReadKeyDerive(signKey, encKey)
if err != nil {
panic("should be able to derive symmetric key")
}

View File

@ -3,10 +3,10 @@ package acllistbuilder
import (
"context"
"fmt"
aclrecordproto "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/aclrecordproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/testutils/yamltests"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/cid"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/liststorage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/testutils/yamltests"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/cidutil"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/encryptionkey"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/signingkey"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/symmetric"
@ -18,23 +18,23 @@ import (
"gopkg.in/yaml.v3"
)
type ACLListStorageBuilder struct {
storage.ListStorage
type AclListStorageBuilder struct {
liststorage.ListStorage
keychain *YAMLKeychain
}
func NewACLListStorageBuilder(keychain *YAMLKeychain) *ACLListStorageBuilder {
return &ACLListStorageBuilder{
func NewAclListStorageBuilder(keychain *YAMLKeychain) *AclListStorageBuilder {
return &AclListStorageBuilder{
keychain: keychain,
}
}
func NewListStorageWithTestName(name string) (storage.ListStorage, error) {
func NewListStorageWithTestName(name string) (liststorage.ListStorage, error) {
filePath := path.Join(yamltests.Path(), name)
return NewACLListStorageBuilderFromFile(filePath)
return NewAclListStorageBuilderFromFile(filePath)
}
func NewACLListStorageBuilderFromFile(file string) (*ACLListStorageBuilder, error) {
func NewAclListStorageBuilderFromFile(file string) (*AclListStorageBuilder, error) {
content, err := ioutil.ReadFile(file)
if err != nil {
return nil, err
@ -46,13 +46,13 @@ func NewACLListStorageBuilderFromFile(file string) (*ACLListStorageBuilder, erro
return nil, err
}
tb := NewACLListStorageBuilder(NewKeychain())
tb := NewAclListStorageBuilder(NewKeychain())
tb.Parse(&ymlTree)
return tb, nil
}
func (t *ACLListStorageBuilder) createRaw(rec proto.Marshaler, identity []byte) *aclrecordproto.RawACLRecordWithId {
func (t *AclListStorageBuilder) createRaw(rec proto.Marshaler, identity []byte) *aclrecordproto.RawAclRecordWithId {
protoMarshalled, err := rec.Marshal()
if err != nil {
panic("should be able to marshal final acl message!")
@ -63,7 +63,7 @@ func (t *ACLListStorageBuilder) createRaw(rec proto.Marshaler, identity []byte)
panic("should be able to sign final acl message!")
}
rawRec := &aclrecordproto.RawACLRecord{
rawRec := &aclrecordproto.RawAclRecord{
Payload: protoMarshalled,
Signature: signature,
}
@ -73,26 +73,26 @@ func (t *ACLListStorageBuilder) createRaw(rec proto.Marshaler, identity []byte)
panic(err)
}
id, _ := cid.NewCIDFromBytes(rawMarshalled)
id, _ := cidutil.NewCidFromBytes(rawMarshalled)
return &aclrecordproto.RawACLRecordWithId{
return &aclrecordproto.RawAclRecordWithId{
Payload: rawMarshalled,
Id: id,
}
}
func (t *ACLListStorageBuilder) GetKeychain() *YAMLKeychain {
func (t *AclListStorageBuilder) GetKeychain() *YAMLKeychain {
return t.keychain
}
func (t *ACLListStorageBuilder) Parse(l *YMLList) {
func (t *AclListStorageBuilder) Parse(l *YMLList) {
// Just to clarify - we are generating new identities for the ones that
// are specified in the yml file, because our identities should be Ed25519
// the same thing is happening for the encryption keys
t.keychain.ParseKeys(&l.Keys)
rawRoot := t.parseRoot(l.Root)
var err error
t.ListStorage, err = storage.NewInMemoryACLListStorage(rawRoot.Id, []*aclrecordproto.RawACLRecordWithId{rawRoot})
t.ListStorage, err = liststorage.NewInMemoryAclListStorage(rawRoot.Id, []*aclrecordproto.RawAclRecordWithId{rawRoot})
if err != nil {
panic(err)
}
@ -109,19 +109,19 @@ func (t *ACLListStorageBuilder) Parse(l *YMLList) {
t.SetHead(prevId)
}
func (t *ACLListStorageBuilder) parseRecord(rec *Record, prevId string) *aclrecordproto.ACLRecord {
func (t *AclListStorageBuilder) parseRecord(rec *Record, prevId string) *aclrecordproto.AclRecord {
k := t.keychain.GetKey(rec.ReadKey).(*SymKey)
var aclChangeContents []*aclrecordproto.ACLContentValue
var aclChangeContents []*aclrecordproto.AclContentValue
for _, ch := range rec.AclChanges {
aclChangeContent := t.parseACLChange(ch)
aclChangeContent := t.parseAclChange(ch)
aclChangeContents = append(aclChangeContents, aclChangeContent)
}
data := &aclrecordproto.ACLData{
data := &aclrecordproto.AclData{
AclContent: aclChangeContents,
}
bytes, _ := data.Marshal()
return &aclrecordproto.ACLRecord{
return &aclrecordproto.AclRecord{
PrevId: prevId,
Identity: []byte(t.keychain.GetIdentity(rec.Identity)),
Data: bytes,
@ -130,7 +130,7 @@ func (t *ACLListStorageBuilder) parseRecord(rec *Record, prevId string) *aclreco
}
}
func (t *ACLListStorageBuilder) parseACLChange(ch *ACLChange) (convCh *aclrecordproto.ACLContentValue) {
func (t *AclListStorageBuilder) parseAclChange(ch *AclChange) (convCh *aclrecordproto.AclContentValue) {
switch {
case ch.UserAdd != nil:
add := ch.UserAdd
@ -138,9 +138,9 @@ func (t *ACLListStorageBuilder) parseACLChange(ch *ACLChange) (convCh *aclrecord
encKey := t.keychain.GetKey(add.EncryptionKey).(encryptionkey.PrivKey)
rawKey, _ := encKey.GetPublic().Raw()
convCh = &aclrecordproto.ACLContentValue{
Value: &aclrecordproto.ACLContentValue_UserAdd{
UserAdd: &aclrecordproto.ACLUserAdd{
convCh = &aclrecordproto.AclContentValue{
Value: &aclrecordproto.AclContentValue_UserAdd{
UserAdd: &aclrecordproto.AclUserAdd{
Identity: []byte(t.keychain.GetIdentity(add.Identity)),
EncryptionKey: rawKey,
EncryptedReadKeys: t.encryptReadKeysWithPubKey(add.EncryptedReadKeys, encKey),
@ -162,9 +162,9 @@ func (t *ACLListStorageBuilder) parseACLChange(ch *ACLChange) (convCh *aclrecord
}
acceptPubKey, _ := signKey.GetPublic().Raw()
convCh = &aclrecordproto.ACLContentValue{
Value: &aclrecordproto.ACLContentValue_UserJoin{
UserJoin: &aclrecordproto.ACLUserJoin{
convCh = &aclrecordproto.AclContentValue{
Value: &aclrecordproto.AclContentValue_UserJoin{
UserJoin: &aclrecordproto.AclUserJoin{
Identity: []byte(t.keychain.GetIdentity(join.Identity)),
EncryptionKey: rawKey,
AcceptSignature: signature,
@ -179,9 +179,9 @@ func (t *ACLListStorageBuilder) parseACLChange(ch *ACLChange) (convCh *aclrecord
hash := t.keychain.GetKey(invite.EncryptionKey).(*SymKey).Hash
encKey := t.keychain.ReadKeysByHash[hash]
convCh = &aclrecordproto.ACLContentValue{
Value: &aclrecordproto.ACLContentValue_UserInvite{
UserInvite: &aclrecordproto.ACLUserInvite{
convCh = &aclrecordproto.AclContentValue{
Value: &aclrecordproto.AclContentValue_UserInvite{
UserInvite: &aclrecordproto.AclUserInvite{
AcceptPublicKey: rawAcceptKey,
EncryptSymKeyHash: hash,
EncryptedReadKeys: t.encryptReadKeysWithSymKey(invite.EncryptedReadKeys, encKey.Key),
@ -192,9 +192,9 @@ func (t *ACLListStorageBuilder) parseACLChange(ch *ACLChange) (convCh *aclrecord
case ch.UserPermissionChange != nil:
permissionChange := ch.UserPermissionChange
convCh = &aclrecordproto.ACLContentValue{
Value: &aclrecordproto.ACLContentValue_UserPermissionChange{
UserPermissionChange: &aclrecordproto.ACLUserPermissionChange{
convCh = &aclrecordproto.AclContentValue{
Value: &aclrecordproto.AclContentValue_UserPermissionChange{
UserPermissionChange: &aclrecordproto.AclUserPermissionChange{
Identity: []byte(t.keychain.GetIdentity(permissionChange.Identity)),
Permissions: t.convertPermission(permissionChange.Permission),
},
@ -205,7 +205,7 @@ func (t *ACLListStorageBuilder) parseACLChange(ch *ACLChange) (convCh *aclrecord
newReadKey := t.keychain.GetKey(remove.NewReadKey).(*SymKey)
var replaces []*aclrecordproto.ACLReadKeyReplace
var replaces []*aclrecordproto.AclReadKeyReplace
for _, id := range remove.IdentitiesLeft {
encKey := t.keychain.EncryptionKeysByYAMLName[id]
rawEncKey, _ := encKey.GetPublic().Raw()
@ -213,16 +213,16 @@ func (t *ACLListStorageBuilder) parseACLChange(ch *ACLChange) (convCh *aclrecord
if err != nil {
panic(err)
}
replaces = append(replaces, &aclrecordproto.ACLReadKeyReplace{
replaces = append(replaces, &aclrecordproto.AclReadKeyReplace{
Identity: []byte(t.keychain.GetIdentity(id)),
EncryptionKey: rawEncKey,
EncryptedReadKey: encReadKey,
})
}
convCh = &aclrecordproto.ACLContentValue{
Value: &aclrecordproto.ACLContentValue_UserRemove{
UserRemove: &aclrecordproto.ACLUserRemove{
convCh = &aclrecordproto.AclContentValue{
Value: &aclrecordproto.AclContentValue_UserRemove{
UserRemove: &aclrecordproto.AclUserRemove{
Identity: []byte(t.keychain.GetIdentity(remove.RemovedIdentity)),
ReadKeyReplaces: replaces,
},
@ -236,7 +236,7 @@ func (t *ACLListStorageBuilder) parseACLChange(ch *ACLChange) (convCh *aclrecord
return convCh
}
func (t *ACLListStorageBuilder) encryptReadKeysWithPubKey(keys []string, encKey encryptionkey.PrivKey) (enc [][]byte) {
func (t *AclListStorageBuilder) encryptReadKeysWithPubKey(keys []string, encKey encryptionkey.PrivKey) (enc [][]byte) {
for _, k := range keys {
realKey := t.keychain.GetKey(k).(*SymKey).Key.Bytes()
res, err := encKey.GetPublic().Encrypt(realKey)
@ -249,7 +249,7 @@ func (t *ACLListStorageBuilder) encryptReadKeysWithPubKey(keys []string, encKey
return
}
func (t *ACLListStorageBuilder) encryptReadKeysWithSymKey(keys []string, key *symmetric.Key) (enc [][]byte) {
func (t *AclListStorageBuilder) encryptReadKeysWithSymKey(keys []string, key *symmetric.Key) (enc [][]byte) {
for _, k := range keys {
realKey := t.keychain.GetKey(k).(*SymKey).Key.Bytes()
res, err := key.Encrypt(realKey)
@ -262,28 +262,28 @@ func (t *ACLListStorageBuilder) encryptReadKeysWithSymKey(keys []string, key *sy
return
}
func (t *ACLListStorageBuilder) convertPermission(perm string) aclrecordproto.ACLUserPermissions {
func (t *AclListStorageBuilder) convertPermission(perm string) aclrecordproto.AclUserPermissions {
switch perm {
case "admin":
return aclrecordproto.ACLUserPermissions_Admin
return aclrecordproto.AclUserPermissions_Admin
case "writer":
return aclrecordproto.ACLUserPermissions_Writer
return aclrecordproto.AclUserPermissions_Writer
case "reader":
return aclrecordproto.ACLUserPermissions_Reader
return aclrecordproto.AclUserPermissions_Reader
default:
panic(fmt.Sprintf("incorrect permission: %s", perm))
}
}
func (t *ACLListStorageBuilder) traverseFromHead(f func(rec *aclrecordproto.ACLRecord, id string) error) (err error) {
func (t *AclListStorageBuilder) traverseFromHead(f func(rec *aclrecordproto.AclRecord, id string) error) (err error) {
panic("this was removed, add if needed")
}
func (t *ACLListStorageBuilder) parseRoot(root *Root) (rawRoot *aclrecordproto.RawACLRecordWithId) {
func (t *AclListStorageBuilder) parseRoot(root *Root) (rawRoot *aclrecordproto.RawAclRecordWithId) {
rawSignKey, _ := t.keychain.SigningKeysByYAMLName[root.Identity].GetPublic().Raw()
rawEncKey, _ := t.keychain.EncryptionKeysByYAMLName[root.Identity].GetPublic().Raw()
readKey := t.keychain.ReadKeysByYAMLName[root.Identity]
aclRoot := &aclrecordproto.ACLRoot{
aclRoot := &aclrecordproto.AclRoot{
Identity: rawSignKey,
EncryptionKey: rawEncKey,
SpaceId: root.SpaceId,

View File

@ -6,6 +6,6 @@ package acllistbuilder
import "fmt"
func (t *ACLListStorageBuilder) Graph() (string, error) {
func (t *AclListStorageBuilder) Graph() (string, error) {
return "", fmt.Errorf("building graphs is not supported")
}

View File

@ -9,7 +9,7 @@ package acllistbuilder
import (
"fmt"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/aclrecordproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
"github.com/gogo/protobuf/proto"
"strings"
"unicode"
@ -25,18 +25,18 @@ type EdgeParameters struct {
label string
}
func (t *ACLListStorageBuilder) Graph() (string, error) {
func (t *AclListStorageBuilder) Graph() (string, error) {
// TODO: check updates on https://github.com/goccy/go-graphviz/issues/52 or make a fix yourself to use better library here
graph := gographviz.NewGraph()
graph.SetName("G")
graph.SetDir(true)
var nodes = make(map[string]struct{})
var addNodes = func(r *aclrecordproto.ACLRecord, id string) error {
var addNodes = func(r *aclrecordproto.AclRecord, id string) error {
style := "solid"
var chSymbs []string
aclData := &aclrecordproto.ACLData{}
aclData := &aclrecordproto.AclData{}
err := proto.Unmarshal(r.GetData(), aclData)
if err != nil {
return err
@ -44,7 +44,7 @@ func (t *ACLListStorageBuilder) Graph() (string, error) {
for _, chc := range aclData.AclContent {
tp := fmt.Sprintf("%T", chc.Value)
tp = strings.Replace(tp, "ACLChangeACLContentValueValueOf", "", 1)
tp = strings.Replace(tp, "AclChangeAclContentValueValueOf", "", 1)
res := ""
for _, ts := range tp {
if unicode.IsUpper(ts) {
@ -91,7 +91,7 @@ func (t *ACLListStorageBuilder) Graph() (string, error) {
return nil
}
var addLinks = func(r *aclrecordproto.ACLRecord, id string) error {
var addLinks = func(r *aclrecordproto.AclRecord, id string) error {
if r.PrevId == "" {
return nil
}

View File

@ -12,7 +12,7 @@ type Keys struct {
Read []*Key `yaml:"Read"`
}
type ACLChange struct {
type AclChange struct {
UserAdd *struct {
Identity string `yaml:"identity"`
EncryptionKey string `yaml:"encryptionKey"`
@ -48,7 +48,7 @@ type ACLChange struct {
type Record struct {
Identity string `yaml:"identity"`
AclChanges []*ACLChange `yaml:"aclChanges"`
AclChanges []*AclChange `yaml:"aclChanges"`
ReadKey string `yaml:"readKey"`
}

View File

@ -0,0 +1,28 @@
package keychain
import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/signingkey"
)
type Keychain struct {
keys map[string]signingkey.PubKey
}
func NewKeychain() *Keychain {
return &Keychain{
keys: make(map[string]signingkey.PubKey),
}
}
func (k *Keychain) GetOrAdd(identity string) (signingkey.PubKey, error) {
if key, exists := k.keys[identity]; exists {
return key, nil
}
res, err := signingkey.NewSigningEd25519PubKeyFromBytes([]byte(identity))
if err != nil {
return nil, err
}
k.keys[identity] = res.(signingkey.PubKey)
return res.(signingkey.PubKey), nil
}

View File

@ -0,0 +1,14 @@
package syncobjectgetter
import (
"context"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/objectsync/synchandler"
)
type SyncObject interface {
synchandler.SyncHandler
}
type SyncObjectGetter interface {
GetObject(ctx context.Context, objectId string) (SyncObject, error)
}

View File

@ -1,13 +1,13 @@
package tree
package objecttree
import (
"errors"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/treechangeproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treechangeproto"
)
var (
ErrIncorrectSignature = errors.New("change has incorrect signature")
ErrIncorrectCID = errors.New("change has incorrect CID")
ErrIncorrectCid = errors.New("change has incorrect CID")
)
// Change is an abstract type for all types of changes
@ -58,6 +58,6 @@ func NewChangeFromRoot(id string, ch *treechangeproto.RootChange, signature []by
}
}
func (ch *Change) CID() string {
func (ch *Change) Cid() string {
return ch.Id
}

View File

@ -1,10 +1,10 @@
package tree
package objecttree
import (
"errors"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/common"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/treechangeproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/cid"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/keychain"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treechangeproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/cidutil"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/signingkey"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/symmetric"
"github.com/gogo/protobuf/proto"
@ -45,10 +45,10 @@ type ChangeBuilder interface {
type changeBuilder struct {
rootChange *treechangeproto.RawTreeChangeWithId
keys *common.Keychain
keys *keychain.Keychain
}
func NewChangeBuilder(keys *common.Keychain, rootChange *treechangeproto.RawTreeChangeWithId) ChangeBuilder {
func NewChangeBuilder(keys *keychain.Keychain, rootChange *treechangeproto.RawTreeChangeWithId) ChangeBuilder {
return &changeBuilder{keys: keys, rootChange: rootChange}
}
@ -60,8 +60,8 @@ func (c *changeBuilder) ConvertFromRaw(rawIdChange *treechangeproto.RawTreeChang
if verify {
// verifying ID
if !cid.VerifyCID(rawIdChange.RawChange, rawIdChange.Id) {
err = ErrIncorrectCID
if !cidutil.VerifyCid(rawIdChange.RawChange, rawIdChange.Id) {
err = ErrIncorrectCid
return
}
}
@ -131,7 +131,7 @@ func (c *changeBuilder) BuildInitialContent(payload InitialContent) (ch *Change,
return
}
id, err := cid.NewCIDFromBytes(marshalledRawChange)
id, err := cidutil.NewCidFromBytes(marshalledRawChange)
if err != nil {
return
}
@ -186,7 +186,7 @@ func (c *changeBuilder) BuildContent(payload BuilderContent) (ch *Change, rawIdC
return
}
id, err := cid.NewCIDFromBytes(marshalledRawChange)
id, err := cidutil.NewCidFromBytes(marshalledRawChange)
if err != nil {
return
}

View File

@ -1,16 +1,16 @@
package tree
package objecttree
import (
"fmt"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/aclrecordproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/list"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/list"
)
type ObjectTreeValidator interface {
// ValidateFullTree should always be entered while holding a read lock on ACLList
ValidateFullTree(tree *Tree, aclList list.ACLList) error
// ValidateNewChanges should always be entered while holding a read lock on ACLList
ValidateNewChanges(tree *Tree, aclList list.ACLList, newChanges []*Change) error
// ValidateFullTree should always be entered while holding a read lock on AclList
ValidateFullTree(tree *Tree, aclList list.AclList) error
// ValidateNewChanges should always be entered while holding a read lock on AclList
ValidateNewChanges(tree *Tree, aclList list.AclList, newChanges []*Change) error
}
type objectTreeValidator struct{}
@ -19,7 +19,7 @@ func newTreeValidator() ObjectTreeValidator {
return &objectTreeValidator{}
}
func (v *objectTreeValidator) ValidateFullTree(tree *Tree, aclList list.ACLList) (err error) {
func (v *objectTreeValidator) ValidateFullTree(tree *Tree, aclList list.AclList) (err error) {
tree.Iterate(tree.RootId(), func(c *Change) (isContinue bool) {
err = v.validateChange(tree, aclList, c)
return err == nil
@ -27,7 +27,7 @@ func (v *objectTreeValidator) ValidateFullTree(tree *Tree, aclList list.ACLList)
return err
}
func (v *objectTreeValidator) ValidateNewChanges(tree *Tree, aclList list.ACLList, newChanges []*Change) (err error) {
func (v *objectTreeValidator) ValidateNewChanges(tree *Tree, aclList list.AclList, newChanges []*Change) (err error) {
for _, c := range newChanges {
err = v.validateChange(tree, aclList, c)
if err != nil {
@ -37,10 +37,10 @@ func (v *objectTreeValidator) ValidateNewChanges(tree *Tree, aclList list.ACLLis
return
}
func (v *objectTreeValidator) validateChange(tree *Tree, aclList list.ACLList, c *Change) (err error) {
func (v *objectTreeValidator) validateChange(tree *Tree, aclList list.AclList, c *Change) (err error) {
var (
perm list.UserPermissionPair
state = aclList.ACLState()
state = aclList.AclState()
)
// checking if the user could write
perm, err = state.PermissionsAtRecord(c.AclHeadId, c.Identity)
@ -48,7 +48,7 @@ func (v *objectTreeValidator) validateChange(tree *Tree, aclList list.ACLList, c
return
}
if perm.Permission != aclrecordproto.ACLUserPermissions_Writer && perm.Permission != aclrecordproto.ACLUserPermissions_Admin {
if perm.Permission != aclrecordproto.AclUserPermissions_Writer && perm.Permission != aclrecordproto.AclUserPermissions_Admin {
err = list.ErrInsufficientPermissions
return
}

View File

@ -1,4 +1,4 @@
package tree
package objecttree
type DescriptionParser interface {
ParseChange(*Change) ([]string, error)

View File

@ -1,16 +1,16 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/tree (interfaces: ObjectTree)
// Source: github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/objecttree (interfaces: ObjectTree)
// Package mock_tree is a generated GoMock package.
package mock_tree
// Package mock_objecttree is a generated GoMock package.
package mock_objecttree
import (
context "context"
reflect "reflect"
storage "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage"
tree "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/tree"
treechangeproto "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/treechangeproto"
objecttree "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/objecttree"
treechangeproto "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treechangeproto"
treestorage "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treestorage"
gomock "github.com/golang/mock/gomock"
)
@ -38,10 +38,10 @@ func (m *MockObjectTree) EXPECT() *MockObjectTreeMockRecorder {
}
// AddContent mocks base method.
func (m *MockObjectTree) AddContent(arg0 context.Context, arg1 tree.SignableChangeContent) (tree.AddResult, error) {
func (m *MockObjectTree) AddContent(arg0 context.Context, arg1 objecttree.SignableChangeContent) (objecttree.AddResult, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AddContent", arg0, arg1)
ret0, _ := ret[0].(tree.AddResult)
ret0, _ := ret[0].(objecttree.AddResult)
ret1, _ := ret[1].(error)
return ret0, ret1
}
@ -53,10 +53,10 @@ func (mr *MockObjectTreeMockRecorder) AddContent(arg0, arg1 interface{}) *gomock
}
// AddRawChanges mocks base method.
func (m *MockObjectTree) AddRawChanges(arg0 context.Context, arg1 tree.RawChangesPayload) (tree.AddResult, error) {
func (m *MockObjectTree) AddRawChanges(arg0 context.Context, arg1 objecttree.RawChangesPayload) (objecttree.AddResult, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AddRawChanges", arg0, arg1)
ret0, _ := ret[0].(tree.AddResult)
ret0, _ := ret[0].(objecttree.AddResult)
ret1, _ := ret[1].(error)
return ret0, ret1
}
@ -171,22 +171,22 @@ func (mr *MockObjectTreeMockRecorder) Heads() *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Heads", reflect.TypeOf((*MockObjectTree)(nil).Heads))
}
// ID mocks base method.
func (m *MockObjectTree) ID() string {
// Id mocks base method.
func (m *MockObjectTree) Id() string {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ID")
ret := m.ctrl.Call(m, "Id")
ret0, _ := ret[0].(string)
return ret0
}
// ID indicates an expected call of ID.
func (mr *MockObjectTreeMockRecorder) ID() *gomock.Call {
// Id indicates an expected call of Id.
func (mr *MockObjectTreeMockRecorder) Id() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ID", reflect.TypeOf((*MockObjectTree)(nil).ID))
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Id", reflect.TypeOf((*MockObjectTree)(nil).Id))
}
// Iterate mocks base method.
func (m *MockObjectTree) Iterate(arg0 func([]byte) (interface{}, error), arg1 func(*tree.Change) bool) error {
func (m *MockObjectTree) Iterate(arg0 func([]byte) (interface{}, error), arg1 func(*objecttree.Change) bool) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Iterate", arg0, arg1)
ret0, _ := ret[0].(error)
@ -200,7 +200,7 @@ func (mr *MockObjectTreeMockRecorder) Iterate(arg0, arg1 interface{}) *gomock.Ca
}
// IterateFrom mocks base method.
func (m *MockObjectTree) IterateFrom(arg0 string, arg1 func([]byte) (interface{}, error), arg2 func(*tree.Change) bool) error {
func (m *MockObjectTree) IterateFrom(arg0 string, arg1 func([]byte) (interface{}, error), arg2 func(*objecttree.Change) bool) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "IterateFrom", arg0, arg1, arg2)
ret0, _ := ret[0].(error)
@ -250,10 +250,10 @@ func (mr *MockObjectTreeMockRecorder) RUnlock() *gomock.Call {
}
// Root mocks base method.
func (m *MockObjectTree) Root() *tree.Change {
func (m *MockObjectTree) Root() *objecttree.Change {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Root")
ret0, _ := ret[0].(*tree.Change)
ret0, _ := ret[0].(*objecttree.Change)
return ret0
}
@ -278,10 +278,10 @@ func (mr *MockObjectTreeMockRecorder) SnapshotPath() *gomock.Call {
}
// Storage mocks base method.
func (m *MockObjectTree) Storage() storage.TreeStorage {
func (m *MockObjectTree) Storage() treestorage.TreeStorage {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Storage")
ret0, _ := ret[0].(storage.TreeStorage)
ret0, _ := ret[0].(treestorage.TreeStorage)
return ret0
}

View File

@ -1,14 +1,14 @@
//go:generate mockgen -destination mock_objecttree/mock_objecttree.go github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/tree ObjectTree
package tree
//go:generate mockgen -destination mock_objecttree/mock_objecttree.go github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/objecttree ObjectTree
package objecttree
import (
"context"
"errors"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/aclrecordproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/common"
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/commonspace/object/acl/aclrecordproto"
list2 "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/list"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/keychain"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treechangeproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treestorage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/symmetric"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/slice"
"sync"
@ -46,7 +46,7 @@ type ChangeConvertFunc = func(decrypted []byte) (any, error)
type ObjectTree interface {
RWLocker
ID() string
Id() string
Header() *treechangeproto.RawTreeChangeWithId
Heads() []string
Root() *Change
@ -59,7 +59,7 @@ type ObjectTree interface {
SnapshotPath() []string
ChangesAfterCommonSnapshot(snapshotPath, heads []string) ([]*treechangeproto.RawTreeChangeWithId, error)
Storage() storage.TreeStorage
Storage() treestorage.TreeStorage
AddContent(ctx context.Context, content SignableChangeContent) (AddResult, error)
AddRawChanges(ctx context.Context, changes RawChangesPayload) (AddResult, error)
@ -69,12 +69,12 @@ type ObjectTree interface {
}
type objectTree struct {
treeStorage storage.TreeStorage
treeStorage treestorage.TreeStorage
changeBuilder ChangeBuilder
validator ObjectTreeValidator
rawChangeLoader *rawChangeLoader
treeBuilder *treeBuilder
aclList list.ACLList
aclList list2.AclList
id string
root *treechangeproto.RawTreeChangeWithId
@ -96,18 +96,18 @@ type objectTree struct {
type objectTreeDeps struct {
changeBuilder ChangeBuilder
treeBuilder *treeBuilder
treeStorage storage.TreeStorage
treeStorage treestorage.TreeStorage
validator ObjectTreeValidator
rawChangeLoader *rawChangeLoader
aclList list.ACLList
aclList list2.AclList
}
func defaultObjectTreeDeps(
rootChange *treechangeproto.RawTreeChangeWithId,
treeStorage storage.TreeStorage,
aclList list.ACLList) objectTreeDeps {
treeStorage treestorage.TreeStorage,
aclList list2.AclList) objectTreeDeps {
keychain := common.NewKeychain()
keychain := keychain.NewKeychain()
changeBuilder := NewChangeBuilder(keychain, rootChange)
treeBuilder := newTreeBuilder(treeStorage, changeBuilder)
return objectTreeDeps{
@ -137,7 +137,7 @@ func (ot *objectTree) rebuildFromStorage(theirHeads []string, newChanges []*Chan
return ot.validateTree(nil)
}
func (ot *objectTree) ID() string {
func (ot *objectTree) Id() string {
return ot.id
}
@ -145,7 +145,7 @@ func (ot *objectTree) Header() *treechangeproto.RawTreeChangeWithId {
return ot.root
}
func (ot *objectTree) Storage() storage.TreeStorage {
func (ot *objectTree) Storage() treestorage.TreeStorage {
return ot.treeStorage
}
@ -195,14 +195,14 @@ func (ot *objectTree) prepareBuilderContent(content SignableChangeContent) (cnt
defer ot.aclList.RUnlock()
var (
state = ot.aclList.ACLState() // special method for own keys
state = ot.aclList.AclState() // special method for own keys
readKey *symmetric.Key
readKeyHash uint64
)
canWrite := state.HasPermission(content.Identity, aclrecordproto.ACLUserPermissions_Writer) ||
state.HasPermission(content.Identity, aclrecordproto.ACLUserPermissions_Admin)
canWrite := state.HasPermission(content.Identity, aclrecordproto.AclUserPermissions_Writer) ||
state.HasPermission(content.Identity, aclrecordproto.AclUserPermissions_Admin)
if !canWrite {
err = list.ErrInsufficientPermissions
err = list2.ErrInsufficientPermissions
return
}
@ -469,7 +469,7 @@ func (ot *objectTree) IterateFrom(id string, convert ChangeConvertFunc, iterate
}
readKey, exists := ot.keys[c.ReadKeyHash]
if !exists {
err = list.ErrNoReadKey
err = list2.ErrNoReadKey
return
}
@ -606,7 +606,7 @@ func (ot *objectTree) snapshotPathIsActual() bool {
func (ot *objectTree) validateTree(newChanges []*Change) error {
ot.aclList.RLock()
defer ot.aclList.RUnlock()
state := ot.aclList.ACLState()
state := ot.aclList.AclState()
// just not to take lock many times, updating the key map from aclList
if len(ot.keys) != len(state.UserReadKeys()) {

View File

@ -1,11 +1,11 @@
package tree
package objecttree
import (
"context"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/list"
storage "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/testutils/acllistbuilder"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/treechangeproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/list"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/testutils/acllistbuilder"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treechangeproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treestorage"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"testing"
@ -53,9 +53,9 @@ func (c *mockChangeCreator) createRaw(id, aclId, snapshotId string, isSnapshot b
}
}
func (c *mockChangeCreator) createNewTreeStorage(treeId, aclHeadId string) storage.TreeStorage {
func (c *mockChangeCreator) createNewTreeStorage(treeId, aclHeadId string) treestorage.TreeStorage {
root := c.createRoot(treeId, aclHeadId)
treeStorage, _ := storage.NewInMemoryTreeStorage(root, []string{root.Id}, []*treechangeproto.RawTreeChangeWithId{root})
treeStorage, _ := treestorage.NewInMemoryTreeStorage(root, []string{root.Id}, []*treechangeproto.RawTreeChangeWithId{root})
return treeStorage
}
@ -85,33 +85,33 @@ func (c *mockChangeBuilder) BuildRaw(ch *Change) (raw *treechangeproto.RawTreeCh
type mockChangeValidator struct{}
func (m *mockChangeValidator) ValidateNewChanges(tree *Tree, aclList list.ACLList, newChanges []*Change) error {
func (m *mockChangeValidator) ValidateNewChanges(tree *Tree, aclList list.AclList, newChanges []*Change) error {
return nil
}
func (m *mockChangeValidator) ValidateFullTree(tree *Tree, aclList list.ACLList) error {
func (m *mockChangeValidator) ValidateFullTree(tree *Tree, aclList list.AclList) error {
return nil
}
type testTreeContext struct {
aclList list.ACLList
treeStorage storage.TreeStorage
aclList list.AclList
treeStorage treestorage.TreeStorage
changeBuilder *mockChangeBuilder
changeCreator *mockChangeCreator
objTree ObjectTree
}
func prepareACLList(t *testing.T) list.ACLList {
func prepareAclList(t *testing.T) list.AclList {
st, err := acllistbuilder.NewListStorageWithTestName("userjoinexample.yml")
require.NoError(t, err, "building storage should not result in error")
aclList, err := list.BuildACLList(st)
aclList, err := list.BuildAclList(st)
require.NoError(t, err, "building acl list should be without error")
return aclList
}
func prepareTreeContext(t *testing.T, aclList list.ACLList) testTreeContext {
func prepareTreeContext(t *testing.T, aclList list.AclList) testTreeContext {
changeCreator := &mockChangeCreator{}
treeStorage := changeCreator.createNewTreeStorage("0", aclList.Head().Id)
root, _ := treeStorage.Root()
@ -149,7 +149,7 @@ func prepareTreeContext(t *testing.T, aclList list.ACLList) testTreeContext {
}
func TestObjectTree(t *testing.T) {
aclList := prepareACLList(t)
aclList := prepareAclList(t)
t.Run("add simple", func(t *testing.T) {
ctx := prepareTreeContext(t, aclList)

View File

@ -1,10 +1,10 @@
package tree
package objecttree
import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/common"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/list"
storage "github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/treechangeproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/list"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/keychain"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treechangeproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treestorage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/signingkey"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/symmetric"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/slice"
@ -21,7 +21,7 @@ type ObjectTreeCreatePayload struct {
IsEncrypted bool
}
func BuildObjectTree(treeStorage storage.TreeStorage, aclList list.ACLList) (ObjectTree, error) {
func BuildObjectTree(treeStorage treestorage.TreeStorage, aclList list.AclList) (ObjectTree, error) {
rootChange, err := treeStorage.Root()
if err != nil {
return nil, err
@ -32,15 +32,15 @@ func BuildObjectTree(treeStorage storage.TreeStorage, aclList list.ACLList) (Obj
func CreateDerivedObjectTree(
payload ObjectTreeCreatePayload,
aclList list.ACLList,
createStorage storage.TreeStorageCreatorFunc) (objTree ObjectTree, err error) {
aclList list.AclList,
createStorage treestorage.TreeStorageCreatorFunc) (objTree ObjectTree, err error) {
return createObjectTree(payload, 0, nil, aclList, createStorage)
}
func CreateObjectTree(
payload ObjectTreeCreatePayload,
aclList list.ACLList,
createStorage storage.TreeStorageCreatorFunc) (objTree ObjectTree, err error) {
aclList list.AclList,
createStorage treestorage.TreeStorageCreatorFunc) (objTree ObjectTree, err error) {
bytes := make([]byte, 32)
_, err = rand.Read(bytes)
if err != nil {
@ -53,8 +53,8 @@ func createObjectTree(
payload ObjectTreeCreatePayload,
timestamp int64,
seed []byte,
aclList list.ACLList,
createStorage storage.TreeStorageCreatorFunc) (objTree ObjectTree, err error) {
aclList list.AclList,
createStorage treestorage.TreeStorageCreatorFunc) (objTree ObjectTree, err error) {
aclList.RLock()
aclHeadId := aclList.Head().Id
aclList.RUnlock()
@ -72,13 +72,13 @@ func createObjectTree(
Seed: seed,
}
_, raw, err := NewChangeBuilder(common.NewKeychain(), nil).BuildInitialContent(cnt)
_, raw, err := NewChangeBuilder(keychain.NewKeychain(), nil).BuildInitialContent(cnt)
if err != nil {
return
}
// create storage
st, err := createStorage(storage.TreeStorageCreatePayload{
st, err := createStorage(treestorage.TreeStorageCreatePayload{
RootRawChange: raw,
Changes: []*treechangeproto.RawTreeChangeWithId{raw},
Heads: []string{raw.Id},

View File

@ -1,15 +1,15 @@
package tree
package objecttree
import (
"context"
"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/commonspace/object/tree/treechangeproto"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treestorage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/slice"
"time"
)
type rawChangeLoader struct {
treeStorage storage.TreeStorage
treeStorage treestorage.TreeStorage
changeBuilder ChangeBuilder
// buffers
@ -23,7 +23,7 @@ type rawCacheEntry struct {
position int
}
func newRawChangeLoader(treeStorage storage.TreeStorage, changeBuilder ChangeBuilder) *rawChangeLoader {
func newRawChangeLoader(treeStorage treestorage.TreeStorage, changeBuilder ChangeBuilder) *rawChangeLoader {
return &rawChangeLoader{
treeStorage: treeStorage,
changeBuilder: changeBuilder,

View File

@ -0,0 +1,17 @@
package objecttree
import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/list"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treestorage"
)
func ValidateRawTree(payload treestorage.TreeStorageCreatePayload, aclList list.AclList) (err error) {
provider := treestorage.NewInMemoryTreeStorageProvider()
treeStorage, err := provider.CreateTreeStorage(payload)
if err != nil {
return
}
_, err = BuildObjectTree(treeStorage, aclList)
return
}

View File

@ -1,4 +1,4 @@
package tree
package objecttree
import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/signingkey"

View File

@ -1,4 +1,4 @@
package tree
package objecttree
import (
"bytes"

View File

@ -1,4 +1,4 @@
package tree
package objecttree
import (
"fmt"

View File

@ -1,11 +1,11 @@
package tree
package objecttree
import (
"context"
"errors"
"fmt"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/logger"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/pkg/acl/storage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treestorage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/slice"
"go.uber.org/zap"
"time"
@ -17,7 +17,7 @@ var (
)
type treeBuilder struct {
treeStorage storage.TreeStorage
treeStorage treestorage.TreeStorage
builder ChangeBuilder
cache map[string]*Change
@ -28,7 +28,7 @@ type treeBuilder struct {
loadBuffer []*Change
}
func newTreeBuilder(storage storage.TreeStorage, builder ChangeBuilder) *treeBuilder {
func newTreeBuilder(storage treestorage.TreeStorage, builder ChangeBuilder) *treeBuilder {
return &treeBuilder{
treeStorage: storage,
builder: builder,

View File

@ -2,7 +2,7 @@
// +build !linux,!darwin android ios nographviz
// +build !amd64
package tree
package objecttree
import "fmt"

View File

@ -5,7 +5,7 @@
// +build !nographviz
// +build amd64 arm64
package tree
package objecttree
import (
"bytes"

View File

@ -1,4 +1,4 @@
package tree
package objecttree
import (
"sync"

View File

@ -1,4 +1,4 @@
package tree
package objecttree
import "math"

Some files were not shown because too many files have changed in this diff Show More