mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-07 21:47:02 +09:00
make common module as any-sync repo
This commit is contained in:
parent
aac5b3e83c
commit
596a315c5f
320 changed files with 453 additions and 29202 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -8,11 +8,6 @@
|
||||||
# Test binary, built with `go test -c`
|
# Test binary, built with `go test -c`
|
||||||
*.test
|
*.test
|
||||||
|
|
||||||
# playground/tmp folder for testing different clients
|
|
||||||
playground/tmp
|
|
||||||
playground/debug.json
|
|
||||||
debug.json
|
|
||||||
|
|
||||||
# .paw folder for macos paw client
|
# .paw folder for macos paw client
|
||||||
.paw
|
.paw
|
||||||
|
|
||||||
|
|
39
Makefile
39
Makefile
|
@ -1,31 +1,20 @@
|
||||||
|
.PHONY: proto test
|
||||||
export GOPRIVATE=github.com/anytypeio
|
export GOPRIVATE=github.com/anytypeio
|
||||||
|
|
||||||
ifndef $(GOPATH)
|
|
||||||
GOPATH=$(shell go env GOPATH)
|
|
||||||
export GOPATH
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef $(GOROOT)
|
|
||||||
GOROOT=$(shell go env GOROOT)
|
|
||||||
export GOROOT
|
|
||||||
endif
|
|
||||||
|
|
||||||
export PATH=$(GOPATH)/bin:$(shell echo $$PATH)
|
|
||||||
|
|
||||||
proto:
|
proto:
|
||||||
$(MAKE) -C common proto
|
@echo 'Generating protobuf packages (Go)...'
|
||||||
$(MAKE) -C consensus proto
|
|
||||||
$(MAKE) -C client proto
|
|
||||||
|
|
||||||
build:
|
@$(eval GOGO_START := GOGO_NO_UNDERSCORE=1 GOGO_EXPORT_ONEOF_INTERFACE=1)
|
||||||
$(MAKE) -C node build
|
@$(eval P_ACL_RECORDS_PATH_PB := commonspace/object/acl/aclrecordproto)
|
||||||
$(MAKE) -C filenode build
|
@$(eval P_TREE_CHANGES_PATH_PB := commonspace/object/tree/treechangeproto)
|
||||||
$(MAKE) -C consensus build
|
@$(eval P_ACL_RECORDS := M$(P_ACL_RECORDS_PATH_PB)/protos/aclrecord.proto=github.com/anytypeio/any-sync/$(P_ACL_RECORDS_PATH_PB))
|
||||||
$(MAKE) -C client build
|
@$(eval P_TREE_CHANGES := M$(P_TREE_CHANGES_PATH_PB)/protos/treechange.proto=github.com/anytypeio/any-sync/$(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
|
||||||
|
$(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:
|
test:
|
||||||
$(MAKE) -C node test
|
go test ./... --cover
|
||||||
$(MAKE) -C filenode test
|
|
||||||
$(MAKE) -C consensus test
|
|
||||||
$(MAKE) -C common test
|
|
||||||
$(MAKE) -C client test
|
|
12
README.md
12
README.md
|
@ -1,12 +0,0 @@
|
||||||
# go-anytype-infrastructure-experiments
|
|
||||||
This repository will have the code for new infrastructure client and node prototypes
|
|
||||||
|
|
||||||
## Project structure
|
|
||||||
- **app** - DI, loggers, common engine
|
|
||||||
- **bin** - contains compiled binaries (under gitignore)
|
|
||||||
- **cmd** - main files by directories
|
|
||||||
- **config** - config component
|
|
||||||
- **etc** - default/example config files, keys, etc
|
|
||||||
- **service** - services, runtime components (these packages can use code from everywhere)
|
|
||||||
- **pkg** - some static packages that can be able to move to a separate repo, dependencies of these packages limited to this folder (maybe util)
|
|
||||||
- **util** - helpers
|
|
|
@ -1,9 +1,9 @@
|
||||||
//go:generate mockgen -destination mock_accountservice/mock_accountservice.go github.com/anytypeio/go-anytype-infrastructure-experiments/common/accountservice Service
|
//go:generate mockgen -destination mock_accountservice/mock_accountservice.go github.com/anytypeio/any-sync/accountservice Service
|
||||||
package accountservice
|
package accountservice
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app"
|
"github.com/anytypeio/any-sync/app"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/accountdata"
|
"github.com/anytypeio/any-sync/commonspace/object/accountdata"
|
||||||
)
|
)
|
||||||
|
|
||||||
const CName = "common.accountservice"
|
const CName = "common.accountservice"
|
|
@ -1,8 +1,8 @@
|
||||||
package mock_accountservice
|
package mock_accountservice
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/accountservice"
|
"github.com/anytypeio/any-sync/accountservice"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/accountdata"
|
"github.com/anytypeio/any-sync/commonspace/object/accountdata"
|
||||||
"github.com/golang/mock/gomock"
|
"github.com/golang/mock/gomock"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Code generated by MockGen. DO NOT EDIT.
|
// Code generated by MockGen. DO NOT EDIT.
|
||||||
// Source: github.com/anytypeio/go-anytype-infrastructure-experiments/common/accountservice (interfaces: Service)
|
// Source: github.com/anytypeio/any-sync/accountservice (interfaces: Service)
|
||||||
|
|
||||||
// Package mock_accountservice is a generated GoMock package.
|
// Package mock_accountservice is a generated GoMock package.
|
||||||
package mock_accountservice
|
package mock_accountservice
|
||||||
|
@ -7,8 +7,8 @@ package mock_accountservice
|
||||||
import (
|
import (
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
|
|
||||||
app "github.com/anytypeio/go-anytype-infrastructure-experiments/common/app"
|
app "github.com/anytypeio/any-sync/app"
|
||||||
accountdata "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/accountdata"
|
accountdata "github.com/anytypeio/any-sync/commonspace/object/accountdata"
|
||||||
gomock "github.com/golang/mock/gomock"
|
gomock "github.com/golang/mock/gomock"
|
||||||
)
|
)
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/logger"
|
"github.com/anytypeio/any-sync/app/logger"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
|
@ -1,7 +1,7 @@
|
||||||
// Package ldiff provides a container of elements with fixed id and changeable content.
|
// Package ldiff provides a container of elements with fixed id and changeable content.
|
||||||
// Diff can calculate the difference with another diff container (you can make it remote) with minimum hops and traffic.
|
// Diff can calculate the difference with another diff container (you can make it remote) with minimum hops and traffic.
|
||||||
//
|
//
|
||||||
//go:generate mockgen -destination mock_ldiff/mock_ldiff.go github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/ldiff Diff,Remote
|
//go:generate mockgen -destination mock_ldiff/mock_ldiff.go github.com/anytypeio/any-sync/app/ldiff Diff,Remote
|
||||||
package ldiff
|
package ldiff
|
||||||
|
|
||||||
import (
|
import (
|
|
@ -1,5 +1,5 @@
|
||||||
// Code generated by MockGen. DO NOT EDIT.
|
// Code generated by MockGen. DO NOT EDIT.
|
||||||
// Source: github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/ldiff (interfaces: Diff,Remote)
|
// Source: github.com/anytypeio/any-sync/app/ldiff (interfaces: Diff,Remote)
|
||||||
|
|
||||||
// Package mock_ldiff is a generated GoMock package.
|
// Package mock_ldiff is a generated GoMock package.
|
||||||
package mock_ldiff
|
package mock_ldiff
|
||||||
|
@ -8,7 +8,7 @@ import (
|
||||||
context "context"
|
context "context"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
|
|
||||||
ldiff "github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/ldiff"
|
ldiff "github.com/anytypeio/any-sync/app/ldiff"
|
||||||
gomock "github.com/golang/mock/gomock"
|
gomock "github.com/golang/mock/gomock"
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,7 +3,7 @@ package ocache
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/logger"
|
"github.com/anytypeio/any-sync/app/logger"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
2
bin/.gitignore
vendored
2
bin/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
||||||
*
|
|
||||||
!.gitignore
|
|
|
@ -1,14 +0,0 @@
|
||||||
.PHONY: proto
|
|
||||||
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:. 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/anytype-client -ldflags "$(FLAGS)" github.com/anytypeio/go-anytype-infrastructure-experiments/client/cmd
|
|
||||||
|
|
||||||
test:
|
|
||||||
go test ./... --cover
|
|
|
@ -1,71 +0,0 @@
|
||||||
package account
|
|
||||||
|
|
||||||
import (
|
|
||||||
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/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 *accountdata.AccountData
|
|
||||||
peerId string
|
|
||||||
}
|
|
||||||
|
|
||||||
func New() app.Component {
|
|
||||||
return &service{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) Init(a *app.App) (err error) {
|
|
||||||
acc := a.MustComponent("config").(commonaccount.ConfigGetter).GetAccount()
|
|
||||||
|
|
||||||
decodedEncryptionKey, err := keys.DecodeKeyFromString(
|
|
||||||
acc.EncryptionKey,
|
|
||||||
encryptionkey.NewEncryptionRsaPrivKeyFromBytes,
|
|
||||||
nil)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
decodedSigningKey, err := keys.DecodeKeyFromString(
|
|
||||||
acc.SigningKey,
|
|
||||||
signingkey.NewSigningEd25519PrivKeyFromBytes,
|
|
||||||
nil)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
decodedPeerKey, err := keys.DecodeKeyFromString(
|
|
||||||
acc.PeerKey,
|
|
||||||
signingkey.NewSigningEd25519PrivKeyFromBytes,
|
|
||||||
nil)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
identity, err := decodedSigningKey.GetPublic().Raw()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
s.accountData = &accountdata.AccountData{
|
|
||||||
Identity: identity,
|
|
||||||
PeerKey: decodedPeerKey,
|
|
||||||
SignKey: decodedSigningKey,
|
|
||||||
EncKey: decodedEncryptionKey,
|
|
||||||
PeerId: acc.PeerId,
|
|
||||||
}
|
|
||||||
s.peerId = acc.PeerId
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) Name() (name string) {
|
|
||||||
return commonaccount.CName
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) Account() *accountdata.AccountData {
|
|
||||||
return s.accountData
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
package badgerprovider
|
|
||||||
|
|
||||||
type configGetter interface {
|
|
||||||
GetStorage() Config
|
|
||||||
}
|
|
||||||
|
|
||||||
type Config struct {
|
|
||||||
Path string `yaml:"path"`
|
|
||||||
}
|
|
|
@ -1,44 +0,0 @@
|
||||||
package badgerprovider
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app"
|
|
||||||
"github.com/dgraph-io/badger/v3"
|
|
||||||
)
|
|
||||||
|
|
||||||
type BadgerProvider interface {
|
|
||||||
app.ComponentRunnable
|
|
||||||
Badger() *badger.DB
|
|
||||||
}
|
|
||||||
|
|
||||||
var CName = "client.badgerprovider"
|
|
||||||
|
|
||||||
type service struct {
|
|
||||||
db *badger.DB
|
|
||||||
}
|
|
||||||
|
|
||||||
func New() BadgerProvider {
|
|
||||||
return &service{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) Init(a *app.App) (err error) {
|
|
||||||
cfg := a.MustComponent("config").(configGetter).GetStorage()
|
|
||||||
s.db, err = badger.Open(badger.DefaultOptions(cfg.Path))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) Name() (name string) {
|
|
||||||
return CName
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) Badger() *badger.DB {
|
|
||||||
return s.db
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) Run(ctx context.Context) (err error) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) Close(ctx context.Context) (err error) {
|
|
||||||
return s.db.Close()
|
|
||||||
}
|
|
|
@ -1,149 +0,0 @@
|
||||||
package clientcache
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"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/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/app/ocache"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/objecttree"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treestorage"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/treegetter"
|
|
||||||
"go.uber.org/zap"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
var log = logger.NewNamed("treecache")
|
|
||||||
var ErrCacheObjectWithoutTree = errors.New("cache object contains no tree")
|
|
||||||
|
|
||||||
type ctxKey int
|
|
||||||
|
|
||||||
const (
|
|
||||||
spaceKey ctxKey = iota
|
|
||||||
treeCreateKey
|
|
||||||
)
|
|
||||||
|
|
||||||
type treeCache struct {
|
|
||||||
gcttl int
|
|
||||||
cache ocache.OCache
|
|
||||||
account accountservice.Service
|
|
||||||
clientService clientspace.Service
|
|
||||||
}
|
|
||||||
|
|
||||||
type TreeCache interface {
|
|
||||||
treegetter.TreeGetter
|
|
||||||
GetDocument(ctx context.Context, spaceId, id string) (doc textdocument.TextDocument, err error)
|
|
||||||
CreateDocument(ctx context.Context, spaceId string, payload objecttree.ObjectTreeCreatePayload) (ot textdocument.TextDocument, err error)
|
|
||||||
}
|
|
||||||
|
|
||||||
type updateListener struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u *updateListener) Update(tree objecttree.ObjectTree) {
|
|
||||||
log.With(
|
|
||||||
zap.Strings("heads", tree.Heads()),
|
|
||||||
zap.String("tree id", tree.Id())).
|
|
||||||
Debug("updating tree")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (u *updateListener) Rebuild(tree objecttree.ObjectTree) {
|
|
||||||
log.With(
|
|
||||||
zap.Strings("heads", tree.Heads()),
|
|
||||||
zap.String("tree id", tree.Id())).
|
|
||||||
Debug("rebuilding tree")
|
|
||||||
}
|
|
||||||
|
|
||||||
func New(ttl int) TreeCache {
|
|
||||||
return &treeCache{
|
|
||||||
gcttl: ttl,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *treeCache) Run(ctx context.Context) (err error) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *treeCache) Close(ctx context.Context) (err error) {
|
|
||||||
return c.cache.Close()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *treeCache) Init(a *app.App) (err error) {
|
|
||||||
c.clientService = a.MustComponent(clientspace.CName).(clientspace.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)
|
|
||||||
space, err := c.clientService.GetSpace(ctx, spaceId)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
createPayload, exists := ctx.Value(treeCreateKey).(treestorage.TreeStorageCreatePayload)
|
|
||||||
if exists {
|
|
||||||
return textdocument.CreateTextDocument(ctx, space, createPayload, &updateListener{}, c.account)
|
|
||||||
}
|
|
||||||
return textdocument.NewTextDocument(ctx, space, id, &updateListener{}, c.account)
|
|
||||||
},
|
|
||||||
ocache.WithLogger(log.Sugar()),
|
|
||||||
ocache.WithGCPeriod(time.Minute),
|
|
||||||
ocache.WithTTL(time.Duration(c.gcttl)*time.Second),
|
|
||||||
)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *treeCache) Name() (name string) {
|
|
||||||
return treegetter.CName
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *treeCache) GetDocument(ctx context.Context, spaceId, id string) (doc textdocument.TextDocument, err error) {
|
|
||||||
ctx = context.WithValue(ctx, spaceKey, spaceId)
|
|
||||||
v, err := c.cache.Get(ctx, id)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
doc = v.(textdocument.TextDocument)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
// we have to do this trick, otherwise the compiler won't understand that TextDocument conforms to SyncHandler interface
|
|
||||||
tr = doc.InnerTree()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *treeCache) CreateDocument(ctx context.Context, spaceId string, payload objecttree.ObjectTreeCreatePayload) (ot textdocument.TextDocument, err error) {
|
|
||||||
space, err := c.clientService.GetSpace(ctx, spaceId)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
create, err := space.CreateTree(context.Background(), payload)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ctx = context.WithValue(ctx, spaceKey, spaceId)
|
|
||||||
ctx = context.WithValue(ctx, treeCreateKey, create)
|
|
||||||
v, err := c.cache.Get(ctx, create.RootRawChange.Id)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return v.(textdocument.TextDocument), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *treeCache) DeleteTree(ctx context.Context, spaceId, treeId string) (err error) {
|
|
||||||
tr, err := c.GetTree(ctx, spaceId, treeId)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = tr.Delete()
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
_, err = c.cache.Remove(treeId)
|
|
||||||
return
|
|
||||||
}
|
|
|
@ -1,75 +0,0 @@
|
||||||
package clientspace
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto"
|
|
||||||
)
|
|
||||||
|
|
||||||
type rpcHandler struct {
|
|
||||||
s *service
|
|
||||||
}
|
|
||||||
|
|
||||||
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 {
|
|
||||||
err = spacesyncproto.ErrUnexpected
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
spaceDesc, err := sp.Description()
|
|
||||||
if err != nil {
|
|
||||||
err = spacesyncproto.ErrUnexpected
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
resp = &spacesyncproto.SpacePullResponse{
|
|
||||||
Payload: &spacesyncproto.SpacePayload{
|
|
||||||
SpaceHeader: spaceDesc.SpaceHeader,
|
|
||||||
AclPayloadId: spaceDesc.AclId,
|
|
||||||
AclPayload: spaceDesc.AclPayload,
|
|
||||||
SpaceSettingsPayload: spaceDesc.SpaceSettingsPayload,
|
|
||||||
SpaceSettingsPayloadId: spaceDesc.SpaceSettingsId,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
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,
|
|
||||||
AclPayload: req.Payload.AclPayload,
|
|
||||||
SpaceSettingsPayload: req.Payload.SpaceSettingsPayload,
|
|
||||||
SpaceSettingsId: req.Payload.SpaceSettingsPayloadId,
|
|
||||||
}
|
|
||||||
ctx = context.WithValue(ctx, commonspace.AddSpaceCtxKey, description)
|
|
||||||
_, err = r.s.GetSpace(ctx, description.SpaceHeader.GetId())
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp = &spacesyncproto.SpacePushResponse{}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *rpcHandler) HeadSync(ctx context.Context, req *spacesyncproto.HeadSyncRequest) (*spacesyncproto.HeadSyncResponse, error) {
|
|
||||||
sp, err := r.s.GetSpace(ctx, req.SpaceId)
|
|
||||||
if err != nil {
|
|
||||||
return nil, spacesyncproto.ErrSpaceMissing
|
|
||||||
}
|
|
||||||
return sp.SpaceSyncRpc().HeadSync(ctx, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *rpcHandler) ObjectSyncStream(stream spacesyncproto.DRPCSpaceSync_ObjectSyncStreamStream) error {
|
|
||||||
msg, err := stream.Recv()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
sp, err := r.s.GetSpace(stream.Context(), msg.SpaceId)
|
|
||||||
if err != nil {
|
|
||||||
return spacesyncproto.ErrSpaceMissing
|
|
||||||
}
|
|
||||||
return sp.SpaceSyncRpc().Stream(stream)
|
|
||||||
}
|
|
|
@ -1,111 +0,0 @@
|
||||||
package clientspace
|
|
||||||
|
|
||||||
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/syncstatus"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/rpc/server"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
const CName = "client.clientspace"
|
|
||||||
|
|
||||||
var log = logger.NewNamed(CName)
|
|
||||||
|
|
||||||
func New() Service {
|
|
||||||
return &service{}
|
|
||||||
}
|
|
||||||
|
|
||||||
type Service interface {
|
|
||||||
GetSpace(ctx context.Context, id string) (commonspace.Space, error)
|
|
||||||
CreateSpace(ctx context.Context, payload commonspace.SpaceCreatePayload) (commonspace.Space, error)
|
|
||||||
DeriveSpace(ctx context.Context, payload commonspace.SpaceDerivePayload) (commonspace.Space, error)
|
|
||||||
app.ComponentRunnable
|
|
||||||
}
|
|
||||||
|
|
||||||
type service struct {
|
|
||||||
conf commonspace.Config
|
|
||||||
spaceCache ocache.OCache
|
|
||||||
commonSpace commonspace.SpaceService
|
|
||||||
spaceStorageProvider spacestorage.SpaceStorageProvider
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) Init(a *app.App) (err error) {
|
|
||||||
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.DRPCRegisterSpaceSync(a.MustComponent(server.CName).(server.DRPCServer), &rpcHandler{s})
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) Name() (name string) {
|
|
||||||
return CName
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) Run(ctx context.Context) (err error) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) CreateSpace(ctx context.Context, payload commonspace.SpaceCreatePayload) (container commonspace.Space, err error) {
|
|
||||||
id, err := s.commonSpace.CreateSpace(ctx, payload)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
obj, err := s.spaceCache.Get(ctx, id)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return obj.(commonspace.Space), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) DeriveSpace(ctx context.Context, payload commonspace.SpaceDerivePayload) (container commonspace.Space, err error) {
|
|
||||||
id, err := s.commonSpace.DeriveSpace(ctx, payload)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
obj, err := s.spaceCache.Get(ctx, id)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return obj.(commonspace.Space), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) GetSpace(ctx context.Context, id string) (container commonspace.Space, err error) {
|
|
||||||
v, err := s.spaceCache.Get(ctx, id)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return v.(commonspace.Space), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) loadSpace(ctx context.Context, id string) (value ocache.Object, err error) {
|
|
||||||
cc, err := s.commonSpace.NewSpace(ctx, id)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ns, err := newClientSpace(cc)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ns.SyncStatus().(syncstatus.StatusWatcher).SetUpdateReceiver(&statusReceiver{})
|
|
||||||
if err = ns.Init(ctx); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return ns, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) Close(ctx context.Context) (err error) {
|
|
||||||
return s.spaceCache.Close()
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
package clientspace
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace"
|
|
||||||
)
|
|
||||||
|
|
||||||
func newClientSpace(cc commonspace.Space) (commonspace.Space, error) {
|
|
||||||
return &clientSpace{cc}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type clientSpace struct {
|
|
||||||
commonspace.Space
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *clientSpace) Init(ctx context.Context) (err error) {
|
|
||||||
return s.Space.Init(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *clientSpace) Close() (err error) {
|
|
||||||
return s.Space.Close()
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
package clientspace
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"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 syncstatus.SyncStatus) (err error) {
|
|
||||||
log.With(zap.String("treeId", treeId), zap.Bool("synced", status == syncstatus.StatusSynced)).
|
|
||||||
Debug("updating sync status")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *statusReceiver) UpdateNodeConnection(online bool) {
|
|
||||||
log.With(zap.Bool("nodes online", online)).Debug("updating node connection")
|
|
||||||
}
|
|
|
@ -1,118 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"flag"
|
|
||||||
"fmt"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/account"
|
|
||||||
"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"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/storage"
|
|
||||||
"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"
|
|
||||||
"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/secureservice"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/nodeconf"
|
|
||||||
"go.uber.org/zap"
|
|
||||||
"net/http"
|
|
||||||
_ "net/http/pprof"
|
|
||||||
"os"
|
|
||||||
"os/signal"
|
|
||||||
"syscall"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
var log = logger.NewNamed("main")
|
|
||||||
|
|
||||||
var (
|
|
||||||
flagConfigFile = flag.String("c", "etc/client.yml", "path to config file")
|
|
||||||
// we can't use "v" here because of glog init (through badger) setting flag.Bool with "v"
|
|
||||||
flagVersion = flag.Bool("ver", false, "show version and exit")
|
|
||||||
flagHelp = flag.Bool("h", false, "show help and exit")
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
flag.Parse()
|
|
||||||
|
|
||||||
if *flagVersion {
|
|
||||||
fmt.Println(app.VersionDescription())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if *flagHelp {
|
|
||||||
flag.PrintDefaults()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if debug, ok := os.LookupEnv("ANYPROF"); ok && debug != "" {
|
|
||||||
go func() {
|
|
||||||
http.ListenAndServe(debug, nil)
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
|
|
||||||
// create app
|
|
||||||
ctx := context.Background()
|
|
||||||
a := new(app.App)
|
|
||||||
|
|
||||||
// open config file
|
|
||||||
conf, err := config.NewFromFile(*flagConfigFile)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal("can't open config file", zap.Error(err))
|
|
||||||
}
|
|
||||||
|
|
||||||
// bootstrap components
|
|
||||||
a.Register(conf)
|
|
||||||
Bootstrap(a)
|
|
||||||
|
|
||||||
// start app
|
|
||||||
if err := a.Start(ctx); err != nil {
|
|
||||||
log.Fatal("can't start app", zap.Error(err))
|
|
||||||
}
|
|
||||||
log.Info("app started", zap.String("version", a.Version()))
|
|
||||||
|
|
||||||
// wait exit signal
|
|
||||||
exit := make(chan os.Signal, 1)
|
|
||||||
signal.Notify(exit, os.Interrupt, syscall.SIGKILL, syscall.SIGTERM, syscall.SIGQUIT)
|
|
||||||
sig := <-exit
|
|
||||||
log.Info("received exit signal, stop app...", zap.String("signal", fmt.Sprint(sig)))
|
|
||||||
|
|
||||||
// close app
|
|
||||||
ctx, cancel := context.WithTimeout(ctx, time.Minute)
|
|
||||||
defer cancel()
|
|
||||||
if err := a.Close(ctx); err != nil {
|
|
||||||
log.Fatal("close error", zap.Error(err))
|
|
||||||
} else {
|
|
||||||
log.Info("goodbye!")
|
|
||||||
}
|
|
||||||
time.Sleep(time.Second / 3)
|
|
||||||
}
|
|
||||||
|
|
||||||
func Bootstrap(a *app.App) {
|
|
||||||
a.Register(account.New()).
|
|
||||||
Register(nodeconf.New()).
|
|
||||||
Register(metric.New()).
|
|
||||||
Register(badgerprovider.New()).
|
|
||||||
Register(storage.New()).
|
|
||||||
Register(clientcache.New(200)).
|
|
||||||
Register(secureservice.New()).
|
|
||||||
Register(dialer.New()).
|
|
||||||
Register(pool.New()).
|
|
||||||
Register(commonspace.New()).
|
|
||||||
Register(clientspace.New()).
|
|
||||||
Register(server.New()).
|
|
||||||
Register(document.New()).
|
|
||||||
Register(rpcstore.New()).
|
|
||||||
Register(fileservice.New()).
|
|
||||||
Register(filestorage.New()).
|
|
||||||
Register(clientdebugrpc.New())
|
|
||||||
}
|
|
|
@ -1,75 +0,0 @@
|
||||||
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
|
|
||||||
}
|
|
|
@ -1,88 +0,0 @@
|
||||||
package clientdebugrpc
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"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/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/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/secureservice"
|
|
||||||
"storj.io/drpc"
|
|
||||||
)
|
|
||||||
|
|
||||||
const CName = "common.debug.clientdebugrpc"
|
|
||||||
|
|
||||||
var log = logger.NewNamed(CName)
|
|
||||||
|
|
||||||
func New() ClientDebugRpc {
|
|
||||||
return &service{BaseDrpcServer: server.NewBaseDrpcServer()}
|
|
||||||
}
|
|
||||||
|
|
||||||
type configGetter interface {
|
|
||||||
GetDebugNet() net.Config
|
|
||||||
}
|
|
||||||
|
|
||||||
type ClientDebugRpc interface {
|
|
||||||
app.ComponentRunnable
|
|
||||||
drpc.Mux
|
|
||||||
}
|
|
||||||
|
|
||||||
type service struct {
|
|
||||||
transport secureservice.SecureService
|
|
||||||
cfg net.Config
|
|
||||||
spaceService clientspace.Service
|
|
||||||
storageService clientstorage.ClientStorage
|
|
||||||
docService document.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(spacestorage.CName).(clientstorage.ClientStorage)
|
|
||||||
s.docService = a.MustComponent(document.CName).(document.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
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) Name() (name string) {
|
|
||||||
return CName
|
|
||||||
}
|
|
||||||
|
|
||||||
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.Server.ListenAddrs,
|
|
||||||
Wrapper: func(handler drpc.Handler) drpc.Handler {
|
|
||||||
return handler
|
|
||||||
},
|
|
||||||
Converter: s.transport.BasicListener,
|
|
||||||
}
|
|
||||||
err = s.BaseDrpcServer.Run(ctx, params)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return clientdebugrpcproto.DRPCRegisterClientApi(s, &rpcHandler{
|
|
||||||
spaceService: s.spaceService,
|
|
||||||
storageService: s.storageService,
|
|
||||||
docService: s.docService,
|
|
||||||
account: s.account,
|
|
||||||
file: s.file,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) Close(ctx context.Context) (err error) {
|
|
||||||
return s.BaseDrpcServer.Close(ctx)
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,673 +0,0 @@
|
||||||
// Code generated by protoc-gen-go-drpc. DO NOT EDIT.
|
|
||||||
// protoc-gen-go-drpc version: v0.0.32
|
|
||||||
// source: debug/clientdebugrpc/clientdebugrpcproto/protos/clientdebugrpc.proto
|
|
||||||
|
|
||||||
package clientdebugrpcproto
|
|
||||||
|
|
||||||
import (
|
|
||||||
bytes "bytes"
|
|
||||||
context "context"
|
|
||||||
errors "errors"
|
|
||||||
jsonpb "github.com/gogo/protobuf/jsonpb"
|
|
||||||
proto "github.com/gogo/protobuf/proto"
|
|
||||||
drpc "storj.io/drpc"
|
|
||||||
drpcerr "storj.io/drpc/drpcerr"
|
|
||||||
)
|
|
||||||
|
|
||||||
type drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto struct{}
|
|
||||||
|
|
||||||
func (drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto) Marshal(msg drpc.Message) ([]byte, error) {
|
|
||||||
return proto.Marshal(msg.(proto.Message))
|
|
||||||
}
|
|
||||||
|
|
||||||
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_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 {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return buf.Bytes(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
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))
|
|
||||||
}
|
|
||||||
|
|
||||||
type DRPCClientApiClient interface {
|
|
||||||
DRPCConn() drpc.Conn
|
|
||||||
|
|
||||||
CreateSpace(ctx context.Context, in *CreateSpaceRequest) (*CreateSpaceResponse, error)
|
|
||||||
DeriveSpace(ctx context.Context, in *DeriveSpaceRequest) (*DeriveSpaceResponse, error)
|
|
||||||
CreateDocument(ctx context.Context, in *CreateDocumentRequest) (*CreateDocumentResponse, error)
|
|
||||||
DeleteDocument(ctx context.Context, in *DeleteDocumentRequest) (*DeleteDocumentResponse, error)
|
|
||||||
AddText(ctx context.Context, in *AddTextRequest) (*AddTextResponse, error)
|
|
||||||
DumpTree(ctx context.Context, in *DumpTreeRequest) (*DumpTreeResponse, error)
|
|
||||||
TreeParams(ctx context.Context, in *TreeParamsRequest) (*TreeParamsResponse, error)
|
|
||||||
AllTrees(ctx context.Context, in *AllTreesRequest) (*AllTreesResponse, error)
|
|
||||||
AllSpaces(ctx context.Context, in *AllSpacesRequest) (*AllSpacesResponse, error)
|
|
||||||
LoadSpace(ctx context.Context, in *LoadSpaceRequest) (*LoadSpaceResponse, error)
|
|
||||||
Watch(ctx context.Context, in *WatchRequest) (*WatchResponse, error)
|
|
||||||
Unwatch(ctx context.Context, in *UnwatchRequest) (*UnwatchResponse, error)
|
|
||||||
PutFile(ctx context.Context, in *PutFileRequest) (*PutFileResponse, error)
|
|
||||||
GetFile(ctx context.Context, in *GetFileRequest) (*GetFileResponse, error)
|
|
||||||
DeleteFile(ctx context.Context, in *DeleteFileRequest) (*DeleteFileResponse, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
type drpcClientApiClient struct {
|
|
||||||
cc drpc.Conn
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewDRPCClientApiClient(cc drpc.Conn) DRPCClientApiClient {
|
|
||||||
return &drpcClientApiClient{cc}
|
|
||||||
}
|
|
||||||
|
|
||||||
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, "/clientdebugrpc.ClientApi/CreateSpace", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *drpcClientApiClient) DeriveSpace(ctx context.Context, in *DeriveSpaceRequest) (*DeriveSpaceResponse, error) {
|
|
||||||
out := new(DeriveSpaceResponse)
|
|
||||||
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/DeriveSpace", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *drpcClientApiClient) CreateDocument(ctx context.Context, in *CreateDocumentRequest) (*CreateDocumentResponse, error) {
|
|
||||||
out := new(CreateDocumentResponse)
|
|
||||||
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/CreateDocument", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *drpcClientApiClient) DeleteDocument(ctx context.Context, in *DeleteDocumentRequest) (*DeleteDocumentResponse, error) {
|
|
||||||
out := new(DeleteDocumentResponse)
|
|
||||||
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/DeleteDocument", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *drpcClientApiClient) AddText(ctx context.Context, in *AddTextRequest) (*AddTextResponse, error) {
|
|
||||||
out := new(AddTextResponse)
|
|
||||||
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/AddText", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *drpcClientApiClient) DumpTree(ctx context.Context, in *DumpTreeRequest) (*DumpTreeResponse, error) {
|
|
||||||
out := new(DumpTreeResponse)
|
|
||||||
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/DumpTree", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *drpcClientApiClient) TreeParams(ctx context.Context, in *TreeParamsRequest) (*TreeParamsResponse, error) {
|
|
||||||
out := new(TreeParamsResponse)
|
|
||||||
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/TreeParams", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *drpcClientApiClient) AllTrees(ctx context.Context, in *AllTreesRequest) (*AllTreesResponse, error) {
|
|
||||||
out := new(AllTreesResponse)
|
|
||||||
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/AllTrees", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *drpcClientApiClient) AllSpaces(ctx context.Context, in *AllSpacesRequest) (*AllSpacesResponse, error) {
|
|
||||||
out := new(AllSpacesResponse)
|
|
||||||
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/AllSpaces", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *drpcClientApiClient) LoadSpace(ctx context.Context, in *LoadSpaceRequest) (*LoadSpaceResponse, error) {
|
|
||||||
out := new(LoadSpaceResponse)
|
|
||||||
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/LoadSpace", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *drpcClientApiClient) Watch(ctx context.Context, in *WatchRequest) (*WatchResponse, error) {
|
|
||||||
out := new(WatchResponse)
|
|
||||||
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/Watch", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *drpcClientApiClient) Unwatch(ctx context.Context, in *UnwatchRequest) (*UnwatchResponse, error) {
|
|
||||||
out := new(UnwatchResponse)
|
|
||||||
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/Unwatch", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *drpcClientApiClient) PutFile(ctx context.Context, in *PutFileRequest) (*PutFileResponse, error) {
|
|
||||||
out := new(PutFileResponse)
|
|
||||||
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/PutFile", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *drpcClientApiClient) GetFile(ctx context.Context, in *GetFileRequest) (*GetFileResponse, error) {
|
|
||||||
out := new(GetFileResponse)
|
|
||||||
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/GetFile", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *drpcClientApiClient) DeleteFile(ctx context.Context, in *DeleteFileRequest) (*DeleteFileResponse, error) {
|
|
||||||
out := new(DeleteFileResponse)
|
|
||||||
err := c.cc.Invoke(ctx, "/clientdebugrpc.ClientApi/DeleteFile", drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}, in, out)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type DRPCClientApiServer interface {
|
|
||||||
CreateSpace(context.Context, *CreateSpaceRequest) (*CreateSpaceResponse, error)
|
|
||||||
DeriveSpace(context.Context, *DeriveSpaceRequest) (*DeriveSpaceResponse, error)
|
|
||||||
CreateDocument(context.Context, *CreateDocumentRequest) (*CreateDocumentResponse, error)
|
|
||||||
DeleteDocument(context.Context, *DeleteDocumentRequest) (*DeleteDocumentResponse, error)
|
|
||||||
AddText(context.Context, *AddTextRequest) (*AddTextResponse, error)
|
|
||||||
DumpTree(context.Context, *DumpTreeRequest) (*DumpTreeResponse, error)
|
|
||||||
TreeParams(context.Context, *TreeParamsRequest) (*TreeParamsResponse, error)
|
|
||||||
AllTrees(context.Context, *AllTreesRequest) (*AllTreesResponse, error)
|
|
||||||
AllSpaces(context.Context, *AllSpacesRequest) (*AllSpacesResponse, error)
|
|
||||||
LoadSpace(context.Context, *LoadSpaceRequest) (*LoadSpaceResponse, error)
|
|
||||||
Watch(context.Context, *WatchRequest) (*WatchResponse, error)
|
|
||||||
Unwatch(context.Context, *UnwatchRequest) (*UnwatchResponse, error)
|
|
||||||
PutFile(context.Context, *PutFileRequest) (*PutFileResponse, error)
|
|
||||||
GetFile(context.Context, *GetFileRequest) (*GetFileResponse, error)
|
|
||||||
DeleteFile(context.Context, *DeleteFileRequest) (*DeleteFileResponse, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
type DRPCClientApiUnimplementedServer struct{}
|
|
||||||
|
|
||||||
func (s *DRPCClientApiUnimplementedServer) CreateSpace(context.Context, *CreateSpaceRequest) (*CreateSpaceResponse, error) {
|
|
||||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *DRPCClientApiUnimplementedServer) DeriveSpace(context.Context, *DeriveSpaceRequest) (*DeriveSpaceResponse, error) {
|
|
||||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *DRPCClientApiUnimplementedServer) CreateDocument(context.Context, *CreateDocumentRequest) (*CreateDocumentResponse, error) {
|
|
||||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *DRPCClientApiUnimplementedServer) DeleteDocument(context.Context, *DeleteDocumentRequest) (*DeleteDocumentResponse, error) {
|
|
||||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *DRPCClientApiUnimplementedServer) AddText(context.Context, *AddTextRequest) (*AddTextResponse, error) {
|
|
||||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *DRPCClientApiUnimplementedServer) DumpTree(context.Context, *DumpTreeRequest) (*DumpTreeResponse, error) {
|
|
||||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *DRPCClientApiUnimplementedServer) TreeParams(context.Context, *TreeParamsRequest) (*TreeParamsResponse, error) {
|
|
||||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *DRPCClientApiUnimplementedServer) AllTrees(context.Context, *AllTreesRequest) (*AllTreesResponse, error) {
|
|
||||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *DRPCClientApiUnimplementedServer) AllSpaces(context.Context, *AllSpacesRequest) (*AllSpacesResponse, error) {
|
|
||||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *DRPCClientApiUnimplementedServer) LoadSpace(context.Context, *LoadSpaceRequest) (*LoadSpaceResponse, error) {
|
|
||||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *DRPCClientApiUnimplementedServer) Watch(context.Context, *WatchRequest) (*WatchResponse, error) {
|
|
||||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *DRPCClientApiUnimplementedServer) Unwatch(context.Context, *UnwatchRequest) (*UnwatchResponse, error) {
|
|
||||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *DRPCClientApiUnimplementedServer) PutFile(context.Context, *PutFileRequest) (*PutFileResponse, error) {
|
|
||||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *DRPCClientApiUnimplementedServer) GetFile(context.Context, *GetFileRequest) (*GetFileResponse, error) {
|
|
||||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *DRPCClientApiUnimplementedServer) DeleteFile(context.Context, *DeleteFileRequest) (*DeleteFileResponse, error) {
|
|
||||||
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
||||||
}
|
|
||||||
|
|
||||||
type DRPCClientApiDescription struct{}
|
|
||||||
|
|
||||||
func (DRPCClientApiDescription) NumMethods() int { return 15 }
|
|
||||||
|
|
||||||
func (DRPCClientApiDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
|
|
||||||
switch n {
|
|
||||||
case 0:
|
|
||||||
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(
|
|
||||||
ctx,
|
|
||||||
in1.(*CreateSpaceRequest),
|
|
||||||
)
|
|
||||||
}, DRPCClientApiServer.CreateSpace, true
|
|
||||||
case 1:
|
|
||||||
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(
|
|
||||||
ctx,
|
|
||||||
in1.(*DeriveSpaceRequest),
|
|
||||||
)
|
|
||||||
}, DRPCClientApiServer.DeriveSpace, true
|
|
||||||
case 2:
|
|
||||||
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(
|
|
||||||
ctx,
|
|
||||||
in1.(*CreateDocumentRequest),
|
|
||||||
)
|
|
||||||
}, DRPCClientApiServer.CreateDocument, true
|
|
||||||
case 3:
|
|
||||||
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(
|
|
||||||
ctx,
|
|
||||||
in1.(*DeleteDocumentRequest),
|
|
||||||
)
|
|
||||||
}, DRPCClientApiServer.DeleteDocument, true
|
|
||||||
case 4:
|
|
||||||
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(
|
|
||||||
ctx,
|
|
||||||
in1.(*AddTextRequest),
|
|
||||||
)
|
|
||||||
}, DRPCClientApiServer.AddText, true
|
|
||||||
case 5:
|
|
||||||
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(
|
|
||||||
ctx,
|
|
||||||
in1.(*DumpTreeRequest),
|
|
||||||
)
|
|
||||||
}, DRPCClientApiServer.DumpTree, true
|
|
||||||
case 6:
|
|
||||||
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(
|
|
||||||
ctx,
|
|
||||||
in1.(*TreeParamsRequest),
|
|
||||||
)
|
|
||||||
}, DRPCClientApiServer.TreeParams, true
|
|
||||||
case 7:
|
|
||||||
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(
|
|
||||||
ctx,
|
|
||||||
in1.(*AllTreesRequest),
|
|
||||||
)
|
|
||||||
}, DRPCClientApiServer.AllTrees, true
|
|
||||||
case 8:
|
|
||||||
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(
|
|
||||||
ctx,
|
|
||||||
in1.(*AllSpacesRequest),
|
|
||||||
)
|
|
||||||
}, DRPCClientApiServer.AllSpaces, true
|
|
||||||
case 9:
|
|
||||||
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(
|
|
||||||
ctx,
|
|
||||||
in1.(*LoadSpaceRequest),
|
|
||||||
)
|
|
||||||
}, DRPCClientApiServer.LoadSpace, true
|
|
||||||
case 10:
|
|
||||||
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(
|
|
||||||
ctx,
|
|
||||||
in1.(*WatchRequest),
|
|
||||||
)
|
|
||||||
}, DRPCClientApiServer.Watch, true
|
|
||||||
case 11:
|
|
||||||
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(
|
|
||||||
ctx,
|
|
||||||
in1.(*UnwatchRequest),
|
|
||||||
)
|
|
||||||
}, DRPCClientApiServer.Unwatch, true
|
|
||||||
case 12:
|
|
||||||
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(
|
|
||||||
ctx,
|
|
||||||
in1.(*PutFileRequest),
|
|
||||||
)
|
|
||||||
}, DRPCClientApiServer.PutFile, true
|
|
||||||
case 13:
|
|
||||||
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(
|
|
||||||
ctx,
|
|
||||||
in1.(*GetFileRequest),
|
|
||||||
)
|
|
||||||
}, DRPCClientApiServer.GetFile, true
|
|
||||||
case 14:
|
|
||||||
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(
|
|
||||||
ctx,
|
|
||||||
in1.(*DeleteFileRequest),
|
|
||||||
)
|
|
||||||
}, DRPCClientApiServer.DeleteFile, true
|
|
||||||
default:
|
|
||||||
return "", nil, nil, nil, false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func DRPCRegisterClientApi(mux drpc.Mux, impl DRPCClientApiServer) error {
|
|
||||||
return mux.Register(impl, DRPCClientApiDescription{})
|
|
||||||
}
|
|
||||||
|
|
||||||
type DRPCClientApi_CreateSpaceStream interface {
|
|
||||||
drpc.Stream
|
|
||||||
SendAndClose(*CreateSpaceResponse) error
|
|
||||||
}
|
|
||||||
|
|
||||||
type drpcClientApi_CreateSpaceStream struct {
|
|
||||||
drpc.Stream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *drpcClientApi_CreateSpaceStream) SendAndClose(m *CreateSpaceResponse) error {
|
|
||||||
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return x.CloseSend()
|
|
||||||
}
|
|
||||||
|
|
||||||
type DRPCClientApi_DeriveSpaceStream interface {
|
|
||||||
drpc.Stream
|
|
||||||
SendAndClose(*DeriveSpaceResponse) error
|
|
||||||
}
|
|
||||||
|
|
||||||
type drpcClientApi_DeriveSpaceStream struct {
|
|
||||||
drpc.Stream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *drpcClientApi_DeriveSpaceStream) SendAndClose(m *DeriveSpaceResponse) error {
|
|
||||||
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return x.CloseSend()
|
|
||||||
}
|
|
||||||
|
|
||||||
type DRPCClientApi_CreateDocumentStream interface {
|
|
||||||
drpc.Stream
|
|
||||||
SendAndClose(*CreateDocumentResponse) error
|
|
||||||
}
|
|
||||||
|
|
||||||
type drpcClientApi_CreateDocumentStream struct {
|
|
||||||
drpc.Stream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *drpcClientApi_CreateDocumentStream) SendAndClose(m *CreateDocumentResponse) error {
|
|
||||||
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return x.CloseSend()
|
|
||||||
}
|
|
||||||
|
|
||||||
type DRPCClientApi_DeleteDocumentStream interface {
|
|
||||||
drpc.Stream
|
|
||||||
SendAndClose(*DeleteDocumentResponse) error
|
|
||||||
}
|
|
||||||
|
|
||||||
type drpcClientApi_DeleteDocumentStream struct {
|
|
||||||
drpc.Stream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *drpcClientApi_DeleteDocumentStream) SendAndClose(m *DeleteDocumentResponse) error {
|
|
||||||
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return x.CloseSend()
|
|
||||||
}
|
|
||||||
|
|
||||||
type DRPCClientApi_AddTextStream interface {
|
|
||||||
drpc.Stream
|
|
||||||
SendAndClose(*AddTextResponse) error
|
|
||||||
}
|
|
||||||
|
|
||||||
type drpcClientApi_AddTextStream struct {
|
|
||||||
drpc.Stream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *drpcClientApi_AddTextStream) SendAndClose(m *AddTextResponse) error {
|
|
||||||
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return x.CloseSend()
|
|
||||||
}
|
|
||||||
|
|
||||||
type DRPCClientApi_DumpTreeStream interface {
|
|
||||||
drpc.Stream
|
|
||||||
SendAndClose(*DumpTreeResponse) error
|
|
||||||
}
|
|
||||||
|
|
||||||
type drpcClientApi_DumpTreeStream struct {
|
|
||||||
drpc.Stream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *drpcClientApi_DumpTreeStream) SendAndClose(m *DumpTreeResponse) error {
|
|
||||||
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return x.CloseSend()
|
|
||||||
}
|
|
||||||
|
|
||||||
type DRPCClientApi_TreeParamsStream interface {
|
|
||||||
drpc.Stream
|
|
||||||
SendAndClose(*TreeParamsResponse) error
|
|
||||||
}
|
|
||||||
|
|
||||||
type drpcClientApi_TreeParamsStream struct {
|
|
||||||
drpc.Stream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *drpcClientApi_TreeParamsStream) SendAndClose(m *TreeParamsResponse) error {
|
|
||||||
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return x.CloseSend()
|
|
||||||
}
|
|
||||||
|
|
||||||
type DRPCClientApi_AllTreesStream interface {
|
|
||||||
drpc.Stream
|
|
||||||
SendAndClose(*AllTreesResponse) error
|
|
||||||
}
|
|
||||||
|
|
||||||
type drpcClientApi_AllTreesStream struct {
|
|
||||||
drpc.Stream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *drpcClientApi_AllTreesStream) SendAndClose(m *AllTreesResponse) error {
|
|
||||||
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return x.CloseSend()
|
|
||||||
}
|
|
||||||
|
|
||||||
type DRPCClientApi_AllSpacesStream interface {
|
|
||||||
drpc.Stream
|
|
||||||
SendAndClose(*AllSpacesResponse) error
|
|
||||||
}
|
|
||||||
|
|
||||||
type drpcClientApi_AllSpacesStream struct {
|
|
||||||
drpc.Stream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *drpcClientApi_AllSpacesStream) SendAndClose(m *AllSpacesResponse) error {
|
|
||||||
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return x.CloseSend()
|
|
||||||
}
|
|
||||||
|
|
||||||
type DRPCClientApi_LoadSpaceStream interface {
|
|
||||||
drpc.Stream
|
|
||||||
SendAndClose(*LoadSpaceResponse) error
|
|
||||||
}
|
|
||||||
|
|
||||||
type drpcClientApi_LoadSpaceStream struct {
|
|
||||||
drpc.Stream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *drpcClientApi_LoadSpaceStream) SendAndClose(m *LoadSpaceResponse) error {
|
|
||||||
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return x.CloseSend()
|
|
||||||
}
|
|
||||||
|
|
||||||
type DRPCClientApi_WatchStream interface {
|
|
||||||
drpc.Stream
|
|
||||||
SendAndClose(*WatchResponse) error
|
|
||||||
}
|
|
||||||
|
|
||||||
type drpcClientApi_WatchStream struct {
|
|
||||||
drpc.Stream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *drpcClientApi_WatchStream) SendAndClose(m *WatchResponse) error {
|
|
||||||
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return x.CloseSend()
|
|
||||||
}
|
|
||||||
|
|
||||||
type DRPCClientApi_UnwatchStream interface {
|
|
||||||
drpc.Stream
|
|
||||||
SendAndClose(*UnwatchResponse) error
|
|
||||||
}
|
|
||||||
|
|
||||||
type drpcClientApi_UnwatchStream struct {
|
|
||||||
drpc.Stream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *drpcClientApi_UnwatchStream) SendAndClose(m *UnwatchResponse) error {
|
|
||||||
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return x.CloseSend()
|
|
||||||
}
|
|
||||||
|
|
||||||
type DRPCClientApi_PutFileStream interface {
|
|
||||||
drpc.Stream
|
|
||||||
SendAndClose(*PutFileResponse) error
|
|
||||||
}
|
|
||||||
|
|
||||||
type drpcClientApi_PutFileStream struct {
|
|
||||||
drpc.Stream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *drpcClientApi_PutFileStream) SendAndClose(m *PutFileResponse) error {
|
|
||||||
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return x.CloseSend()
|
|
||||||
}
|
|
||||||
|
|
||||||
type DRPCClientApi_GetFileStream interface {
|
|
||||||
drpc.Stream
|
|
||||||
SendAndClose(*GetFileResponse) error
|
|
||||||
}
|
|
||||||
|
|
||||||
type drpcClientApi_GetFileStream struct {
|
|
||||||
drpc.Stream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *drpcClientApi_GetFileStream) SendAndClose(m *GetFileResponse) error {
|
|
||||||
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return x.CloseSend()
|
|
||||||
}
|
|
||||||
|
|
||||||
type DRPCClientApi_DeleteFileStream interface {
|
|
||||||
drpc.Stream
|
|
||||||
SendAndClose(*DeleteFileResponse) error
|
|
||||||
}
|
|
||||||
|
|
||||||
type drpcClientApi_DeleteFileStream struct {
|
|
||||||
drpc.Stream
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *drpcClientApi_DeleteFileStream) SendAndClose(m *DeleteFileResponse) error {
|
|
||||||
if err := x.MsgSend(m, drpcEncoding_File_debug_clientdebugrpc_clientdebugrpcproto_protos_clientdebugrpc_proto{}); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return x.CloseSend()
|
|
||||||
}
|
|
|
@ -1,124 +0,0 @@
|
||||||
syntax = "proto3";
|
|
||||||
package clientdebugrpc;
|
|
||||||
|
|
||||||
option go_package = "debug/clientdebugrpc/clientdebugrpcproto";
|
|
||||||
|
|
||||||
service ClientApi {
|
|
||||||
rpc CreateSpace(CreateSpaceRequest) returns(CreateSpaceResponse);
|
|
||||||
rpc DeriveSpace(DeriveSpaceRequest) returns(DeriveSpaceResponse);
|
|
||||||
rpc CreateDocument(CreateDocumentRequest) returns(CreateDocumentResponse);
|
|
||||||
rpc DeleteDocument(DeleteDocumentRequest) returns(DeleteDocumentResponse);
|
|
||||||
rpc AddText(AddTextRequest) returns(AddTextResponse);
|
|
||||||
rpc DumpTree(DumpTreeRequest) returns(DumpTreeResponse);
|
|
||||||
rpc TreeParams(TreeParamsRequest) returns(TreeParamsResponse);
|
|
||||||
rpc AllTrees(AllTreesRequest) returns(AllTreesResponse);
|
|
||||||
rpc AllSpaces(AllSpacesRequest) returns(AllSpacesResponse);
|
|
||||||
rpc LoadSpace(LoadSpaceRequest) returns(LoadSpaceResponse);
|
|
||||||
rpc Watch(WatchRequest) returns(WatchResponse);
|
|
||||||
rpc Unwatch(UnwatchRequest) returns(UnwatchResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
message CreateSpaceRequest {
|
|
||||||
}
|
|
||||||
|
|
||||||
message CreateSpaceResponse {
|
|
||||||
string id = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message DeriveSpaceRequest {
|
|
||||||
}
|
|
||||||
|
|
||||||
message DeriveSpaceResponse {
|
|
||||||
string id = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message CreateDocumentRequest {
|
|
||||||
string spaceId = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message CreateDocumentResponse {
|
|
||||||
string id = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message DeleteDocumentRequest {
|
|
||||||
string spaceId = 1;
|
|
||||||
string documentId = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message DeleteDocumentResponse {
|
|
||||||
}
|
|
||||||
|
|
||||||
message AddTextRequest {
|
|
||||||
string spaceId = 1;
|
|
||||||
string documentId = 2;
|
|
||||||
string text = 3;
|
|
||||||
bool isSnapshot = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
message AddTextResponse {
|
|
||||||
string documentId = 1;
|
|
||||||
string headId = 2;
|
|
||||||
string rootId = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message DumpTreeRequest {
|
|
||||||
string spaceId = 1;
|
|
||||||
string documentId = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message DumpTreeResponse {
|
|
||||||
string dump = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message AllTreesRequest {
|
|
||||||
string spaceId = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message Tree {
|
|
||||||
string id = 1;
|
|
||||||
repeated string heads = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message AllTreesResponse {
|
|
||||||
repeated Tree trees = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message AllSpacesRequest {
|
|
||||||
}
|
|
||||||
|
|
||||||
message AllSpacesResponse {
|
|
||||||
repeated string spaceIds = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message LoadSpaceRequest {
|
|
||||||
string spaceId = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message LoadSpaceResponse {
|
|
||||||
}
|
|
||||||
|
|
||||||
message TreeParamsRequest {
|
|
||||||
string spaceId = 1;
|
|
||||||
string documentId = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message TreeParamsResponse {
|
|
||||||
string rootId = 1;
|
|
||||||
repeated string headIds = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message WatchRequest {
|
|
||||||
string spaceId = 1;
|
|
||||||
string treeId = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message WatchResponse {
|
|
||||||
}
|
|
||||||
|
|
||||||
message UnwatchRequest {
|
|
||||||
string spaceId = 1;
|
|
||||||
string treeId = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message UnwatchResponse {
|
|
||||||
}
|
|
|
@ -1,222 +0,0 @@
|
||||||
package clientdebugrpc
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"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/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"
|
|
||||||
"io"
|
|
||||||
"math/rand"
|
|
||||||
"os"
|
|
||||||
)
|
|
||||||
|
|
||||||
type rpcHandler struct {
|
|
||||||
spaceService clientspace.Service
|
|
||||||
storageService storage.ClientStorage
|
|
||||||
docService document.Service
|
|
||||||
account accountservice.Service
|
|
||||||
file fileservice.FileService
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
watcher := space.SyncStatus().(syncstatus.StatusWatcher)
|
|
||||||
watcher.Watch(request.TreeId)
|
|
||||||
resp = &clientdebugrpcproto.WatchResponse{}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
watcher := space.SyncStatus().(syncstatus.StatusWatcher)
|
|
||||||
watcher.Unwatch(request.TreeId)
|
|
||||||
resp = &clientdebugrpcproto.UnwatchResponse{}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
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 = &clientdebugrpcproto.LoadSpaceResponse{}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *rpcHandler) CreateSpace(ctx context.Context, request *clientdebugrpcproto.CreateSpaceRequest) (resp *clientdebugrpcproto.CreateSpaceResponse, err error) {
|
|
||||||
key, err := symmetric.NewRandom()
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
sp, err := r.spaceService.CreateSpace(context.Background(), commonspace.SpaceCreatePayload{
|
|
||||||
SigningKey: r.account.Account().SignKey,
|
|
||||||
EncryptionKey: r.account.Account().EncKey,
|
|
||||||
ReadKey: key.Bytes(),
|
|
||||||
ReplicationKey: rand.Uint64(),
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
id := sp.Id()
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp = &clientdebugrpcproto.CreateSpaceResponse{Id: id}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
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,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
id := sp.Id()
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp = &clientdebugrpcproto.DeriveSpaceResponse{Id: id}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
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 = &clientdebugrpcproto.CreateDocumentResponse{Id: id}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
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 = &clientdebugrpcproto.DeleteDocumentResponse{}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
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 = &clientdebugrpcproto.AddTextResponse{
|
|
||||||
DocumentId: request.DocumentId,
|
|
||||||
HeadId: head,
|
|
||||||
RootId: root,
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
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 = &clientdebugrpcproto.DumpTreeResponse{
|
|
||||||
Dump: dump,
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
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 []*clientdebugrpcproto.Tree
|
|
||||||
for _, head := range heads {
|
|
||||||
trees = append(trees, &clientdebugrpcproto.Tree{
|
|
||||||
Id: head.Id,
|
|
||||||
Heads: head.Heads,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
resp = &clientdebugrpcproto.AllTreesResponse{Trees: trees}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
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 = &clientdebugrpcproto.AllSpacesResponse{SpaceIds: ids}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
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 = &clientdebugrpcproto.TreeParamsResponse{
|
|
||||||
RootId: root,
|
|
||||||
HeadIds: heads,
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
n, err := r.file.AddFile(ctx, f)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return &clientdebugrpcproto.PutFileResponse{
|
|
||||||
Hash: n.Cid().String(),
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
f, err := os.Create(request.Path)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer f.Close()
|
|
||||||
|
|
||||||
rd, err := r.file.GetFile(ctx, c)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer rd.Close()
|
|
||||||
wr, err := io.Copy(f, rd)
|
|
||||||
if err != nil && err != io.EOF {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
log.Info("copied bytes", zap.Int64("size", wr))
|
|
||||||
return &clientdebugrpcproto.GetFileResponse{
|
|
||||||
Path: request.Path,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *rpcHandler) DeleteFile(ctx context.Context, request *clientdebugrpcproto.DeleteFileRequest) (*clientdebugrpcproto.DeleteFileResponse, error) {
|
|
||||||
//TODO implement me
|
|
||||||
panic("implement me")
|
|
||||||
}
|
|
|
@ -1,117 +0,0 @@
|
||||||
package document
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"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/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/headsync"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/objecttree"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/treegetter"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Service interface {
|
|
||||||
app.Component
|
|
||||||
CreateDocument(spaceId string) (id string, err error)
|
|
||||||
DeleteDocument(spaceId, documentId string) (err error)
|
|
||||||
AllDocumentIds(spaceId string) (ids []string, 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)
|
|
||||||
}
|
|
||||||
|
|
||||||
const CName = "client.document"
|
|
||||||
|
|
||||||
var log = logger.NewNamed(CName)
|
|
||||||
|
|
||||||
type service struct {
|
|
||||||
account accountservice.Service
|
|
||||||
spaceService clientspace.Service
|
|
||||||
cache clientcache.TreeCache
|
|
||||||
}
|
|
||||||
|
|
||||||
func New() Service {
|
|
||||||
return &service{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) Init(a *app.App) (err error) {
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) Name() (name string) {
|
|
||||||
return CName
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) CreateDocument(spaceId string) (id string, err error) {
|
|
||||||
space, err := s.spaceService.GetSpace(context.Background(), spaceId)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
payload := objecttree.ObjectTreeCreatePayload{
|
|
||||||
SignKey: s.account.Account().SignKey,
|
|
||||||
SpaceId: space.Id(),
|
|
||||||
Identity: s.account.Account().Identity,
|
|
||||||
}
|
|
||||||
doc, err := s.cache.CreateDocument(context.Background(), space.Id(), payload)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
id = doc.Id()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) DeleteDocument(spaceId, documentId string) (err error) {
|
|
||||||
space, err := s.spaceService.GetSpace(context.Background(), spaceId)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return space.DeleteTree(context.Background(), documentId)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) AllDocumentIds(spaceId string) (ids []string, err error) {
|
|
||||||
space, err := s.spaceService.GetSpace(context.Background(), spaceId)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ids = space.StoredIds()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) AllDocumentHeads(spaceId string) (ids []headsync.TreeHeads, err error) {
|
|
||||||
space, err := s.spaceService.GetSpace(context.Background(), spaceId)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ids = space.DebugAllHeads()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) AddText(spaceId, documentId, text string, isSnapshot bool) (root, head string, err error) {
|
|
||||||
doc, err := s.cache.GetDocument(context.Background(), spaceId, documentId)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return doc.AddText(text, isSnapshot)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) DumpDocumentTree(spaceId, documentId string) (dump string, err error) {
|
|
||||||
doc, err := s.cache.GetDocument(context.Background(), spaceId, documentId)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return doc.DebugDump()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) TreeParams(spaceId, documentId string) (root string, heads []string, err error) {
|
|
||||||
tr, err := s.cache.GetTree(context.Background(), spaceId, documentId)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return tr.Root().Id, tr.Heads(), nil
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
syntax = "proto3";
|
|
||||||
package textchange;
|
|
||||||
option go_package = "document/textchangeproto";
|
|
||||||
|
|
||||||
message TextContent {
|
|
||||||
oneof value {
|
|
||||||
TextAppend textAppend = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message TextAppend {
|
|
||||||
string text = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message TextSnapshot {
|
|
||||||
string text = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message TextData {
|
|
||||||
repeated TextContent content = 1;
|
|
||||||
TextSnapshot snapshot = 2;
|
|
||||||
}
|
|
|
@ -1,968 +0,0 @@
|
||||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
|
||||||
// source: document/textchangeproto/protos/textchange.proto
|
|
||||||
|
|
||||||
package textchangeproto
|
|
||||||
|
|
||||||
import (
|
|
||||||
fmt "fmt"
|
|
||||||
proto "github.com/gogo/protobuf/proto"
|
|
||||||
io "io"
|
|
||||||
math "math"
|
|
||||||
math_bits "math/bits"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
|
||||||
var _ = proto.Marshal
|
|
||||||
var _ = fmt.Errorf
|
|
||||||
var _ = math.Inf
|
|
||||||
|
|
||||||
// This is a compile-time assertion to ensure that this generated file
|
|
||||||
// is compatible with the proto package it is being compiled against.
|
|
||||||
// A compilation error at this line likely means your copy of the
|
|
||||||
// proto package needs to be updated.
|
|
||||||
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
|
|
||||||
|
|
||||||
type TextContent struct {
|
|
||||||
// Types that are valid to be assigned to Value:
|
|
||||||
//
|
|
||||||
// *TextContent_TextAppend
|
|
||||||
Value isTextContent_Value `protobuf_oneof:"value"`
|
|
||||||
}
|
|
||||||
|
|
||||||
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_44a0c2b66e6c4b48, []int{0}
|
|
||||||
}
|
|
||||||
func (m *TextContent) XXX_Unmarshal(b []byte) error {
|
|
||||||
return m.Unmarshal(b)
|
|
||||||
}
|
|
||||||
func (m *TextContent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
||||||
if deterministic {
|
|
||||||
return xxx_messageInfo_TextContent.Marshal(b, m, deterministic)
|
|
||||||
} else {
|
|
||||||
b = b[:cap(b)]
|
|
||||||
n, err := m.MarshalToSizedBuffer(b)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return b[:n], nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func (m *TextContent) XXX_Merge(src proto.Message) {
|
|
||||||
xxx_messageInfo_TextContent.Merge(m, src)
|
|
||||||
}
|
|
||||||
func (m *TextContent) XXX_Size() int {
|
|
||||||
return m.Size()
|
|
||||||
}
|
|
||||||
func (m *TextContent) XXX_DiscardUnknown() {
|
|
||||||
xxx_messageInfo_TextContent.DiscardUnknown(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
var xxx_messageInfo_TextContent proto.InternalMessageInfo
|
|
||||||
|
|
||||||
type isTextContent_Value interface {
|
|
||||||
isTextContent_Value()
|
|
||||||
MarshalTo([]byte) (int, error)
|
|
||||||
Size() int
|
|
||||||
}
|
|
||||||
|
|
||||||
type TextContent_TextAppend struct {
|
|
||||||
TextAppend *TextAppend `protobuf:"bytes,1,opt,name=textAppend,proto3,oneof" json:"textAppend,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*TextContent_TextAppend) isTextContent_Value() {}
|
|
||||||
|
|
||||||
func (m *TextContent) GetValue() isTextContent_Value {
|
|
||||||
if m != nil {
|
|
||||||
return m.Value
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *TextContent) GetTextAppend() *TextAppend {
|
|
||||||
if x, ok := m.GetValue().(*TextContent_TextAppend); ok {
|
|
||||||
return x.TextAppend
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// XXX_OneofWrappers is for the internal use of the proto package.
|
|
||||||
func (*TextContent) XXX_OneofWrappers() []interface{} {
|
|
||||||
return []interface{}{
|
|
||||||
(*TextContent_TextAppend)(nil),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type TextAppend struct {
|
|
||||||
Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
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_44a0c2b66e6c4b48, []int{1}
|
|
||||||
}
|
|
||||||
func (m *TextAppend) XXX_Unmarshal(b []byte) error {
|
|
||||||
return m.Unmarshal(b)
|
|
||||||
}
|
|
||||||
func (m *TextAppend) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
||||||
if deterministic {
|
|
||||||
return xxx_messageInfo_TextAppend.Marshal(b, m, deterministic)
|
|
||||||
} else {
|
|
||||||
b = b[:cap(b)]
|
|
||||||
n, err := m.MarshalToSizedBuffer(b)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return b[:n], nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func (m *TextAppend) XXX_Merge(src proto.Message) {
|
|
||||||
xxx_messageInfo_TextAppend.Merge(m, src)
|
|
||||||
}
|
|
||||||
func (m *TextAppend) XXX_Size() int {
|
|
||||||
return m.Size()
|
|
||||||
}
|
|
||||||
func (m *TextAppend) XXX_DiscardUnknown() {
|
|
||||||
xxx_messageInfo_TextAppend.DiscardUnknown(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
var xxx_messageInfo_TextAppend proto.InternalMessageInfo
|
|
||||||
|
|
||||||
func (m *TextAppend) GetText() string {
|
|
||||||
if m != nil {
|
|
||||||
return m.Text
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type TextSnapshot struct {
|
|
||||||
Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
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_44a0c2b66e6c4b48, []int{2}
|
|
||||||
}
|
|
||||||
func (m *TextSnapshot) XXX_Unmarshal(b []byte) error {
|
|
||||||
return m.Unmarshal(b)
|
|
||||||
}
|
|
||||||
func (m *TextSnapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
||||||
if deterministic {
|
|
||||||
return xxx_messageInfo_TextSnapshot.Marshal(b, m, deterministic)
|
|
||||||
} else {
|
|
||||||
b = b[:cap(b)]
|
|
||||||
n, err := m.MarshalToSizedBuffer(b)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return b[:n], nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func (m *TextSnapshot) XXX_Merge(src proto.Message) {
|
|
||||||
xxx_messageInfo_TextSnapshot.Merge(m, src)
|
|
||||||
}
|
|
||||||
func (m *TextSnapshot) XXX_Size() int {
|
|
||||||
return m.Size()
|
|
||||||
}
|
|
||||||
func (m *TextSnapshot) XXX_DiscardUnknown() {
|
|
||||||
xxx_messageInfo_TextSnapshot.DiscardUnknown(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
var xxx_messageInfo_TextSnapshot proto.InternalMessageInfo
|
|
||||||
|
|
||||||
func (m *TextSnapshot) GetText() string {
|
|
||||||
if m != nil {
|
|
||||||
return m.Text
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type TextData struct {
|
|
||||||
Content []*TextContent `protobuf:"bytes,1,rep,name=content,proto3" json:"content,omitempty"`
|
|
||||||
Snapshot *TextSnapshot `protobuf:"bytes,2,opt,name=snapshot,proto3" json:"snapshot,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
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_44a0c2b66e6c4b48, []int{3}
|
|
||||||
}
|
|
||||||
func (m *TextData) XXX_Unmarshal(b []byte) error {
|
|
||||||
return m.Unmarshal(b)
|
|
||||||
}
|
|
||||||
func (m *TextData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
||||||
if deterministic {
|
|
||||||
return xxx_messageInfo_TextData.Marshal(b, m, deterministic)
|
|
||||||
} else {
|
|
||||||
b = b[:cap(b)]
|
|
||||||
n, err := m.MarshalToSizedBuffer(b)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return b[:n], nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func (m *TextData) XXX_Merge(src proto.Message) {
|
|
||||||
xxx_messageInfo_TextData.Merge(m, src)
|
|
||||||
}
|
|
||||||
func (m *TextData) XXX_Size() int {
|
|
||||||
return m.Size()
|
|
||||||
}
|
|
||||||
func (m *TextData) XXX_DiscardUnknown() {
|
|
||||||
xxx_messageInfo_TextData.DiscardUnknown(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
var xxx_messageInfo_TextData proto.InternalMessageInfo
|
|
||||||
|
|
||||||
func (m *TextData) GetContent() []*TextContent {
|
|
||||||
if m != nil {
|
|
||||||
return m.Content
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *TextData) GetSnapshot() *TextSnapshot {
|
|
||||||
if m != nil {
|
|
||||||
return m.Snapshot
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
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("document/textchangeproto/protos/textchange.proto", fileDescriptor_44a0c2b66e6c4b48)
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
|
||||||
size := m.Size()
|
|
||||||
dAtA = make([]byte, size)
|
|
||||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return dAtA[:n], nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *TextContent) MarshalTo(dAtA []byte) (int, error) {
|
|
||||||
size := m.Size()
|
|
||||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *TextContent) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|
||||||
i := len(dAtA)
|
|
||||||
_ = i
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
if m.Value != nil {
|
|
||||||
{
|
|
||||||
size := m.Value.Size()
|
|
||||||
i -= size
|
|
||||||
if _, err := m.Value.MarshalTo(dAtA[i:]); err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return len(dAtA) - i, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *TextContent_TextAppend) MarshalTo(dAtA []byte) (int, error) {
|
|
||||||
size := m.Size()
|
|
||||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *TextContent_TextAppend) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|
||||||
i := len(dAtA)
|
|
||||||
if m.TextAppend != nil {
|
|
||||||
{
|
|
||||||
size, err := m.TextAppend.MarshalToSizedBuffer(dAtA[:i])
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
i -= size
|
|
||||||
i = encodeVarintTextchange(dAtA, i, uint64(size))
|
|
||||||
}
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0xa
|
|
||||||
}
|
|
||||||
return len(dAtA) - i, nil
|
|
||||||
}
|
|
||||||
func (m *TextAppend) Marshal() (dAtA []byte, err error) {
|
|
||||||
size := m.Size()
|
|
||||||
dAtA = make([]byte, size)
|
|
||||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return dAtA[:n], nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *TextAppend) MarshalTo(dAtA []byte) (int, error) {
|
|
||||||
size := m.Size()
|
|
||||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *TextAppend) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|
||||||
i := len(dAtA)
|
|
||||||
_ = i
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
if len(m.Text) > 0 {
|
|
||||||
i -= len(m.Text)
|
|
||||||
copy(dAtA[i:], m.Text)
|
|
||||||
i = encodeVarintTextchange(dAtA, i, uint64(len(m.Text)))
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0xa
|
|
||||||
}
|
|
||||||
return len(dAtA) - i, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *TextSnapshot) Marshal() (dAtA []byte, err error) {
|
|
||||||
size := m.Size()
|
|
||||||
dAtA = make([]byte, size)
|
|
||||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return dAtA[:n], nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *TextSnapshot) MarshalTo(dAtA []byte) (int, error) {
|
|
||||||
size := m.Size()
|
|
||||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *TextSnapshot) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|
||||||
i := len(dAtA)
|
|
||||||
_ = i
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
if len(m.Text) > 0 {
|
|
||||||
i -= len(m.Text)
|
|
||||||
copy(dAtA[i:], m.Text)
|
|
||||||
i = encodeVarintTextchange(dAtA, i, uint64(len(m.Text)))
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0xa
|
|
||||||
}
|
|
||||||
return len(dAtA) - i, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *TextData) Marshal() (dAtA []byte, err error) {
|
|
||||||
size := m.Size()
|
|
||||||
dAtA = make([]byte, size)
|
|
||||||
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return dAtA[:n], nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *TextData) MarshalTo(dAtA []byte) (int, error) {
|
|
||||||
size := m.Size()
|
|
||||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *TextData) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|
||||||
i := len(dAtA)
|
|
||||||
_ = i
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
if m.Snapshot != nil {
|
|
||||||
{
|
|
||||||
size, err := m.Snapshot.MarshalToSizedBuffer(dAtA[:i])
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
i -= size
|
|
||||||
i = encodeVarintTextchange(dAtA, i, uint64(size))
|
|
||||||
}
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0x12
|
|
||||||
}
|
|
||||||
if len(m.Content) > 0 {
|
|
||||||
for iNdEx := len(m.Content) - 1; iNdEx >= 0; iNdEx-- {
|
|
||||||
{
|
|
||||||
size, err := m.Content[iNdEx].MarshalToSizedBuffer(dAtA[:i])
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
i -= size
|
|
||||||
i = encodeVarintTextchange(dAtA, i, uint64(size))
|
|
||||||
}
|
|
||||||
i--
|
|
||||||
dAtA[i] = 0xa
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return len(dAtA) - i, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func encodeVarintTextchange(dAtA []byte, offset int, v uint64) int {
|
|
||||||
offset -= sovTextchange(v)
|
|
||||||
base := offset
|
|
||||||
for v >= 1<<7 {
|
|
||||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
|
||||||
v >>= 7
|
|
||||||
offset++
|
|
||||||
}
|
|
||||||
dAtA[offset] = uint8(v)
|
|
||||||
return base
|
|
||||||
}
|
|
||||||
func (m *TextContent) Size() (n int) {
|
|
||||||
if m == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
if m.Value != nil {
|
|
||||||
n += m.Value.Size()
|
|
||||||
}
|
|
||||||
return n
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *TextContent_TextAppend) Size() (n int) {
|
|
||||||
if m == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
if m.TextAppend != nil {
|
|
||||||
l = m.TextAppend.Size()
|
|
||||||
n += 1 + l + sovTextchange(uint64(l))
|
|
||||||
}
|
|
||||||
return n
|
|
||||||
}
|
|
||||||
func (m *TextAppend) Size() (n int) {
|
|
||||||
if m == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
l = len(m.Text)
|
|
||||||
if l > 0 {
|
|
||||||
n += 1 + l + sovTextchange(uint64(l))
|
|
||||||
}
|
|
||||||
return n
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *TextSnapshot) Size() (n int) {
|
|
||||||
if m == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
l = len(m.Text)
|
|
||||||
if l > 0 {
|
|
||||||
n += 1 + l + sovTextchange(uint64(l))
|
|
||||||
}
|
|
||||||
return n
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *TextData) Size() (n int) {
|
|
||||||
if m == nil {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
var l int
|
|
||||||
_ = l
|
|
||||||
if len(m.Content) > 0 {
|
|
||||||
for _, e := range m.Content {
|
|
||||||
l = e.Size()
|
|
||||||
n += 1 + l + sovTextchange(uint64(l))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if m.Snapshot != nil {
|
|
||||||
l = m.Snapshot.Size()
|
|
||||||
n += 1 + l + sovTextchange(uint64(l))
|
|
||||||
}
|
|
||||||
return n
|
|
||||||
}
|
|
||||||
|
|
||||||
func sovTextchange(x uint64) (n int) {
|
|
||||||
return (math_bits.Len64(x|1) + 6) / 7
|
|
||||||
}
|
|
||||||
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)
|
|
||||||
iNdEx := 0
|
|
||||||
for iNdEx < l {
|
|
||||||
preIndex := iNdEx
|
|
||||||
var wire uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowTextchange
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
wire |= uint64(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fieldNum := int32(wire >> 3)
|
|
||||||
wireType := int(wire & 0x7)
|
|
||||||
if wireType == 4 {
|
|
||||||
return fmt.Errorf("proto: TextContent: wiretype end group for non-group")
|
|
||||||
}
|
|
||||||
if fieldNum <= 0 {
|
|
||||||
return fmt.Errorf("proto: TextContent: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
||||||
}
|
|
||||||
switch fieldNum {
|
|
||||||
case 1:
|
|
||||||
if wireType != 2 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field TextAppend", wireType)
|
|
||||||
}
|
|
||||||
var msglen int
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowTextchange
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
msglen |= int(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if msglen < 0 {
|
|
||||||
return ErrInvalidLengthTextchange
|
|
||||||
}
|
|
||||||
postIndex := iNdEx + msglen
|
|
||||||
if postIndex < 0 {
|
|
||||||
return ErrInvalidLengthTextchange
|
|
||||||
}
|
|
||||||
if postIndex > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
v := &TextAppend{}
|
|
||||||
if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
m.Value = &TextContent_TextAppend{v}
|
|
||||||
iNdEx = postIndex
|
|
||||||
default:
|
|
||||||
iNdEx = preIndex
|
|
||||||
skippy, err := skipTextchange(dAtA[iNdEx:])
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTextchange
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
iNdEx += skippy
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if iNdEx > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (m *TextAppend) Unmarshal(dAtA []byte) error {
|
|
||||||
l := len(dAtA)
|
|
||||||
iNdEx := 0
|
|
||||||
for iNdEx < l {
|
|
||||||
preIndex := iNdEx
|
|
||||||
var wire uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowTextchange
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
wire |= uint64(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fieldNum := int32(wire >> 3)
|
|
||||||
wireType := int(wire & 0x7)
|
|
||||||
if wireType == 4 {
|
|
||||||
return fmt.Errorf("proto: TextAppend: wiretype end group for non-group")
|
|
||||||
}
|
|
||||||
if fieldNum <= 0 {
|
|
||||||
return fmt.Errorf("proto: TextAppend: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
||||||
}
|
|
||||||
switch fieldNum {
|
|
||||||
case 1:
|
|
||||||
if wireType != 2 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Text", wireType)
|
|
||||||
}
|
|
||||||
var stringLen uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowTextchange
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
stringLen |= uint64(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
intStringLen := int(stringLen)
|
|
||||||
if intStringLen < 0 {
|
|
||||||
return ErrInvalidLengthTextchange
|
|
||||||
}
|
|
||||||
postIndex := iNdEx + intStringLen
|
|
||||||
if postIndex < 0 {
|
|
||||||
return ErrInvalidLengthTextchange
|
|
||||||
}
|
|
||||||
if postIndex > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
m.Text = string(dAtA[iNdEx:postIndex])
|
|
||||||
iNdEx = postIndex
|
|
||||||
default:
|
|
||||||
iNdEx = preIndex
|
|
||||||
skippy, err := skipTextchange(dAtA[iNdEx:])
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTextchange
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
iNdEx += skippy
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if iNdEx > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (m *TextSnapshot) Unmarshal(dAtA []byte) error {
|
|
||||||
l := len(dAtA)
|
|
||||||
iNdEx := 0
|
|
||||||
for iNdEx < l {
|
|
||||||
preIndex := iNdEx
|
|
||||||
var wire uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowTextchange
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
wire |= uint64(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fieldNum := int32(wire >> 3)
|
|
||||||
wireType := int(wire & 0x7)
|
|
||||||
if wireType == 4 {
|
|
||||||
return fmt.Errorf("proto: TextSnapshot: wiretype end group for non-group")
|
|
||||||
}
|
|
||||||
if fieldNum <= 0 {
|
|
||||||
return fmt.Errorf("proto: TextSnapshot: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
||||||
}
|
|
||||||
switch fieldNum {
|
|
||||||
case 1:
|
|
||||||
if wireType != 2 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Text", wireType)
|
|
||||||
}
|
|
||||||
var stringLen uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowTextchange
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
stringLen |= uint64(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
intStringLen := int(stringLen)
|
|
||||||
if intStringLen < 0 {
|
|
||||||
return ErrInvalidLengthTextchange
|
|
||||||
}
|
|
||||||
postIndex := iNdEx + intStringLen
|
|
||||||
if postIndex < 0 {
|
|
||||||
return ErrInvalidLengthTextchange
|
|
||||||
}
|
|
||||||
if postIndex > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
m.Text = string(dAtA[iNdEx:postIndex])
|
|
||||||
iNdEx = postIndex
|
|
||||||
default:
|
|
||||||
iNdEx = preIndex
|
|
||||||
skippy, err := skipTextchange(dAtA[iNdEx:])
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTextchange
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
iNdEx += skippy
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if iNdEx > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (m *TextData) Unmarshal(dAtA []byte) error {
|
|
||||||
l := len(dAtA)
|
|
||||||
iNdEx := 0
|
|
||||||
for iNdEx < l {
|
|
||||||
preIndex := iNdEx
|
|
||||||
var wire uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowTextchange
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
wire |= uint64(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fieldNum := int32(wire >> 3)
|
|
||||||
wireType := int(wire & 0x7)
|
|
||||||
if wireType == 4 {
|
|
||||||
return fmt.Errorf("proto: TextData: wiretype end group for non-group")
|
|
||||||
}
|
|
||||||
if fieldNum <= 0 {
|
|
||||||
return fmt.Errorf("proto: TextData: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
||||||
}
|
|
||||||
switch fieldNum {
|
|
||||||
case 1:
|
|
||||||
if wireType != 2 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType)
|
|
||||||
}
|
|
||||||
var msglen int
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowTextchange
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
msglen |= int(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if msglen < 0 {
|
|
||||||
return ErrInvalidLengthTextchange
|
|
||||||
}
|
|
||||||
postIndex := iNdEx + msglen
|
|
||||||
if postIndex < 0 {
|
|
||||||
return ErrInvalidLengthTextchange
|
|
||||||
}
|
|
||||||
if postIndex > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
m.Content = append(m.Content, &TextContent{})
|
|
||||||
if err := m.Content[len(m.Content)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
iNdEx = postIndex
|
|
||||||
case 2:
|
|
||||||
if wireType != 2 {
|
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Snapshot", wireType)
|
|
||||||
}
|
|
||||||
var msglen int
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return ErrIntOverflowTextchange
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
msglen |= int(b&0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if msglen < 0 {
|
|
||||||
return ErrInvalidLengthTextchange
|
|
||||||
}
|
|
||||||
postIndex := iNdEx + msglen
|
|
||||||
if postIndex < 0 {
|
|
||||||
return ErrInvalidLengthTextchange
|
|
||||||
}
|
|
||||||
if postIndex > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
if m.Snapshot == nil {
|
|
||||||
m.Snapshot = &TextSnapshot{}
|
|
||||||
}
|
|
||||||
if err := m.Snapshot.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
iNdEx = postIndex
|
|
||||||
default:
|
|
||||||
iNdEx = preIndex
|
|
||||||
skippy, err := skipTextchange(dAtA[iNdEx:])
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
|
||||||
return ErrInvalidLengthTextchange
|
|
||||||
}
|
|
||||||
if (iNdEx + skippy) > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
iNdEx += skippy
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if iNdEx > l {
|
|
||||||
return io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func skipTextchange(dAtA []byte) (n int, err error) {
|
|
||||||
l := len(dAtA)
|
|
||||||
iNdEx := 0
|
|
||||||
depth := 0
|
|
||||||
for iNdEx < l {
|
|
||||||
var wire uint64
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return 0, ErrIntOverflowTextchange
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return 0, io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
wire |= (uint64(b) & 0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
wireType := int(wire & 0x7)
|
|
||||||
switch wireType {
|
|
||||||
case 0:
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return 0, ErrIntOverflowTextchange
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return 0, io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
iNdEx++
|
|
||||||
if dAtA[iNdEx-1] < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
iNdEx += 8
|
|
||||||
case 2:
|
|
||||||
var length int
|
|
||||||
for shift := uint(0); ; shift += 7 {
|
|
||||||
if shift >= 64 {
|
|
||||||
return 0, ErrIntOverflowTextchange
|
|
||||||
}
|
|
||||||
if iNdEx >= l {
|
|
||||||
return 0, io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
b := dAtA[iNdEx]
|
|
||||||
iNdEx++
|
|
||||||
length |= (int(b) & 0x7F) << shift
|
|
||||||
if b < 0x80 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if length < 0 {
|
|
||||||
return 0, ErrInvalidLengthTextchange
|
|
||||||
}
|
|
||||||
iNdEx += length
|
|
||||||
case 3:
|
|
||||||
depth++
|
|
||||||
case 4:
|
|
||||||
if depth == 0 {
|
|
||||||
return 0, ErrUnexpectedEndOfGroupTextchange
|
|
||||||
}
|
|
||||||
depth--
|
|
||||||
case 5:
|
|
||||||
iNdEx += 4
|
|
||||||
default:
|
|
||||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
|
||||||
}
|
|
||||||
if iNdEx < 0 {
|
|
||||||
return 0, ErrInvalidLengthTextchange
|
|
||||||
}
|
|
||||||
if depth == 0 {
|
|
||||||
return iNdEx, nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0, io.ErrUnexpectedEOF
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
ErrInvalidLengthTextchange = fmt.Errorf("proto: negative length found during unmarshaling")
|
|
||||||
ErrIntOverflowTextchange = fmt.Errorf("proto: integer overflow")
|
|
||||||
ErrUnexpectedEndOfGroupTextchange = fmt.Errorf("proto: unexpected end of group")
|
|
||||||
)
|
|
|
@ -1,114 +0,0 @@
|
||||||
package textdocument
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
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/object/tree/objecttree"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/synctree/updatelistener"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treestorage"
|
|
||||||
"github.com/gogo/protobuf/proto"
|
|
||||||
)
|
|
||||||
|
|
||||||
type TextDocument interface {
|
|
||||||
objecttree.ObjectTree
|
|
||||||
InnerTree() objecttree.ObjectTree
|
|
||||||
AddText(text string, isSnapshot bool) (string, string, error)
|
|
||||||
Text() (string, error)
|
|
||||||
TreeDump() string
|
|
||||||
Close() error
|
|
||||||
}
|
|
||||||
|
|
||||||
type textDocument struct {
|
|
||||||
objecttree.ObjectTree
|
|
||||||
account accountservice.Service
|
|
||||||
}
|
|
||||||
|
|
||||||
func CreateTextDocument(
|
|
||||||
ctx context.Context,
|
|
||||||
space commonspace.Space,
|
|
||||||
payload treestorage.TreeStorageCreatePayload,
|
|
||||||
listener updatelistener.UpdateListener,
|
|
||||||
account accountservice.Service) (doc TextDocument, err error) {
|
|
||||||
t, err := space.PutTree(ctx, payload, listener)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return &textDocument{
|
|
||||||
ObjectTree: t,
|
|
||||||
account: account,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
return &textDocument{
|
|
||||||
ObjectTree: t,
|
|
||||||
account: account,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *textDocument) InnerTree() objecttree.ObjectTree {
|
|
||||||
return t.ObjectTree
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *textDocument) AddText(text string, isSnapshot bool) (root, head string, err error) {
|
|
||||||
content := &textchange.TextContent_TextAppend{
|
|
||||||
TextAppend: &textchange.TextAppend{Text: text},
|
|
||||||
}
|
|
||||||
change := &textchange.TextData{
|
|
||||||
Content: []*textchange.TextContent{
|
|
||||||
{content},
|
|
||||||
},
|
|
||||||
Snapshot: nil,
|
|
||||||
}
|
|
||||||
res, err := change.Marshal()
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
t.Lock()
|
|
||||||
defer t.Unlock()
|
|
||||||
addRes, err := t.AddContent(context.Background(), objecttree.SignableChangeContent{
|
|
||||||
Data: res,
|
|
||||||
Key: t.account.Account().SignKey,
|
|
||||||
Identity: t.account.Account().Identity,
|
|
||||||
IsSnapshot: isSnapshot,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
root = t.Root().Id
|
|
||||||
head = addRes.Heads[0]
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *textDocument) Text() (text string, err error) {
|
|
||||||
t.RLock()
|
|
||||||
defer t.RUnlock()
|
|
||||||
|
|
||||||
err = t.IterateRoot(
|
|
||||||
func(decrypted []byte) (any, error) {
|
|
||||||
textChange := &textchange.TextData{}
|
|
||||||
err = proto.Unmarshal(decrypted, textChange)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
for _, cnt := range textChange.Content {
|
|
||||||
if cnt.GetTextAppend() != nil {
|
|
||||||
text += cnt.GetTextAppend().Text
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return textChange, nil
|
|
||||||
}, func(change *objecttree.Change) bool {
|
|
||||||
return true
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *textDocument) TreeDump() string {
|
|
||||||
return t.TreeDump()
|
|
||||||
}
|
|
|
@ -1,255 +0,0 @@
|
||||||
package badgerfilestore
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"errors"
|
|
||||||
"github.com/dgraph-io/badger/v3"
|
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
"sync"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
const keyIndexPrefix = "files/indexes/"
|
|
||||||
|
|
||||||
type Op string
|
|
||||||
|
|
||||||
const (
|
|
||||||
OpAdd Op = "add"
|
|
||||||
OpDelete Op = "del"
|
|
||||||
OpLoad Op = "load"
|
|
||||||
)
|
|
||||||
|
|
||||||
func NewFileBadgerIndex(db *badger.DB) *FileBadgerIndex {
|
|
||||||
return &FileBadgerIndex{
|
|
||||||
db: db,
|
|
||||||
workCh: make(chan struct{}, 1),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var cidsPool = &sync.Pool{
|
|
||||||
New: func() any {
|
|
||||||
return &Cids{}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileBadgerIndex struct {
|
|
||||||
db *badger.DB
|
|
||||||
workCh chan struct{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (i *FileBadgerIndex) Add(cids *Cids) error {
|
|
||||||
addTimeBin, _ := time.Now().MarshalBinary()
|
|
||||||
defer i.pingWorkCh()
|
|
||||||
return i.db.Update(func(txn *badger.Txn) error {
|
|
||||||
keys := cids.Keys()
|
|
||||||
for _, k := range keys {
|
|
||||||
if err := txn.Set(k, addTimeBin); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func (i *FileBadgerIndex) Done(cids *Cids) (err error) {
|
|
||||||
if len(cids.SpaceOps) == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return i.db.Update(func(txn *badger.Txn) error {
|
|
||||||
keys := cids.Keys()
|
|
||||||
for _, k := range keys {
|
|
||||||
if err := txn.Delete(k); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
}
|
|
||||||
func (i *FileBadgerIndex) List(limit int) (cids *Cids, err error) {
|
|
||||||
cids = NewCids()
|
|
||||||
err = i.db.View(func(txn *badger.Txn) error {
|
|
||||||
it := txn.NewIterator(badger.IteratorOptions{
|
|
||||||
PrefetchSize: limit,
|
|
||||||
PrefetchValues: false,
|
|
||||||
Prefix: []byte(keyIndexPrefix),
|
|
||||||
})
|
|
||||||
defer it.Close()
|
|
||||||
var l int
|
|
||||||
for it.Rewind(); it.Valid(); it.Next() {
|
|
||||||
e := cids.AddKey(it.Item().Key())
|
|
||||||
if e == nil {
|
|
||||||
l++
|
|
||||||
if l == limit {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (i *FileBadgerIndex) Len() (l int, err error) {
|
|
||||||
err = i.db.View(func(txn *badger.Txn) error {
|
|
||||||
it := txn.NewIterator(badger.IteratorOptions{
|
|
||||||
PrefetchSize: 100,
|
|
||||||
PrefetchValues: false,
|
|
||||||
Prefix: []byte(keyIndexPrefix),
|
|
||||||
})
|
|
||||||
defer it.Close()
|
|
||||||
var l int
|
|
||||||
for it.Rewind(); it.Valid(); it.Next() {
|
|
||||||
l++
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (i *FileBadgerIndex) pingWorkCh() {
|
|
||||||
select {
|
|
||||||
case i.workCh <- struct{}{}:
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (i *FileBadgerIndex) HasWorkCh() chan struct{} {
|
|
||||||
l, err := i.Len()
|
|
||||||
if err != nil {
|
|
||||||
return i.workCh
|
|
||||||
}
|
|
||||||
if l > 0 {
|
|
||||||
i.pingWorkCh()
|
|
||||||
}
|
|
||||||
return i.workCh
|
|
||||||
}
|
|
||||||
|
|
||||||
var errInvalidKey = errors.New("invalid key")
|
|
||||||
|
|
||||||
var sep = []byte("/")
|
|
||||||
|
|
||||||
func parseCIDOp(key []byte) (spaceId string, op Op, k cid.Cid, err error) {
|
|
||||||
if len(key) <= len(keyIndexPrefix) {
|
|
||||||
err = errInvalidKey
|
|
||||||
return
|
|
||||||
}
|
|
||||||
key = key[len(keyIndexPrefix):]
|
|
||||||
fi := bytes.Index(key, sep)
|
|
||||||
if fi < 0 {
|
|
||||||
err = errInvalidKey
|
|
||||||
return
|
|
||||||
}
|
|
||||||
spaceId = string(key[:fi])
|
|
||||||
key = key[fi+1:]
|
|
||||||
fi = bytes.Index(key, sep)
|
|
||||||
if fi < 0 {
|
|
||||||
err = errInvalidKey
|
|
||||||
return
|
|
||||||
}
|
|
||||||
op = Op(key[:fi])
|
|
||||||
k, err = cid.Cast(key[fi+1:])
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewCids() *Cids {
|
|
||||||
return cidsPool.Get().(*Cids)
|
|
||||||
}
|
|
||||||
|
|
||||||
type SpaceCidOps struct {
|
|
||||||
SpaceId string
|
|
||||||
Add []cid.Cid
|
|
||||||
Delete []cid.Cid
|
|
||||||
Load []cid.Cid
|
|
||||||
}
|
|
||||||
|
|
||||||
type Cids struct {
|
|
||||||
SpaceOps []SpaceCidOps
|
|
||||||
keysBuf [][]byte
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Cids) Add(spaceId string, op Op, k cid.Cid) {
|
|
||||||
var spaceIndex = -1
|
|
||||||
for i, so := range c.SpaceOps {
|
|
||||||
if so.SpaceId == spaceId {
|
|
||||||
spaceIndex = i
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if spaceIndex == -1 {
|
|
||||||
spaceIndex = len(c.SpaceOps)
|
|
||||||
if len(c.SpaceOps) < cap(c.SpaceOps) {
|
|
||||||
c.SpaceOps = c.SpaceOps[0 : len(c.SpaceOps)+1]
|
|
||||||
c.SpaceOps[spaceIndex].SpaceId = spaceId
|
|
||||||
} else {
|
|
||||||
c.SpaceOps = append(c.SpaceOps, SpaceCidOps{SpaceId: spaceId})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch op {
|
|
||||||
case OpAdd:
|
|
||||||
c.SpaceOps[spaceIndex].Add = append(c.SpaceOps[spaceIndex].Add, k)
|
|
||||||
case OpDelete:
|
|
||||||
c.SpaceOps[spaceIndex].Delete = append(c.SpaceOps[spaceIndex].Delete, k)
|
|
||||||
case OpLoad:
|
|
||||||
c.SpaceOps[spaceIndex].Load = append(c.SpaceOps[spaceIndex].Load, k)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Cids) Keys() [][]byte {
|
|
||||||
addKey := func(spaceId string, k cid.Cid, op Op) {
|
|
||||||
if len(c.keysBuf) < cap(c.keysBuf) {
|
|
||||||
c.keysBuf = c.keysBuf[:len(c.keysBuf)+1]
|
|
||||||
} else {
|
|
||||||
c.keysBuf = append(c.keysBuf, nil)
|
|
||||||
}
|
|
||||||
ki := len(c.keysBuf) - 1
|
|
||||||
buf := bytes.NewBuffer(c.keysBuf[ki][:0])
|
|
||||||
buf.WriteString(keyIndexPrefix)
|
|
||||||
buf.WriteString(spaceId)
|
|
||||||
buf.WriteString("/")
|
|
||||||
buf.WriteString(string(op))
|
|
||||||
buf.WriteString("/")
|
|
||||||
buf.WriteString(k.KeyString())
|
|
||||||
c.keysBuf[ki] = buf.Bytes()
|
|
||||||
}
|
|
||||||
for _, sop := range c.SpaceOps {
|
|
||||||
for _, k := range sop.Add {
|
|
||||||
addKey(sop.SpaceId, k, OpAdd)
|
|
||||||
}
|
|
||||||
for _, k := range sop.Delete {
|
|
||||||
addKey(sop.SpaceId, k, OpDelete)
|
|
||||||
}
|
|
||||||
for _, k := range sop.Load {
|
|
||||||
addKey(sop.SpaceId, k, OpLoad)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return c.keysBuf
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Cids) AddKey(key []byte) error {
|
|
||||||
spaceId, op, k, err := parseCIDOp(key)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
c.Add(spaceId, op, k)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Cids) Len() (l int) {
|
|
||||||
for _, so := range c.SpaceOps {
|
|
||||||
l += len(so.Load)
|
|
||||||
l += len(so.Delete)
|
|
||||||
l += len(so.Add)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Cids) Release() {
|
|
||||||
c.keysBuf = c.keysBuf[:0]
|
|
||||||
for i, sop := range c.SpaceOps {
|
|
||||||
c.SpaceOps[i].Add = sop.Add[:0]
|
|
||||||
c.SpaceOps[i].Delete = sop.Delete[:0]
|
|
||||||
c.SpaceOps[i].Load = sop.Load[:0]
|
|
||||||
}
|
|
||||||
c.SpaceOps = c.SpaceOps[:0]
|
|
||||||
cidsPool.Put(c)
|
|
||||||
}
|
|
|
@ -1,104 +0,0 @@
|
||||||
package badgerfilestore
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"fmt"
|
|
||||||
"github.com/dgraph-io/badger/v3"
|
|
||||||
blocks "github.com/ipfs/go-block-format"
|
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
"os"
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestFileBadgerIndex_Add(t *testing.T) {
|
|
||||||
tmpDir, err := os.MkdirTemp("", "badgerfileindextest_*")
|
|
||||||
require.NoError(t, err)
|
|
||||||
defer os.RemoveAll(tmpDir)
|
|
||||||
db, err := badger.Open(badger.DefaultOptions(tmpDir))
|
|
||||||
require.NoError(t, err)
|
|
||||||
defer db.Close()
|
|
||||||
index := NewFileBadgerIndex(db)
|
|
||||||
var cids = NewCids()
|
|
||||||
defer cids.Release()
|
|
||||||
for _, spaceId := range []string{"space1", "space2"} {
|
|
||||||
for i := 0; i < 5; i++ {
|
|
||||||
cids.Add(spaceId, OpAdd, blocks.NewBlock([]byte(fmt.Sprint("add", i))).Cid())
|
|
||||||
}
|
|
||||||
for i := 0; i < 3; i++ {
|
|
||||||
cids.Add(spaceId, OpDelete, blocks.NewBlock([]byte(fmt.Sprint("del", i))).Cid())
|
|
||||||
}
|
|
||||||
for i := 0; i < 2; i++ {
|
|
||||||
cids.Add(spaceId, OpLoad, blocks.NewBlock([]byte(fmt.Sprint("load", i))).Cid())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
require.NoError(t, index.Add(cids))
|
|
||||||
|
|
||||||
cids, err = index.List(100)
|
|
||||||
require.NoError(t, err)
|
|
||||||
assert.Len(t, cids.SpaceOps, 2)
|
|
||||||
for _, s := range cids.SpaceOps {
|
|
||||||
assert.Len(t, s.Add, 5)
|
|
||||||
assert.Len(t, s.Delete, 3)
|
|
||||||
assert.Len(t, s.Load, 2)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCids_Add(t *testing.T) {
|
|
||||||
for i := 0; i < 3; i++ {
|
|
||||||
var bs = []blocks.Block{
|
|
||||||
blocks.NewBlock([]byte("1")),
|
|
||||||
blocks.NewBlock([]byte("2")),
|
|
||||||
blocks.NewBlock([]byte("3")),
|
|
||||||
blocks.NewBlock([]byte("4")),
|
|
||||||
blocks.NewBlock([]byte("5")),
|
|
||||||
}
|
|
||||||
cids := NewCids()
|
|
||||||
for _, b := range bs {
|
|
||||||
cids.Add("1", OpAdd, b.Cid())
|
|
||||||
}
|
|
||||||
keys := cids.Keys()
|
|
||||||
contains := func(c cid.Cid) bool {
|
|
||||||
for _, k := range keys {
|
|
||||||
if bytes.HasSuffix(k, c.Bytes()) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
for _, b := range bs {
|
|
||||||
assert.True(t, contains(b.Cid()))
|
|
||||||
}
|
|
||||||
kcids := NewCids()
|
|
||||||
for _, k := range keys {
|
|
||||||
require.NoError(t, kcids.AddKey(k))
|
|
||||||
}
|
|
||||||
|
|
||||||
require.Len(t, kcids.SpaceOps, 1)
|
|
||||||
assert.Equal(t, kcids.SpaceOps[0].Add, cids.SpaceOps[0].Add)
|
|
||||||
|
|
||||||
cids.Release()
|
|
||||||
kcids.Release()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func BenchmarkCids_Add(b *testing.B) {
|
|
||||||
var bs = []blocks.Block{
|
|
||||||
blocks.NewBlock([]byte("1")),
|
|
||||||
blocks.NewBlock([]byte("2")),
|
|
||||||
blocks.NewBlock([]byte("3")),
|
|
||||||
blocks.NewBlock([]byte("4")),
|
|
||||||
blocks.NewBlock([]byte("5")),
|
|
||||||
}
|
|
||||||
b.ReportAllocs()
|
|
||||||
b.ResetTimer()
|
|
||||||
for i := 0; i < b.N; i++ {
|
|
||||||
cids := NewCids()
|
|
||||||
for _, b := range bs {
|
|
||||||
cids.Add("1", OpAdd, b.Cid())
|
|
||||||
}
|
|
||||||
cids.Keys()
|
|
||||||
cids.Release()
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,135 +0,0 @@
|
||||||
package badgerfilestore
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonfile/fileblockstore"
|
|
||||||
"github.com/dgraph-io/badger/v3"
|
|
||||||
blocks "github.com/ipfs/go-block-format"
|
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
format "github.com/ipfs/go-ipld-format"
|
|
||||||
)
|
|
||||||
|
|
||||||
const keyPrefix = "files/blocks/"
|
|
||||||
|
|
||||||
func NewBadgerStorage(db *badger.DB) fileblockstore.BlockStoreLocal {
|
|
||||||
return &badgerStorage{db: db}
|
|
||||||
}
|
|
||||||
|
|
||||||
type badgerStorage struct {
|
|
||||||
db *badger.DB
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *badgerStorage) Get(ctx context.Context, k cid.Cid) (b blocks.Block, err error) {
|
|
||||||
err = f.db.View(func(txn *badger.Txn) (e error) {
|
|
||||||
it, e := txn.Get(key(k))
|
|
||||||
if e != nil {
|
|
||||||
return e
|
|
||||||
}
|
|
||||||
if b, e = blockFromItem(it); e != nil {
|
|
||||||
return e
|
|
||||||
}
|
|
||||||
return
|
|
||||||
})
|
|
||||||
if err == badger.ErrKeyNotFound {
|
|
||||||
err = &format.ErrNotFound{Cid: k}
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *badgerStorage) GetMany(ctx context.Context, ks []cid.Cid) <-chan blocks.Block {
|
|
||||||
var res = make(chan blocks.Block)
|
|
||||||
go func() {
|
|
||||||
defer close(res)
|
|
||||||
_ = f.db.View(func(txn *badger.Txn) error {
|
|
||||||
// TODO: log errors
|
|
||||||
for _, k := range ks {
|
|
||||||
it, gerr := txn.Get(key(k))
|
|
||||||
if gerr != nil {
|
|
||||||
return gerr
|
|
||||||
}
|
|
||||||
b, berr := blockFromItem(it)
|
|
||||||
if berr != nil {
|
|
||||||
return berr
|
|
||||||
}
|
|
||||||
res <- b
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
}()
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *badgerStorage) Add(ctx context.Context, bs []blocks.Block) error {
|
|
||||||
return f.db.Update(func(txn *badger.Txn) error {
|
|
||||||
for _, b := range bs {
|
|
||||||
if err := txn.Set(key(b.Cid()), b.RawData()); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *badgerStorage) Delete(ctx context.Context, c cid.Cid) error {
|
|
||||||
return f.db.Update(func(txn *badger.Txn) error {
|
|
||||||
return txn.Delete(key(c))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *badgerStorage) ExistsCids(ctx context.Context, ks []cid.Cid) (exists []cid.Cid, err error) {
|
|
||||||
err = f.db.View(func(txn *badger.Txn) error {
|
|
||||||
for _, k := range ks {
|
|
||||||
_, e := txn.Get(key(k))
|
|
||||||
if e == nil {
|
|
||||||
exists = append(exists, k)
|
|
||||||
} else if e != badger.ErrKeyNotFound {
|
|
||||||
return e
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *badgerStorage) NotExistsBlocks(ctx context.Context, bs []blocks.Block) (notExists []blocks.Block, err error) {
|
|
||||||
notExists = bs[:0]
|
|
||||||
err = f.db.View(func(txn *badger.Txn) error {
|
|
||||||
for _, b := range bs {
|
|
||||||
_, e := txn.Get(key(b.Cid()))
|
|
||||||
if e == badger.ErrKeyNotFound {
|
|
||||||
notExists = append(notExists, b)
|
|
||||||
} else if e != nil {
|
|
||||||
return e
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func key(c cid.Cid) []byte {
|
|
||||||
return []byte(keyPrefix + c.String())
|
|
||||||
}
|
|
||||||
|
|
||||||
func parseCID(key []byte) (cid.Cid, error) {
|
|
||||||
if len(key) <= len(keyPrefix) {
|
|
||||||
return cid.Cid{}, errInvalidKey
|
|
||||||
}
|
|
||||||
return cid.Decode(string(key[len(keyPrefix):]))
|
|
||||||
}
|
|
||||||
|
|
||||||
func blockFromItem(it *badger.Item) (b blocks.Block, err error) {
|
|
||||||
c, err := parseCID(it.Key())
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if err = it.Value(func(val []byte) error {
|
|
||||||
if b, err = blocks.NewBlockWithCid(val, c); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
|
@ -1,101 +0,0 @@
|
||||||
package badgerfilestore
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"github.com/dgraph-io/badger/v3"
|
|
||||||
blocks "github.com/ipfs/go-block-format"
|
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
"os"
|
|
||||||
"testing"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
var ctx = context.Background()
|
|
||||||
|
|
||||||
func TestBadgerStorage_Add(t *testing.T) {
|
|
||||||
tmpDir, err := os.MkdirTemp("", "badgerfilestore_*")
|
|
||||||
require.NoError(t, err)
|
|
||||||
defer os.RemoveAll(tmpDir)
|
|
||||||
db, err := badger.Open(badger.DefaultOptions(tmpDir))
|
|
||||||
require.NoError(t, err)
|
|
||||||
defer db.Close()
|
|
||||||
|
|
||||||
s := NewBadgerStorage(db)
|
|
||||||
bs := []blocks.Block{
|
|
||||||
blocks.NewBlock([]byte("1")),
|
|
||||||
blocks.NewBlock([]byte("2")),
|
|
||||||
blocks.NewBlock([]byte("3")),
|
|
||||||
}
|
|
||||||
assert.NoError(t, s.Add(ctx, bs))
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestBadgerStorage_Get(t *testing.T) {
|
|
||||||
tmpDir, err := os.MkdirTemp("", "badgerfilestore_*")
|
|
||||||
require.NoError(t, err)
|
|
||||||
defer os.RemoveAll(tmpDir)
|
|
||||||
db, err := badger.Open(badger.DefaultOptions(tmpDir))
|
|
||||||
require.NoError(t, err)
|
|
||||||
defer db.Close()
|
|
||||||
|
|
||||||
s := NewBadgerStorage(db)
|
|
||||||
bs := []blocks.Block{
|
|
||||||
blocks.NewBlock([]byte("1")),
|
|
||||||
blocks.NewBlock([]byte("2")),
|
|
||||||
blocks.NewBlock([]byte("3")),
|
|
||||||
}
|
|
||||||
require.NoError(t, s.Add(ctx, bs))
|
|
||||||
|
|
||||||
cids := make([]cid.Cid, 0, len(bs))
|
|
||||||
for _, b := range bs {
|
|
||||||
cids = append(cids, b.Cid())
|
|
||||||
}
|
|
||||||
cids = append(cids, blocks.NewBlock([]byte("4")).Cid())
|
|
||||||
|
|
||||||
b, err := s.Get(ctx, bs[0].Cid())
|
|
||||||
require.NoError(t, err)
|
|
||||||
assert.Equal(t, bs[0].RawData(), b.RawData())
|
|
||||||
|
|
||||||
ecids, err := s.ExistsCids(ctx, cids)
|
|
||||||
require.NoError(t, err)
|
|
||||||
assert.Len(t, ecids, 3)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestBadgerStorage_GetMany(t *testing.T) {
|
|
||||||
tmpDir, err := os.MkdirTemp("", "badgerfilestore_*")
|
|
||||||
require.NoError(t, err)
|
|
||||||
defer os.RemoveAll(tmpDir)
|
|
||||||
db, err := badger.Open(badger.DefaultOptions(tmpDir))
|
|
||||||
require.NoError(t, err)
|
|
||||||
defer db.Close()
|
|
||||||
|
|
||||||
s := NewBadgerStorage(db)
|
|
||||||
bs := []blocks.Block{
|
|
||||||
blocks.NewBlock([]byte("1")),
|
|
||||||
blocks.NewBlock([]byte("2")),
|
|
||||||
blocks.NewBlock([]byte("3")),
|
|
||||||
}
|
|
||||||
require.NoError(t, s.Add(ctx, bs))
|
|
||||||
|
|
||||||
cids := make([]cid.Cid, 0, len(bs))
|
|
||||||
for _, b := range bs {
|
|
||||||
cids = append(cids, b.Cid())
|
|
||||||
}
|
|
||||||
|
|
||||||
res := s.GetMany(ctx, cids)
|
|
||||||
var resB []blocks.Block
|
|
||||||
for i := 0; i < len(bs); i++ {
|
|
||||||
select {
|
|
||||||
case b := <-res:
|
|
||||||
resB = append(resB, b)
|
|
||||||
case <-time.After(time.Second):
|
|
||||||
t.Error("timeout")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
assert.Len(t, resB, 3)
|
|
||||||
_, ok := <-res
|
|
||||||
assert.False(t, ok)
|
|
||||||
}
|
|
|
@ -1,62 +0,0 @@
|
||||||
package filestorage
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/badgerprovider"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/filestorage/badgerfilestore"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/filestorage/rpcstore"
|
|
||||||
"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/fileblockstore"
|
|
||||||
"io"
|
|
||||||
)
|
|
||||||
|
|
||||||
const CName = fileblockstore.CName
|
|
||||||
|
|
||||||
var log = logger.NewNamed(CName)
|
|
||||||
|
|
||||||
func New() FileStorage {
|
|
||||||
return &fileStorage{}
|
|
||||||
}
|
|
||||||
|
|
||||||
type FileStorage interface {
|
|
||||||
app.ComponentRunnable
|
|
||||||
fileblockstore.BlockStore
|
|
||||||
}
|
|
||||||
|
|
||||||
type fileStorage struct {
|
|
||||||
fileblockstore.BlockStore
|
|
||||||
syncer *syncer
|
|
||||||
syncerCancel context.CancelFunc
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *fileStorage) Init(a *app.App) (err error) {
|
|
||||||
db := a.MustComponent(badgerprovider.CName).(badgerprovider.BadgerProvider).Badger()
|
|
||||||
bs := badgerfilestore.NewBadgerStorage(db)
|
|
||||||
ps := &proxyStore{
|
|
||||||
cache: bs,
|
|
||||||
origin: a.MustComponent(rpcstore.CName).(rpcstore.Service).NewStore(),
|
|
||||||
index: badgerfilestore.NewFileBadgerIndex(db),
|
|
||||||
}
|
|
||||||
f.BlockStore = ps
|
|
||||||
f.syncer = &syncer{ps: ps, done: make(chan struct{})}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *fileStorage) Name() (name string) {
|
|
||||||
return CName
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *fileStorage) Run(ctx context.Context) (err error) {
|
|
||||||
ctx, f.syncerCancel = context.WithCancel(ctx)
|
|
||||||
go f.syncer.run(ctx)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *fileStorage) Close(ctx context.Context) (err error) {
|
|
||||||
if f.syncerCancel != nil {
|
|
||||||
f.syncerCancel()
|
|
||||||
<-f.syncer.done
|
|
||||||
}
|
|
||||||
return f.BlockStore.(io.Closer).Close()
|
|
||||||
}
|
|
|
@ -1,137 +0,0 @@
|
||||||
package filestorage
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/filestorage/badgerfilestore"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/filestorage/rpcstore"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonfile/fileblockstore"
|
|
||||||
blocks "github.com/ipfs/go-block-format"
|
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
format "github.com/ipfs/go-ipld-format"
|
|
||||||
"go.uber.org/zap"
|
|
||||||
"io"
|
|
||||||
)
|
|
||||||
|
|
||||||
type proxyStore struct {
|
|
||||||
cache fileblockstore.BlockStoreLocal
|
|
||||||
origin rpcstore.RpcStore
|
|
||||||
index *badgerfilestore.FileBadgerIndex
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *proxyStore) Get(ctx context.Context, k cid.Cid) (b blocks.Block, err error) {
|
|
||||||
log.Debug("get cid", zap.String("cid", k.String()))
|
|
||||||
if b, err = c.cache.Get(ctx, k); err != nil {
|
|
||||||
if format.IsNotFound(err) {
|
|
||||||
err = nil
|
|
||||||
log.Debug("proxyStore local cid not found", zap.String("cid", k.String()))
|
|
||||||
} else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if b, err = c.origin.Get(ctx, k); err != nil {
|
|
||||||
log.Debug("proxyStore remote cid error", zap.String("cid", k.String()), zap.Error(err))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if addErr := c.cache.Add(ctx, []blocks.Block{b}); addErr != nil {
|
|
||||||
log.Error("block fetched from origin but got error for add to cache", zap.Error(addErr))
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *proxyStore) GetMany(ctx context.Context, ks []cid.Cid) <-chan blocks.Block {
|
|
||||||
cachedCids, localErr := c.cache.ExistsCids(ctx, ks)
|
|
||||||
var originCids []cid.Cid
|
|
||||||
if localErr != nil {
|
|
||||||
log.Error("proxy store hasCIDs error", zap.Error(localErr))
|
|
||||||
originCids = ks
|
|
||||||
} else {
|
|
||||||
if len(cachedCids) != len(ks) {
|
|
||||||
set := cid.NewSet()
|
|
||||||
for _, cCid := range cachedCids {
|
|
||||||
set.Add(cCid)
|
|
||||||
}
|
|
||||||
originCids = ks[:0]
|
|
||||||
for _, k := range ks {
|
|
||||||
if !set.Has(k) {
|
|
||||||
originCids = append(originCids, k)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
log.Debug("get many cids", zap.Int("cached", len(cachedCids)), zap.Int("origin", len(originCids)))
|
|
||||||
if len(originCids) == 0 {
|
|
||||||
return c.cache.GetMany(ctx, cachedCids)
|
|
||||||
}
|
|
||||||
var results = make(chan blocks.Block)
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
defer close(results)
|
|
||||||
localResults := c.cache.GetMany(ctx, cachedCids)
|
|
||||||
originResults := c.origin.GetMany(ctx, originCids)
|
|
||||||
oOk, cOk := true, true
|
|
||||||
for {
|
|
||||||
var cb, ob blocks.Block
|
|
||||||
select {
|
|
||||||
case cb, cOk = <-localResults:
|
|
||||||
if cOk {
|
|
||||||
results <- cb
|
|
||||||
}
|
|
||||||
case ob, oOk = <-originResults:
|
|
||||||
if oOk {
|
|
||||||
if addErr := c.cache.Add(ctx, []blocks.Block{ob}); addErr != nil {
|
|
||||||
log.Error("add block to cache error", zap.Error(addErr))
|
|
||||||
}
|
|
||||||
results <- ob
|
|
||||||
}
|
|
||||||
case <-ctx.Done():
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if !oOk && !cOk {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return results
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *proxyStore) Add(ctx context.Context, bs []blocks.Block) (err error) {
|
|
||||||
if bs, err = c.cache.NotExistsBlocks(ctx, bs); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if len(bs) == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
if err = c.cache.Add(ctx, bs); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
indexCids := badgerfilestore.NewCids()
|
|
||||||
defer indexCids.Release()
|
|
||||||
for _, b := range bs {
|
|
||||||
indexCids.Add(fileblockstore.CtxGetSpaceId(ctx), badgerfilestore.OpAdd, b.Cid())
|
|
||||||
}
|
|
||||||
return c.index.Add(indexCids)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *proxyStore) Delete(ctx context.Context, k cid.Cid) error {
|
|
||||||
if err := c.cache.Delete(ctx, k); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
indexCids := badgerfilestore.NewCids()
|
|
||||||
defer indexCids.Release()
|
|
||||||
indexCids.Add(fileblockstore.CtxGetSpaceId(ctx), badgerfilestore.OpDelete, k)
|
|
||||||
return c.index.Add(indexCids)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *proxyStore) Close() (err error) {
|
|
||||||
if closer, ok := c.cache.(io.Closer); ok {
|
|
||||||
if localErr := closer.Close(); localErr != nil {
|
|
||||||
log.Error("error while closing cache store", zap.Error(localErr))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if closer, ok := c.origin.(io.Closer); ok {
|
|
||||||
return closer.Close()
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
|
@ -1,280 +0,0 @@
|
||||||
package filestorage
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/filestorage/badgerfilestore"
|
|
||||||
"github.com/dgraph-io/badger/v3"
|
|
||||||
blocks "github.com/ipfs/go-block-format"
|
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
format "github.com/ipfs/go-ipld-format"
|
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
"os"
|
|
||||||
"sync"
|
|
||||||
"testing"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
var ctx = context.Background()
|
|
||||||
|
|
||||||
func TestCacheStore_Add(t *testing.T) {
|
|
||||||
t.Run("success", func(t *testing.T) {
|
|
||||||
cs := newPSFixture(t)
|
|
||||||
defer cs.Finish(t)
|
|
||||||
testBlocks := newTestBocks("1", "2", "3")
|
|
||||||
require.NoError(t, cs.Add(ctx, testBlocks))
|
|
||||||
for _, b := range testBlocks {
|
|
||||||
gb, err := cs.cache.Get(ctx, b.Cid())
|
|
||||||
assert.NoError(t, err)
|
|
||||||
assert.NotNil(t, gb)
|
|
||||||
}
|
|
||||||
cids, err := cs.index.List(100)
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Len(t, cids.SpaceOps, 1)
|
|
||||||
assert.Len(t, cids.SpaceOps[0].Add, len(testBlocks))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCacheStore_Get(t *testing.T) {
|
|
||||||
t.Run("exists local", func(t *testing.T) {
|
|
||||||
testBlocks := newTestBocks("1", "2", "3")
|
|
||||||
cs := newPSFixture(t)
|
|
||||||
defer cs.Finish(t)
|
|
||||||
require.NoError(t, cs.cache.Add(ctx, testBlocks))
|
|
||||||
require.NoError(t, cs.origin.Add(ctx, testBlocks))
|
|
||||||
for _, b := range testBlocks {
|
|
||||||
gb, err := cs.Get(ctx, b.Cid())
|
|
||||||
assert.NoError(t, err)
|
|
||||||
assert.NotNil(t, gb)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
t.Run("exists remote", func(t *testing.T) {
|
|
||||||
testBlocks := newTestBocks("1", "2", "3")
|
|
||||||
cs := newPSFixture(t)
|
|
||||||
defer cs.Finish(t)
|
|
||||||
require.NoError(t, cs.cache.Add(ctx, testBlocks[:1]))
|
|
||||||
require.NoError(t, cs.origin.Add(ctx, testBlocks))
|
|
||||||
for _, b := range testBlocks {
|
|
||||||
gb, err := cs.Get(ctx, b.Cid())
|
|
||||||
assert.NoError(t, err)
|
|
||||||
assert.NotNil(t, gb)
|
|
||||||
}
|
|
||||||
for _, b := range testBlocks {
|
|
||||||
lb, err := cs.cache.Get(ctx, b.Cid())
|
|
||||||
assert.NoError(t, err)
|
|
||||||
assert.NotNil(t, lb)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCacheStore_GetMany(t *testing.T) {
|
|
||||||
t.Run("all local", func(t *testing.T) {
|
|
||||||
testBlocks := newTestBocks("1", "2", "3")
|
|
||||||
cs := newPSFixture(t)
|
|
||||||
defer cs.Finish(t)
|
|
||||||
require.NoError(t, cs.cache.Add(ctx, testBlocks))
|
|
||||||
require.NoError(t, cs.origin.Add(ctx, testBlocks))
|
|
||||||
|
|
||||||
var cids, resCids []cid.Cid
|
|
||||||
for _, b := range testBlocks {
|
|
||||||
cids = append(cids, b.Cid())
|
|
||||||
}
|
|
||||||
ch := cs.GetMany(ctx, cids)
|
|
||||||
func() {
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case b, ok := <-ch:
|
|
||||||
if !ok {
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
resCids = append(resCids, b.Cid())
|
|
||||||
}
|
|
||||||
case <-time.After(time.Second):
|
|
||||||
assert.NoError(t, fmt.Errorf("timeout"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
assert.ElementsMatch(t, cids, resCids)
|
|
||||||
})
|
|
||||||
t.Run("partial local", func(t *testing.T) {
|
|
||||||
testBlocks := newTestBocks("1", "2", "3")
|
|
||||||
cs := newPSFixture(t)
|
|
||||||
defer cs.Finish(t)
|
|
||||||
require.NoError(t, cs.cache.Add(ctx, testBlocks[:1]))
|
|
||||||
require.NoError(t, cs.origin.Add(ctx, testBlocks))
|
|
||||||
|
|
||||||
var cids, resCids []cid.Cid
|
|
||||||
for _, b := range testBlocks {
|
|
||||||
cids = append(cids, b.Cid())
|
|
||||||
}
|
|
||||||
ch := cs.GetMany(ctx, cids)
|
|
||||||
func() {
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case b, ok := <-ch:
|
|
||||||
if !ok {
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
resCids = append(resCids, b.Cid())
|
|
||||||
}
|
|
||||||
case <-time.After(time.Second):
|
|
||||||
assert.NoError(t, fmt.Errorf("timeout"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
require.Equal(t, len(cids), len(resCids))
|
|
||||||
for _, b := range testBlocks {
|
|
||||||
gb, err := cs.cache.Get(ctx, b.Cid())
|
|
||||||
assert.NoError(t, err)
|
|
||||||
assert.NotNil(t, gb)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCacheStore_Delete(t *testing.T) {
|
|
||||||
testBlocks := newTestBocks("1", "2", "3")
|
|
||||||
cs := newPSFixture(t)
|
|
||||||
defer cs.Finish(t)
|
|
||||||
require.NoError(t, cs.cache.Add(ctx, testBlocks))
|
|
||||||
for _, b := range testBlocks {
|
|
||||||
require.NoError(t, cs.Delete(ctx, b.Cid()))
|
|
||||||
gb, err := cs.cache.Get(ctx, b.Cid())
|
|
||||||
assert.Nil(t, gb)
|
|
||||||
assert.True(t, format.IsNotFound(err))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func newTestStore(bs []blocks.Block) *testStore {
|
|
||||||
ts := &testStore{
|
|
||||||
store: make(map[string]blocks.Block),
|
|
||||||
}
|
|
||||||
ts.Add(context.Background(), bs)
|
|
||||||
return ts
|
|
||||||
}
|
|
||||||
|
|
||||||
type testStore struct {
|
|
||||||
store map[string]blocks.Block
|
|
||||||
mu sync.Mutex
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *testStore) NotExistsBlocks(ctx context.Context, bs []blocks.Block) (notExists []blocks.Block, err error) {
|
|
||||||
t.mu.Lock()
|
|
||||||
defer t.mu.Unlock()
|
|
||||||
notExists = bs[:0]
|
|
||||||
for _, b := range bs {
|
|
||||||
if _, ok := t.store[b.Cid().String()]; !ok {
|
|
||||||
notExists = append(notExists, b)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *testStore) Get(ctx context.Context, k cid.Cid) (blocks.Block, error) {
|
|
||||||
t.mu.Lock()
|
|
||||||
defer t.mu.Unlock()
|
|
||||||
if b, ok := t.store[k.String()]; ok {
|
|
||||||
return b, nil
|
|
||||||
}
|
|
||||||
return nil, &format.ErrNotFound{Cid: k}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *testStore) GetMany(ctx context.Context, ks []cid.Cid) <-chan blocks.Block {
|
|
||||||
var result = make(chan blocks.Block)
|
|
||||||
go func() {
|
|
||||||
defer close(result)
|
|
||||||
for _, k := range ks {
|
|
||||||
select {
|
|
||||||
case <-ctx.Done():
|
|
||||||
return
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
if b, err := t.Get(ctx, k); err == nil {
|
|
||||||
result <- b
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *testStore) ExistsCids(ctx context.Context, ks []cid.Cid) (exists []cid.Cid, err error) {
|
|
||||||
t.mu.Lock()
|
|
||||||
defer t.mu.Unlock()
|
|
||||||
for _, k := range ks {
|
|
||||||
if _, ok := t.store[k.String()]; ok {
|
|
||||||
exists = append(exists, k)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *testStore) Add(ctx context.Context, bs []blocks.Block) error {
|
|
||||||
t.mu.Lock()
|
|
||||||
defer t.mu.Unlock()
|
|
||||||
for _, b := range bs {
|
|
||||||
t.store[b.Cid().String()] = b
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *testStore) AddAsync(ctx context.Context, bs []blocks.Block) (successCh chan cid.Cid) {
|
|
||||||
successCh = make(chan cid.Cid, len(bs))
|
|
||||||
go func() {
|
|
||||||
defer close(successCh)
|
|
||||||
for _, b := range bs {
|
|
||||||
if err := t.Add(ctx, []blocks.Block{b}); err == nil {
|
|
||||||
successCh <- b.Cid()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return successCh
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *testStore) Delete(ctx context.Context, c cid.Cid) error {
|
|
||||||
t.mu.Lock()
|
|
||||||
defer t.mu.Unlock()
|
|
||||||
if _, ok := t.store[c.String()]; ok {
|
|
||||||
delete(t.store, c.String())
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &format.ErrNotFound{Cid: c}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *testStore) Close() (err error) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type psFixture struct {
|
|
||||||
*proxyStore
|
|
||||||
tmpDir string
|
|
||||||
db *badger.DB
|
|
||||||
}
|
|
||||||
|
|
||||||
func newPSFixture(t *testing.T) *psFixture {
|
|
||||||
var err error
|
|
||||||
fx := &psFixture{}
|
|
||||||
fx.tmpDir, err = os.MkdirTemp("", "proxyStore_*")
|
|
||||||
require.NoError(t, err)
|
|
||||||
fx.db, err = badger.Open(badger.DefaultOptions(fx.tmpDir).WithLoggingLevel(badger.ERROR))
|
|
||||||
require.NoError(t, err)
|
|
||||||
fx.proxyStore = &proxyStore{
|
|
||||||
cache: newTestStore(nil),
|
|
||||||
origin: newTestStore(nil),
|
|
||||||
index: badgerfilestore.NewFileBadgerIndex(fx.db),
|
|
||||||
}
|
|
||||||
return fx
|
|
||||||
}
|
|
||||||
|
|
||||||
func (fx *psFixture) Finish(t *testing.T) {
|
|
||||||
assert.NoError(t, fx.db.Close())
|
|
||||||
_ = os.RemoveAll(fx.tmpDir)
|
|
||||||
}
|
|
||||||
|
|
||||||
func newTestBocks(ids ...string) (bs []blocks.Block) {
|
|
||||||
for _, id := range ids {
|
|
||||||
bs = append(bs, blocks.NewBlock([]byte(id)))
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
|
@ -1,301 +0,0 @@
|
||||||
package rpcstore
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
"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/commonfile/fileproto/fileprotoerr"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/rpc/rpcerr"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/slice"
|
|
||||||
"github.com/cheggaaa/mb/v3"
|
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
"go.uber.org/zap"
|
|
||||||
"sync"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
ErrClientClosed = errors.New("file client closed")
|
|
||||||
)
|
|
||||||
|
|
||||||
const defaultMaxInFlightCIDs = 10
|
|
||||||
|
|
||||||
func newClient(ctx context.Context, s *service, peerId string, tq *mb.MB[*task]) (*client, error) {
|
|
||||||
c := &client{
|
|
||||||
peerId: peerId,
|
|
||||||
taskQueue: tq,
|
|
||||||
waitCIDs: map[string]*task{},
|
|
||||||
waitCIDCap: make(chan struct{}, defaultMaxInFlightCIDs),
|
|
||||||
opLoopDone: make(chan struct{}),
|
|
||||||
stat: newStat(),
|
|
||||||
s: s,
|
|
||||||
}
|
|
||||||
if err := c.checkConnectivity(ctx); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
var runCtx context.Context
|
|
||||||
runCtx, c.opLoopCtxCancel = context.WithCancel(context.Background())
|
|
||||||
go c.opLoop(runCtx)
|
|
||||||
return c, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// client gets and executes tasks from taskQueue
|
|
||||||
// it has an internal queue for a waiting CIDs
|
|
||||||
type client struct {
|
|
||||||
peerId string
|
|
||||||
spaceIds []string
|
|
||||||
taskQueue *mb.MB[*task]
|
|
||||||
blocksStream fileproto.DRPCFile_GetBlocksClient
|
|
||||||
blocksStreamMu sync.Mutex
|
|
||||||
waitCIDs map[string]*task
|
|
||||||
waitCIDCap chan struct{}
|
|
||||||
waitCIDMu sync.Mutex
|
|
||||||
opLoopDone chan struct{}
|
|
||||||
opLoopCtxCancel context.CancelFunc
|
|
||||||
stat *stat
|
|
||||||
s *service
|
|
||||||
}
|
|
||||||
|
|
||||||
// opLoop gets tasks from taskQueue
|
|
||||||
func (c *client) opLoop(ctx context.Context) {
|
|
||||||
defer close(c.opLoopDone)
|
|
||||||
c.waitCIDMu.Lock()
|
|
||||||
spaceIds := c.spaceIds
|
|
||||||
c.waitCIDMu.Unlock()
|
|
||||||
cond := c.taskQueue.NewCond().WithFilter(func(t *task) bool {
|
|
||||||
if slice.FindPos(t.denyPeerIds, c.peerId) != -1 {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if len(spaceIds) > 0 && slice.FindPos(spaceIds, t.spaceId) == -1 {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
})
|
|
||||||
for {
|
|
||||||
t, err := cond.WithPriority(c.stat.Score()).WaitOne(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
t.peerId = c.peerId
|
|
||||||
switch t.op {
|
|
||||||
case taskOpGet:
|
|
||||||
err = c.get(ctx, t)
|
|
||||||
case taskOpDelete:
|
|
||||||
err = c.delete(ctx, t)
|
|
||||||
case taskOpPut:
|
|
||||||
err = c.put(ctx, t)
|
|
||||||
default:
|
|
||||||
err = fmt.Errorf("unexpected task op type: %v", t.op)
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
t.err = err
|
|
||||||
select {
|
|
||||||
case t.ready <- t:
|
|
||||||
case <-t.ctx.Done():
|
|
||||||
case <-ctx.Done():
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *client) delete(ctx context.Context, t *task) (err error) {
|
|
||||||
p, err := c.s.pool.Get(ctx, c.peerId)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if _, err = fileproto.NewDRPCFileClient(p).DeleteBlocks(ctx, &fileproto.DeleteBlocksRequest{
|
|
||||||
SpaceId: t.spaceId,
|
|
||||||
Cid: [][]byte{t.cid.Bytes()},
|
|
||||||
}); err != nil {
|
|
||||||
return rpcerr.Unwrap(err)
|
|
||||||
}
|
|
||||||
select {
|
|
||||||
case t.ready <- t:
|
|
||||||
case <-t.ctx.Done():
|
|
||||||
return t.ctx.Err()
|
|
||||||
case <-ctx.Done():
|
|
||||||
return ctx.Err()
|
|
||||||
}
|
|
||||||
c.stat.UpdateLastUsage()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *client) put(ctx context.Context, t *task) (err error) {
|
|
||||||
p, err := c.s.pool.Get(ctx, c.peerId)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
st := time.Now()
|
|
||||||
if _, err = fileproto.NewDRPCFileClient(p).PushBlock(ctx, &fileproto.PushBlockRequest{
|
|
||||||
SpaceId: t.spaceId,
|
|
||||||
Cid: t.cid.Bytes(),
|
|
||||||
Data: t.data,
|
|
||||||
}); err != nil {
|
|
||||||
return rpcerr.Unwrap(err)
|
|
||||||
}
|
|
||||||
log.Debug("put cid", zap.String("cid", t.cid.String()))
|
|
||||||
select {
|
|
||||||
case t.ready <- t:
|
|
||||||
case <-t.ctx.Done():
|
|
||||||
return t.ctx.Err()
|
|
||||||
case <-ctx.Done():
|
|
||||||
return ctx.Err()
|
|
||||||
}
|
|
||||||
c.stat.Add(st, len(t.data))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// get sends the get request to the stream and adds task to waiting list
|
|
||||||
func (c *client) get(ctx context.Context, t *task) (err error) {
|
|
||||||
select {
|
|
||||||
case <-ctx.Done():
|
|
||||||
return ctx.Err()
|
|
||||||
case c.waitCIDCap <- struct{}{}:
|
|
||||||
}
|
|
||||||
c.waitCIDMu.Lock()
|
|
||||||
t.startTime = time.Now()
|
|
||||||
c.waitCIDs[t.cid.String()] = t
|
|
||||||
c.waitCIDMu.Unlock()
|
|
||||||
|
|
||||||
defer func() {
|
|
||||||
if err != nil {
|
|
||||||
c.waitCIDMu.Lock()
|
|
||||||
delete(c.waitCIDs, t.cid.String())
|
|
||||||
c.waitCIDMu.Unlock()
|
|
||||||
<-c.waitCIDCap
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
bs, err := c.getStream(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if err = bs.Send(&fileproto.GetBlockRequest{
|
|
||||||
SpaceId: t.spaceId,
|
|
||||||
Cid: t.cid.Bytes(),
|
|
||||||
}); err != nil {
|
|
||||||
return rpcerr.Unwrap(err)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *client) readStream(stream fileproto.DRPCFile_GetBlocksClient) {
|
|
||||||
var err error
|
|
||||||
defer func() {
|
|
||||||
log.Info("readStream closed", zap.String("peerId", c.peerId), zap.Error(err))
|
|
||||||
c.waitCIDMu.Lock()
|
|
||||||
c.blocksStream = nil
|
|
||||||
c.waitCIDMu.Unlock()
|
|
||||||
}()
|
|
||||||
for {
|
|
||||||
var resp *fileproto.GetBlockResponse
|
|
||||||
resp, err = stream.Recv()
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
var t *task
|
|
||||||
t, err = c.receiveCID(resp)
|
|
||||||
if err != nil {
|
|
||||||
log.Warn("cid receive error", zap.Error(err))
|
|
||||||
} else {
|
|
||||||
select {
|
|
||||||
case t.ready <- t:
|
|
||||||
case <-t.ctx.Done():
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// receiveCID handles stream response, finds cid in waiting list and sets data to task
|
|
||||||
func (c *client) receiveCID(resp *fileproto.GetBlockResponse) (t *task, err error) {
|
|
||||||
_, rCid, err := cid.CidFromBytes(resp.Cid)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("got invalid CID from node: %v", err)
|
|
||||||
}
|
|
||||||
c.waitCIDMu.Lock()
|
|
||||||
defer c.waitCIDMu.Unlock()
|
|
||||||
t, ok := c.waitCIDs[rCid.String()]
|
|
||||||
if !ok {
|
|
||||||
return nil, fmt.Errorf("got unexpected CID from node: %v", rCid.String())
|
|
||||||
}
|
|
||||||
switch resp.Code {
|
|
||||||
case fileproto.CIDError_CIDErrorOk:
|
|
||||||
t.data = resp.Data
|
|
||||||
t.err = nil
|
|
||||||
case fileproto.CIDError_CIDErrorNotFound:
|
|
||||||
t.err = fileblockstore.ErrCIDNotFound
|
|
||||||
default:
|
|
||||||
t.err = fileblockstore.ErrCIDUnexpected
|
|
||||||
}
|
|
||||||
delete(c.waitCIDs, rCid.String())
|
|
||||||
if t.err == nil {
|
|
||||||
c.stat.Add(t.startTime, len(t.data))
|
|
||||||
}
|
|
||||||
<-c.waitCIDCap
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *client) getStream(ctx context.Context) (fileproto.DRPCFile_GetBlocksClient, error) {
|
|
||||||
c.blocksStreamMu.Lock()
|
|
||||||
defer c.blocksStreamMu.Unlock()
|
|
||||||
if c.blocksStream != nil {
|
|
||||||
return c.blocksStream, nil
|
|
||||||
}
|
|
||||||
peer, err := c.s.pool.Dial(ctx, c.peerId)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if c.blocksStream, err = fileproto.NewDRPCFileClient(peer).GetBlocks(context.Background()); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
go c.readStream(c.blocksStream)
|
|
||||||
return c.blocksStream, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *client) checkConnectivity(ctx context.Context) (err error) {
|
|
||||||
p, err := c.s.pool.Get(ctx, c.peerId)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resp, err := fileproto.NewDRPCFileClient(p).Check(ctx, &fileproto.CheckRequest{})
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
c.waitCIDMu.Lock()
|
|
||||||
defer c.waitCIDMu.Unlock()
|
|
||||||
c.spaceIds = resp.SpaceIds
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *client) LastUsage() time.Time {
|
|
||||||
return c.stat.LastUsage()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *client) Close() error {
|
|
||||||
// stop receiving tasks
|
|
||||||
c.opLoopCtxCancel()
|
|
||||||
<-c.opLoopDone
|
|
||||||
c.blocksStreamMu.Lock()
|
|
||||||
// close stream
|
|
||||||
if c.blocksStream != nil {
|
|
||||||
_ = c.blocksStream.CloseSend()
|
|
||||||
c.blocksStream = nil
|
|
||||||
}
|
|
||||||
c.blocksStreamMu.Unlock()
|
|
||||||
// cleanup waiting list
|
|
||||||
c.waitCIDMu.Lock()
|
|
||||||
for id, t := range c.waitCIDs {
|
|
||||||
t.err = ErrClientClosed
|
|
||||||
select {
|
|
||||||
case t.ready <- t:
|
|
||||||
case <-t.ctx.Done():
|
|
||||||
}
|
|
||||||
|
|
||||||
delete(c.waitCIDs, id)
|
|
||||||
}
|
|
||||||
c.waitCIDMu.Unlock()
|
|
||||||
return nil
|
|
||||||
}
|
|
|
@ -1,124 +0,0 @@
|
||||||
package rpcstore
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/ocache"
|
|
||||||
"github.com/cheggaaa/mb/v3"
|
|
||||||
"go.uber.org/zap"
|
|
||||||
"math/rand"
|
|
||||||
"sync"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
maxConnections = 10
|
|
||||||
maxTasks = 100
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
clientCreateTimeout = time.Second * 10
|
|
||||||
)
|
|
||||||
|
|
||||||
func newClientManager(s *service) *clientManager {
|
|
||||||
cm := &clientManager{
|
|
||||||
mb: mb.New[*task](maxTasks),
|
|
||||||
ocache: ocache.New(
|
|
||||||
func(ctx context.Context, id string) (value ocache.Object, err error) {
|
|
||||||
return nil, fmt.Errorf("load func shouldn't be used")
|
|
||||||
},
|
|
||||||
ocache.WithTTL(time.Minute*5),
|
|
||||||
ocache.WithRefCounter(false),
|
|
||||||
ocache.WithLogger(log.Sugar()),
|
|
||||||
ocache.WithGCPeriod(0),
|
|
||||||
),
|
|
||||||
checkPeersCh: make(chan struct{}),
|
|
||||||
s: s,
|
|
||||||
}
|
|
||||||
cm.ctx, cm.ctxCancel = context.WithCancel(context.Background())
|
|
||||||
go cm.checkPeerLoop()
|
|
||||||
return cm
|
|
||||||
}
|
|
||||||
|
|
||||||
// clientManager manages clients, removes unused ones, and adds new ones if necessary
|
|
||||||
type clientManager struct {
|
|
||||||
mb *mb.MB[*task]
|
|
||||||
ctx context.Context
|
|
||||||
ctxCancel context.CancelFunc
|
|
||||||
ocache ocache.OCache
|
|
||||||
checkPeersCh chan struct{}
|
|
||||||
|
|
||||||
s *service
|
|
||||||
mu sync.RWMutex
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *clientManager) Add(ctx context.Context, ts ...*task) (err error) {
|
|
||||||
defer func() {
|
|
||||||
m.mu.Lock()
|
|
||||||
if m.ocache.Len() == 0 {
|
|
||||||
select {
|
|
||||||
case m.checkPeersCh <- struct{}{}:
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m.mu.Unlock()
|
|
||||||
}()
|
|
||||||
return m.mb.Add(ctx, ts...)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *clientManager) checkPeerLoop() {
|
|
||||||
m.checkPeers()
|
|
||||||
ticker := time.NewTicker(time.Minute)
|
|
||||||
defer ticker.Stop()
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case <-m.ctx.Done():
|
|
||||||
return
|
|
||||||
case <-m.checkPeersCh:
|
|
||||||
m.checkPeers()
|
|
||||||
case <-ticker.C:
|
|
||||||
m.checkPeers()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *clientManager) checkPeers() {
|
|
||||||
// start GC to remove unused clients
|
|
||||||
m.ocache.GC()
|
|
||||||
if m.ocache.Len() >= maxConnections {
|
|
||||||
// reached connection limit, can't add new peers
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if m.mb.Len() == 0 {
|
|
||||||
// has empty queue, no need new peers
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// try to add new peers
|
|
||||||
peerIds := m.s.filePeers()
|
|
||||||
rand.Shuffle(len(peerIds), func(i, j int) {
|
|
||||||
peerIds[i], peerIds[j] = peerIds[j], peerIds[i]
|
|
||||||
})
|
|
||||||
for _, peerId := range peerIds {
|
|
||||||
if _, cerr := m.ocache.Pick(m.ctx, peerId); cerr == ocache.ErrNotExists {
|
|
||||||
ctx, cancel := context.WithTimeout(m.ctx, clientCreateTimeout)
|
|
||||||
cl, err := newClient(ctx, m.s, peerId, m.mb)
|
|
||||||
if err != nil {
|
|
||||||
log.Info("can't create client", zap.Error(err))
|
|
||||||
cancel()
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
_ = m.ocache.Add(peerId, cl)
|
|
||||||
cancel()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *clientManager) Close() (err error) {
|
|
||||||
m.ctxCancel()
|
|
||||||
if err = m.mb.Close(); err != nil {
|
|
||||||
log.Error("mb close error", zap.Error(err))
|
|
||||||
}
|
|
||||||
return m.ocache.Close()
|
|
||||||
}
|
|
|
@ -1,48 +0,0 @@
|
||||||
package rpcstore
|
|
||||||
|
|
||||||
import (
|
|
||||||
"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/net/pool"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/nodeconf"
|
|
||||||
)
|
|
||||||
|
|
||||||
const CName = "common.commonfile.rpcstore"
|
|
||||||
|
|
||||||
var log = logger.NewNamed(CName)
|
|
||||||
|
|
||||||
func New() Service {
|
|
||||||
return &service{}
|
|
||||||
}
|
|
||||||
|
|
||||||
type Service interface {
|
|
||||||
NewStore() RpcStore
|
|
||||||
app.Component
|
|
||||||
}
|
|
||||||
|
|
||||||
type service struct {
|
|
||||||
pool pool.Pool
|
|
||||||
nodeconf nodeconf.Service
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) Init(a *app.App) (err error) {
|
|
||||||
s.pool = a.MustComponent(pool.CName).(pool.Pool)
|
|
||||||
s.nodeconf = a.MustComponent(nodeconf.CName).(nodeconf.Service)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) Name() (name string) {
|
|
||||||
return CName
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) NewStore() RpcStore {
|
|
||||||
cm := newClientManager(s)
|
|
||||||
return &store{
|
|
||||||
s: s,
|
|
||||||
cm: cm,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *service) filePeers() []string {
|
|
||||||
return s.nodeconf.GetLast().FilePeers()
|
|
||||||
}
|
|
|
@ -1,55 +0,0 @@
|
||||||
package rpcstore
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/VividCortex/ewma"
|
|
||||||
"sync"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
// defaultSpeedScore - initial value in Kb/s, it should be relatively high to test fresh client soon
|
|
||||||
const defaultSpeedScore = 10 * 1024
|
|
||||||
|
|
||||||
func newStat() *stat {
|
|
||||||
s := &stat{
|
|
||||||
ewma: &ewma.SimpleEWMA{},
|
|
||||||
lastUsage: time.Now(),
|
|
||||||
}
|
|
||||||
s.ewma.Set(float64(defaultSpeedScore))
|
|
||||||
return s
|
|
||||||
}
|
|
||||||
|
|
||||||
// stat calculates EWMA download/upload speed
|
|
||||||
type stat struct {
|
|
||||||
// TODO: rewrite to atomics
|
|
||||||
ewma *ewma.SimpleEWMA
|
|
||||||
mu sync.Mutex
|
|
||||||
lastUsage time.Time
|
|
||||||
}
|
|
||||||
|
|
||||||
// Score returns average download/upload speed in Kb/s
|
|
||||||
func (s *stat) Score() float64 {
|
|
||||||
s.mu.Lock()
|
|
||||||
defer s.mu.Unlock()
|
|
||||||
return s.ewma.Value()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add adds new sample to the stat
|
|
||||||
func (s *stat) Add(startTime time.Time, byteLen int) {
|
|
||||||
s.mu.Lock()
|
|
||||||
defer s.mu.Unlock()
|
|
||||||
dur := time.Since(startTime).Seconds()
|
|
||||||
s.ewma.Add(float64(byteLen) / 1024 / dur)
|
|
||||||
s.lastUsage = time.Now()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *stat) LastUsage() time.Time {
|
|
||||||
s.mu.Lock()
|
|
||||||
defer s.mu.Unlock()
|
|
||||||
return s.lastUsage
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *stat) UpdateLastUsage() {
|
|
||||||
s.mu.Lock()
|
|
||||||
defer s.mu.Unlock()
|
|
||||||
s.lastUsage = time.Now()
|
|
||||||
}
|
|
|
@ -1,151 +0,0 @@
|
||||||
package rpcstore
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonfile/fileblockstore"
|
|
||||||
blocks "github.com/ipfs/go-block-format"
|
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
"go.uber.org/multierr"
|
|
||||||
"go.uber.org/zap"
|
|
||||||
"sync"
|
|
||||||
)
|
|
||||||
|
|
||||||
var closedBlockChan chan blocks.Block
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
closedBlockChan = make(chan blocks.Block)
|
|
||||||
close(closedBlockChan)
|
|
||||||
}
|
|
||||||
|
|
||||||
type RpcStore interface {
|
|
||||||
fileblockstore.BlockStore
|
|
||||||
AddAsync(ctx context.Context, bs []blocks.Block) (successCh chan cid.Cid)
|
|
||||||
}
|
|
||||||
|
|
||||||
type store struct {
|
|
||||||
s *service
|
|
||||||
cm *clientManager
|
|
||||||
mu sync.RWMutex
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *store) Get(ctx context.Context, k cid.Cid) (b blocks.Block, err error) {
|
|
||||||
t := newTask(ctx, taskOpGet, k, nil)
|
|
||||||
if err = s.cm.Add(ctx, t); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
select {
|
|
||||||
case <-t.ready:
|
|
||||||
case <-ctx.Done():
|
|
||||||
return nil, ctx.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
if err = t.Validate(); err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return t.Block()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *store) GetMany(ctx context.Context, ks []cid.Cid) <-chan blocks.Block {
|
|
||||||
var readyCh = make(chan *task)
|
|
||||||
var tasks = make([]*task, len(ks))
|
|
||||||
for i, k := range ks {
|
|
||||||
tasks[i] = newTask(ctx, taskOpGet, k, readyCh)
|
|
||||||
}
|
|
||||||
if err := s.cm.Add(ctx, tasks...); err != nil {
|
|
||||||
log.Error("getMany: can't add tasks", zap.Error(err))
|
|
||||||
return closedBlockChan
|
|
||||||
}
|
|
||||||
var result = make(chan blocks.Block)
|
|
||||||
go func() {
|
|
||||||
defer close(result)
|
|
||||||
for i := 0; i < len(tasks); i++ {
|
|
||||||
var t *task
|
|
||||||
select {
|
|
||||||
case <-ctx.Done():
|
|
||||||
return
|
|
||||||
case t = <-readyCh:
|
|
||||||
}
|
|
||||||
if err := t.Validate(); err != nil {
|
|
||||||
// TODO: fallback
|
|
||||||
log.Warn("received not valid block", zap.Error(err))
|
|
||||||
}
|
|
||||||
b, _ := t.Block()
|
|
||||||
result <- b
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *store) Add(ctx context.Context, bs []blocks.Block) error {
|
|
||||||
var readyCh = make(chan *task)
|
|
||||||
var tasks = make([]*task, len(bs))
|
|
||||||
for i, b := range bs {
|
|
||||||
tasks[i] = newTask(ctx, taskOpPut, b.Cid(), readyCh)
|
|
||||||
tasks[i].data = b.RawData()
|
|
||||||
}
|
|
||||||
if err := s.cm.Add(ctx, tasks...); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
var errs []error
|
|
||||||
for i := 0; i < len(tasks); i++ {
|
|
||||||
select {
|
|
||||||
case t := <-readyCh:
|
|
||||||
if t.err != nil {
|
|
||||||
errs = append(errs, t.err)
|
|
||||||
}
|
|
||||||
case <-ctx.Done():
|
|
||||||
return ctx.Err()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if len(errs) > 0 {
|
|
||||||
return multierr.Combine(errs...)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *store) AddAsync(ctx context.Context, bs []blocks.Block) (successCh chan cid.Cid) {
|
|
||||||
successCh = make(chan cid.Cid, len(bs))
|
|
||||||
go func() {
|
|
||||||
defer close(successCh)
|
|
||||||
var readyCh = make(chan *task)
|
|
||||||
var tasks = make([]*task, len(bs))
|
|
||||||
for i, b := range bs {
|
|
||||||
tasks[i] = newTask(ctx, taskOpPut, b.Cid(), readyCh)
|
|
||||||
tasks[i].data = b.RawData()
|
|
||||||
}
|
|
||||||
if err := s.cm.Add(ctx, tasks...); err != nil {
|
|
||||||
log.Info("addAsync: can't add tasks", zap.Error(err))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
for i := 0; i < len(tasks); i++ {
|
|
||||||
select {
|
|
||||||
case t := <-readyCh:
|
|
||||||
if t.err == nil {
|
|
||||||
successCh <- t.cid
|
|
||||||
} else {
|
|
||||||
log.Info("addAsync: task error", zap.Error(t.err))
|
|
||||||
}
|
|
||||||
case <-ctx.Done():
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *store) Delete(ctx context.Context, c cid.Cid) error {
|
|
||||||
t := newTask(ctx, taskOpDelete, c, nil)
|
|
||||||
if err := s.cm.Add(ctx, t); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
select {
|
|
||||||
case t := <-t.ready:
|
|
||||||
return t.err
|
|
||||||
case <-ctx.Done():
|
|
||||||
return ctx.Err()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *store) Close() (err error) {
|
|
||||||
return s.cm.Close()
|
|
||||||
}
|
|
|
@ -1,198 +0,0 @@
|
||||||
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/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"
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
"sort"
|
|
||||||
"sync"
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
var ctx = context.Background()
|
|
||||||
|
|
||||||
func TestStore_Put(t *testing.T) {
|
|
||||||
fx := newFixture(t)
|
|
||||||
defer fx.Finish(t)
|
|
||||||
|
|
||||||
bs := []blocks.Block{
|
|
||||||
blocks.NewBlock([]byte{'1'}),
|
|
||||||
blocks.NewBlock([]byte{'2'}),
|
|
||||||
blocks.NewBlock([]byte{'3'}),
|
|
||||||
}
|
|
||||||
err := fx.Add(ctx, bs)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
for _, b := range bs {
|
|
||||||
assert.NotNil(t, fx.serv.data[string(b.Cid().Bytes())])
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestStore_Delete(t *testing.T) {
|
|
||||||
fx := newFixture(t)
|
|
||||||
defer fx.Finish(t)
|
|
||||||
bs := []blocks.Block{
|
|
||||||
blocks.NewBlock([]byte{'1'}),
|
|
||||||
}
|
|
||||||
err := fx.Add(ctx, bs)
|
|
||||||
require.NoError(t, err)
|
|
||||||
assert.Len(t, fx.serv.data, 1)
|
|
||||||
require.NoError(t, fx.Delete(ctx, bs[0].Cid()))
|
|
||||||
assert.Len(t, fx.serv.data, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestStore_Get(t *testing.T) {
|
|
||||||
t.Run("success", func(t *testing.T) {
|
|
||||||
fx := newFixture(t)
|
|
||||||
defer fx.Finish(t)
|
|
||||||
bs := []blocks.Block{
|
|
||||||
blocks.NewBlock([]byte{'1'}),
|
|
||||||
}
|
|
||||||
err := fx.Add(ctx, bs)
|
|
||||||
require.NoError(t, err)
|
|
||||||
b, err := fx.Get(ctx, bs[0].Cid())
|
|
||||||
require.NoError(t, err)
|
|
||||||
assert.Equal(t, []byte{'1'}, b.RawData())
|
|
||||||
})
|
|
||||||
t.Run("not found", func(t *testing.T) {
|
|
||||||
fx := newFixture(t)
|
|
||||||
defer fx.Finish(t)
|
|
||||||
bs := []blocks.Block{
|
|
||||||
blocks.NewBlock([]byte{'1'}),
|
|
||||||
}
|
|
||||||
b, err := fx.Get(ctx, bs[0].Cid())
|
|
||||||
assert.Nil(t, b)
|
|
||||||
assert.ErrorIs(t, err, fileblockstore.ErrCIDNotFound)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestStore_GetMany(t *testing.T) {
|
|
||||||
fx := newFixture(t)
|
|
||||||
defer fx.Finish(t)
|
|
||||||
|
|
||||||
bs := []blocks.Block{
|
|
||||||
blocks.NewBlock([]byte{'1'}),
|
|
||||||
blocks.NewBlock([]byte{'2'}),
|
|
||||||
blocks.NewBlock([]byte{'3'}),
|
|
||||||
}
|
|
||||||
err := fx.Add(ctx, bs)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
res := fx.GetMany(ctx, []cid.Cid{
|
|
||||||
bs[0].Cid(),
|
|
||||||
bs[1].Cid(),
|
|
||||||
bs[2].Cid(),
|
|
||||||
})
|
|
||||||
var resBlocks []blocks.Block
|
|
||||||
for b := range res {
|
|
||||||
resBlocks = append(resBlocks, b)
|
|
||||||
}
|
|
||||||
require.Len(t, resBlocks, 3)
|
|
||||||
sort.Slice(resBlocks, func(i, j int) bool {
|
|
||||||
return string(resBlocks[i].RawData()) < string(resBlocks[j].RawData())
|
|
||||||
})
|
|
||||||
assert.Equal(t, bs, resBlocks)
|
|
||||||
}
|
|
||||||
|
|
||||||
func newFixture(t *testing.T) *fixture {
|
|
||||||
fx := &fixture{
|
|
||||||
a: new(app.App),
|
|
||||||
s: New().(*service),
|
|
||||||
serv: &testServer{
|
|
||||||
data: make(map[string][]byte),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
conf := &config.Config{}
|
|
||||||
|
|
||||||
for i := 0; i < 11; i++ {
|
|
||||||
conf.Nodes = append(conf.Nodes, nodeconf.NodeConfig{
|
|
||||||
PeerId: fmt.Sprint(i),
|
|
||||||
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)
|
|
||||||
require.NoError(t, fx.a.Start(ctx))
|
|
||||||
fx.store = fx.s.NewStore().(*store)
|
|
||||||
return fx
|
|
||||||
}
|
|
||||||
|
|
||||||
type fixture struct {
|
|
||||||
*store
|
|
||||||
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 {
|
|
||||||
mu sync.Mutex
|
|
||||||
data map[string][]byte
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *testServer) GetBlocks(stream fileproto.DRPCFile_GetBlocksStream) error {
|
|
||||||
for {
|
|
||||||
req, err := stream.Recv()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
t.mu.Lock()
|
|
||||||
resp := &fileproto.GetBlockResponse{
|
|
||||||
Cid: req.Cid,
|
|
||||||
}
|
|
||||||
if data, ok := t.data[string(req.Cid)]; ok {
|
|
||||||
resp.Data = data
|
|
||||||
} else {
|
|
||||||
resp.Code = fileproto.CIDError_CIDErrorNotFound
|
|
||||||
}
|
|
||||||
t.mu.Unlock()
|
|
||||||
if err = stream.Send(resp); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *testServer) PushBlock(ctx context.Context, req *fileproto.PushBlockRequest) (*fileproto.PushBlockResponse, error) {
|
|
||||||
t.mu.Lock()
|
|
||||||
defer t.mu.Unlock()
|
|
||||||
t.data[string(req.Cid)] = req.Data
|
|
||||||
return &fileproto.PushBlockResponse{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *testServer) DeleteBlocks(ctx context.Context, req *fileproto.DeleteBlocksRequest) (*fileproto.DeleteBlocksResponse, error) {
|
|
||||||
t.mu.Lock()
|
|
||||||
defer t.mu.Unlock()
|
|
||||||
for _, c := range req.Cid {
|
|
||||||
delete(t.data, string(c))
|
|
||||||
}
|
|
||||||
return &fileproto.DeleteBlocksResponse{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *testServer) Check(ctx context.Context, req *fileproto.CheckRequest) (*fileproto.CheckResponse, error) {
|
|
||||||
return &fileproto.CheckResponse{}, nil
|
|
||||||
}
|
|
|
@ -1,60 +0,0 @@
|
||||||
package rpcstore
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
blocks "github.com/ipfs/go-block-format"
|
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
type taskOp uint
|
|
||||||
|
|
||||||
const (
|
|
||||||
taskOpGet taskOp = iota
|
|
||||||
taskOpPut
|
|
||||||
taskOpDelete
|
|
||||||
)
|
|
||||||
|
|
||||||
func newTask(ctx context.Context, op taskOp, c cid.Cid, readyCh chan *task) *task {
|
|
||||||
t := &task{
|
|
||||||
cid: c,
|
|
||||||
ctx: ctx,
|
|
||||||
ready: readyCh,
|
|
||||||
op: op,
|
|
||||||
}
|
|
||||||
if t.ready == nil {
|
|
||||||
t.ready = make(chan *task)
|
|
||||||
}
|
|
||||||
return t
|
|
||||||
}
|
|
||||||
|
|
||||||
type task struct {
|
|
||||||
op taskOp
|
|
||||||
ctx context.Context
|
|
||||||
cid cid.Cid
|
|
||||||
data []byte
|
|
||||||
peerId string
|
|
||||||
spaceId string
|
|
||||||
denyPeerIds []string
|
|
||||||
ready chan *task
|
|
||||||
startTime time.Time
|
|
||||||
err error
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *task) Validate() error {
|
|
||||||
if t.err != nil {
|
|
||||||
return t.err
|
|
||||||
}
|
|
||||||
chkc, err := t.cid.Prefix().Sum(t.data)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if !chkc.Equals(t.cid) {
|
|
||||||
return blocks.ErrWrongHash
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *task) Block() (blocks.Block, error) {
|
|
||||||
return blocks.NewBlockWithCid(t.data, t.cid)
|
|
||||||
}
|
|
|
@ -1,145 +0,0 @@
|
||||||
package filestorage
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/client/filestorage/badgerfilestore"
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonfile/fileblockstore"
|
|
||||||
blocks "github.com/ipfs/go-block-format"
|
|
||||||
"go.uber.org/zap"
|
|
||||||
"sync"
|
|
||||||
"sync/atomic"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
const syncerOpBatch = 10
|
|
||||||
|
|
||||||
type syncer struct {
|
|
||||||
ps *proxyStore
|
|
||||||
done chan struct{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *syncer) run(ctx context.Context) {
|
|
||||||
defer close(s.done)
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case <-ctx.Done():
|
|
||||||
return
|
|
||||||
case <-time.After(time.Minute):
|
|
||||||
case <-s.ps.index.HasWorkCh():
|
|
||||||
}
|
|
||||||
for s.sync(ctx) > 0 {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *syncer) sync(ctx context.Context) (doneCount int32) {
|
|
||||||
cids, err := s.ps.index.List(syncerOpBatch)
|
|
||||||
if err != nil {
|
|
||||||
log.Error("index list error", zap.Error(err))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
defer cids.Release()
|
|
||||||
l := cids.Len()
|
|
||||||
log.Debug("remote file sync, got tasks to sync", zap.Int("count", l))
|
|
||||||
if l == 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
var cancel context.CancelFunc
|
|
||||||
ctx, cancel = context.WithTimeout(ctx, time.Minute)
|
|
||||||
defer cancel()
|
|
||||||
var wg sync.WaitGroup
|
|
||||||
var doneAtomic atomic.Int32
|
|
||||||
for _, sOps := range cids.SpaceOps {
|
|
||||||
if len(sOps.Load) > 0 {
|
|
||||||
wg.Add(1)
|
|
||||||
go func(opt badgerfilestore.SpaceCidOps) {
|
|
||||||
defer wg.Done()
|
|
||||||
doneAtomic.Add(s.load(ctx, opt))
|
|
||||||
}(sOps)
|
|
||||||
}
|
|
||||||
if len(sOps.Delete) > 0 {
|
|
||||||
wg.Add(1)
|
|
||||||
go func(opt badgerfilestore.SpaceCidOps) {
|
|
||||||
defer wg.Done()
|
|
||||||
doneAtomic.Add(s.delete(ctx, opt))
|
|
||||||
}(sOps)
|
|
||||||
}
|
|
||||||
if len(sOps.Add) > 0 {
|
|
||||||
wg.Add(1)
|
|
||||||
go func(opt badgerfilestore.SpaceCidOps) {
|
|
||||||
defer wg.Done()
|
|
||||||
doneAtomic.Add(s.add(ctx, opt))
|
|
||||||
}(sOps)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
wg.Wait()
|
|
||||||
return doneAtomic.Load()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *syncer) load(ctx context.Context, spaceOps badgerfilestore.SpaceCidOps) (doneCount int32) {
|
|
||||||
ctx = fileblockstore.CtxWithSpaceId(ctx, spaceOps.SpaceId)
|
|
||||||
res := s.ps.origin.GetMany(ctx, spaceOps.Load)
|
|
||||||
doneCids := badgerfilestore.NewCids()
|
|
||||||
defer doneCids.Release()
|
|
||||||
for b := range res {
|
|
||||||
if err := s.ps.cache.Add(ctx, []blocks.Block{b}); err != nil {
|
|
||||||
log.Error("syncer: can't add to local store", zap.Error(err))
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
doneCids.Add(spaceOps.SpaceId, badgerfilestore.OpLoad, b.Cid())
|
|
||||||
}
|
|
||||||
if err := s.ps.index.Done(doneCids); err != nil {
|
|
||||||
log.Error("syncer: index.Done error", zap.Error(err))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
doneCount = int32(doneCids.Len())
|
|
||||||
log.Info("successfully loaded cids", zap.Int32("count", doneCount))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *syncer) add(ctx context.Context, spaceOps badgerfilestore.SpaceCidOps) (doneCount int32) {
|
|
||||||
doneCids := badgerfilestore.NewCids()
|
|
||||||
defer doneCids.Release()
|
|
||||||
res := s.ps.cache.GetMany(ctx, spaceOps.Add)
|
|
||||||
var bs []blocks.Block
|
|
||||||
for b := range res {
|
|
||||||
bs = append(bs, b)
|
|
||||||
}
|
|
||||||
ctx = fileblockstore.CtxWithSpaceId(ctx, spaceOps.SpaceId)
|
|
||||||
|
|
||||||
successCidsCh := s.ps.origin.AddAsync(ctx, bs)
|
|
||||||
for doneCid := range successCidsCh {
|
|
||||||
doneCids.Add(spaceOps.SpaceId, badgerfilestore.OpAdd, doneCid)
|
|
||||||
}
|
|
||||||
|
|
||||||
doneCount = int32(doneCids.Len())
|
|
||||||
if doneCount == 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := s.ps.index.Done(doneCids); err != nil {
|
|
||||||
log.Error("syncer: index.Done error", zap.Error(err))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
log.Info("successfully added cids", zap.Int32("count", doneCount), zap.Stringers("cids", doneCids.SpaceOps[0].Add))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *syncer) delete(ctx context.Context, spaceOps badgerfilestore.SpaceCidOps) (doneCount int32) {
|
|
||||||
doneCids := badgerfilestore.NewCids()
|
|
||||||
defer doneCids.Release()
|
|
||||||
ctx = fileblockstore.CtxWithSpaceId(ctx, spaceOps.SpaceId)
|
|
||||||
for _, c := range spaceOps.Delete {
|
|
||||||
if err := s.ps.origin.Delete(ctx, c); err != nil {
|
|
||||||
log.Debug("syncer: can't remove from remote", zap.Error(err))
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
doneCids.Add(spaceOps.SpaceId, badgerfilestore.OpDelete, c)
|
|
||||||
}
|
|
||||||
if err := s.ps.index.Done(doneCids); err != nil {
|
|
||||||
log.Error("syncer: index.Done error", zap.Error(err))
|
|
||||||
}
|
|
||||||
doneCount = int32(doneCids.Len())
|
|
||||||
log.Info("successfully removed cids", zap.Int32("count", doneCount))
|
|
||||||
return
|
|
||||||
}
|
|
|
@ -1,106 +0,0 @@
|
||||||
package filestorage
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
"testing"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestSyncer_add(t *testing.T) {
|
|
||||||
t.Log("start test")
|
|
||||||
fx := newPSFixture(t)
|
|
||||||
defer fx.Finish(t)
|
|
||||||
s := &syncer{ps: fx.proxyStore, done: make(chan struct{})}
|
|
||||||
ctx, cancel := context.WithCancel(ctx)
|
|
||||||
defer func() {
|
|
||||||
cancel()
|
|
||||||
<-s.done
|
|
||||||
}()
|
|
||||||
bs := newTestBocks("1", "2")
|
|
||||||
require.NoError(t, fx.Add(ctx, bs))
|
|
||||||
go func() {
|
|
||||||
s.run(ctx)
|
|
||||||
}()
|
|
||||||
time.Sleep(time.Millisecond * 10)
|
|
||||||
bs2 := newTestBocks("3", "4")
|
|
||||||
require.NoError(t, fx.Add(ctx, bs2))
|
|
||||||
var done = make(chan struct{})
|
|
||||||
go func() {
|
|
||||||
defer close(done)
|
|
||||||
for _, b := range append(bs, bs2...) {
|
|
||||||
t.Log("check", b.Cid().String())
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case <-ctx.Done():
|
|
||||||
return
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
ab, err := fx.origin.Get(ctx, b.Cid())
|
|
||||||
if err == nil {
|
|
||||||
assert.Equal(t, b.RawData(), ab.RawData())
|
|
||||||
break
|
|
||||||
}
|
|
||||||
time.Sleep(time.Millisecond)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
select {
|
|
||||||
case <-done:
|
|
||||||
case <-time.After(time.Second):
|
|
||||||
t.Errorf("timeout")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestSyncer_delete(t *testing.T) {
|
|
||||||
fx := newPSFixture(t)
|
|
||||||
defer fx.Finish(t)
|
|
||||||
s := &syncer{ps: fx.proxyStore, done: make(chan struct{})}
|
|
||||||
ctx, cancel := context.WithCancel(ctx)
|
|
||||||
defer func() {
|
|
||||||
cancel()
|
|
||||||
<-s.done
|
|
||||||
}()
|
|
||||||
go func() {
|
|
||||||
s.run(ctx)
|
|
||||||
}()
|
|
||||||
bs := newTestBocks("1", "2")
|
|
||||||
require.NoError(t, fx.cache.Add(ctx, bs))
|
|
||||||
require.NoError(t, fx.origin.Add(ctx, bs))
|
|
||||||
|
|
||||||
for cid := range fx.cache.(*testStore).store {
|
|
||||||
t.Log("cache", cid)
|
|
||||||
}
|
|
||||||
for cid := range fx.origin.(*testStore).store {
|
|
||||||
t.Log("origin", cid)
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, b := range bs {
|
|
||||||
require.NoError(t, fx.Delete(ctx, b.Cid()))
|
|
||||||
}
|
|
||||||
|
|
||||||
var done = make(chan struct{})
|
|
||||||
go func() {
|
|
||||||
defer close(done)
|
|
||||||
for _, b := range bs {
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case <-ctx.Done():
|
|
||||||
return
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
_, err := fx.origin.Get(ctx, b.Cid())
|
|
||||||
if err != nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
time.Sleep(time.Millisecond)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
select {
|
|
||||||
case <-done:
|
|
||||||
case <-time.After(time.Second):
|
|
||||||
t.Errorf("timeout")
|
|
||||||
}
|
|
||||||
}
|
|
114
client/go.mod
114
client/go.mod
|
@ -1,114 +0,0 @@
|
||||||
module github.com/anytypeio/go-anytype-infrastructure-experiments/client
|
|
||||||
|
|
||||||
replace github.com/anytypeio/go-anytype-infrastructure-experiments/common => ../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/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/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
|
|
||||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
|
|
||||||
github.com/golang/protobuf v1.5.2 // indirect
|
|
||||||
github.com/golang/snappy v0.0.3 // indirect
|
|
||||||
github.com/google/flatbuffers v1.12.1 // indirect
|
|
||||||
github.com/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/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
|
|
||||||
github.com/libp2p/go-libp2p v0.23.2 // indirect
|
|
||||||
github.com/libp2p/go-openssl v0.1.0 // indirect
|
|
||||||
github.com/mattn/go-isatty v0.0.16 // indirect
|
|
||||||
github.com/mattn/go-pointer v0.0.1 // indirect
|
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
|
|
||||||
github.com/minio/sha256-simd v1.0.0 // indirect
|
|
||||||
github.com/mr-tron/base58 v1.2.0 // indirect
|
|
||||||
github.com/multiformats/go-base32 v0.1.0 // indirect
|
|
||||||
github.com/multiformats/go-base36 v0.2.0 // indirect
|
|
||||||
github.com/multiformats/go-multiaddr v0.7.0 // indirect
|
|
||||||
github.com/multiformats/go-multibase v0.1.1 // indirect
|
|
||||||
github.com/multiformats/go-multicodec v0.6.0 // indirect
|
|
||||||
github.com/multiformats/go-multihash v0.2.1 // indirect
|
|
||||||
github.com/multiformats/go-varint v0.0.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
|
|
||||||
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
|
|
||||||
lukechampine.com/blake3 v1.1.7 // indirect
|
|
||||||
)
|
|
868
client/go.sum
868
client/go.sum
|
@ -1,868 +0,0 @@
|
||||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
|
||||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
|
||||||
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
|
|
||||||
cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=
|
|
||||||
cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
|
|
||||||
cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=
|
|
||||||
cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=
|
|
||||||
cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To=
|
|
||||||
cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4=
|
|
||||||
cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M=
|
|
||||||
cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc=
|
|
||||||
cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk=
|
|
||||||
cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs=
|
|
||||||
cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc=
|
|
||||||
cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY=
|
|
||||||
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
|
|
||||||
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
|
|
||||||
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
|
|
||||||
cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
|
|
||||||
cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
|
|
||||||
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
|
|
||||||
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
|
|
||||||
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
|
|
||||||
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
|
|
||||||
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
|
|
||||||
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
|
|
||||||
cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU=
|
|
||||||
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
|
|
||||||
cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
|
|
||||||
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
|
|
||||||
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
|
|
||||||
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
|
||||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
|
||||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
|
||||||
github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=
|
|
||||||
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
|
||||||
github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow=
|
|
||||||
github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4=
|
|
||||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
|
||||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
|
||||||
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=
|
|
||||||
github.com/anytypeio/go-chash v0.0.0-20220629194632-4ad1154fe232/go.mod h1:+PeHBAWp7gUh/yw6uAauKc5ku0w4cFNg6DUddGxoGq0=
|
|
||||||
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
|
|
||||||
github.com/awalterschulze/gographviz v2.0.3+incompatible h1:9sVEXJBJLwGX7EQVhLm2elIKCm7P2YHFC8v6096G09E=
|
|
||||||
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
|
|
||||||
github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A=
|
|
||||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
|
||||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
|
||||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
|
||||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
|
||||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
|
||||||
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
|
|
||||||
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
|
|
||||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
|
||||||
github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
|
|
||||||
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
|
||||||
github.com/cheggaaa/mb/v3 v3.0.0-20221122160120-e9034545510c h1:+bD75daSbsxyTzkKpNplC4xls+7/tGwty+zruzOnOmk=
|
|
||||||
github.com/cheggaaa/mb/v3 v3.0.0-20221122160120-e9034545510c/go.mod h1:zCt2QeYukhd/g0bIdNqF+b/kKz1hnLFNDkP49qN5kqI=
|
|
||||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
|
||||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
|
||||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
|
||||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
|
||||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
|
||||||
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
|
||||||
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
|
|
||||||
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
|
||||||
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=
|
|
||||||
github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0=
|
|
||||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4=
|
|
||||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc=
|
|
||||||
github.com/dgraph-io/badger/v3 v3.2103.3 h1:s63J1pisDhKpzWslXFe+ChuthuZptpwTE6qEKoczPb4=
|
|
||||||
github.com/dgraph-io/badger/v3 v3.2103.3/go.mod h1:4MPiseMeDQ3FNCYwRbbcBOGJLf5jsE0PPFzRiKjtcdw=
|
|
||||||
github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8=
|
|
||||||
github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA=
|
|
||||||
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA=
|
|
||||||
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
|
|
||||||
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
|
|
||||||
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
|
||||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
|
||||||
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=
|
|
||||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
|
||||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
|
||||||
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
|
||||||
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
|
|
||||||
github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
|
|
||||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
|
||||||
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=
|
|
||||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
|
|
||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
|
|
||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
|
||||||
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
|
||||||
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
|
||||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY=
|
|
||||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
|
||||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
|
||||||
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
|
||||||
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
|
|
||||||
github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
|
||||||
github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
|
||||||
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=
|
|
||||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
|
||||||
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
|
||||||
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
|
||||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
|
||||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
|
||||||
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
|
||||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
|
||||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
|
||||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
|
||||||
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
|
|
||||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
|
||||||
github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA=
|
|
||||||
github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
|
||||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
|
||||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
|
||||||
github.com/google/flatbuffers v1.12.1 h1:MVlul7pQNoDzWRLTw5imwYsl+usrS1TXG2H4jg6ImGw=
|
|
||||||
github.com/google/flatbuffers v1.12.1/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
|
|
||||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
|
||||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
|
||||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
|
||||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
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.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=
|
|
||||||
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
|
||||||
github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
|
||||||
github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
|
||||||
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
|
||||||
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=
|
|
||||||
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
|
||||||
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
|
||||||
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=
|
|
||||||
github.com/klauspost/compress v1.15.10 h1:Ai8UzuomSCDw90e1qNMtb15msBXsNpH6gzkkENQNcJo=
|
|
||||||
github.com/klauspost/compress v1.15.10/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM=
|
|
||||||
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.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/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/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=
|
|
||||||
github.com/mattn/go-pointer v0.0.1 h1:n+XhsuGeVO6MEAp7xyEukFINEa+Quek5psIR/ylA6o0=
|
|
||||||
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=
|
|
||||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
|
||||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
|
||||||
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/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-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=
|
|
||||||
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=
|
|
||||||
github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
|
|
||||||
github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY=
|
|
||||||
github.com/prometheus/client_golang v1.13.0 h1:b71QUfeo5M8gq2+evJdTPfZhYMAU0uKPkyPJ7TPsloU=
|
|
||||||
github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ=
|
|
||||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
|
||||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
|
||||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
|
||||||
github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=
|
|
||||||
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
|
||||||
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
|
||||||
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
|
|
||||||
github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=
|
|
||||||
github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls=
|
|
||||||
github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE=
|
|
||||||
github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA=
|
|
||||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
|
||||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
|
||||||
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
|
|
||||||
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
|
|
||||||
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
|
|
||||||
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=
|
|
||||||
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
|
|
||||||
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
|
||||||
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
|
||||||
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
|
||||||
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
|
|
||||||
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
|
||||||
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
|
||||||
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
|
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
|
||||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
|
||||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
|
||||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
|
||||||
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/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=
|
|
||||||
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
|
||||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
|
||||||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
|
||||||
github.com/zeebo/assert v1.1.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0=
|
|
||||||
github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ=
|
|
||||||
github.com/zeebo/blake3 v0.2.3 h1:TFoLXsjeXqRNFxSbk35Dk4YtszE/MQQGK10BH4ptoTg=
|
|
||||||
github.com/zeebo/blake3 v0.2.3/go.mod h1:mjJjZpnsyIVtVgTOSpJ9vmRE4wgDeyt2HU3qXvvKCaQ=
|
|
||||||
github.com/zeebo/errs v1.3.0 h1:hmiaKqgYZzcVgRL1Vkc1Mn2914BbzB0IBxs+ebeutGs=
|
|
||||||
github.com/zeebo/errs v1.3.0/go.mod h1:sgbWHsvVuTPHcqJJGQ1WhI5KbWlHYz+2+2C/LSEtCw4=
|
|
||||||
github.com/zeebo/pcg v1.0.1 h1:lyqfGeWiv4ahac6ttHs+I5hwtH/+1mrhlCtVNQM2kHo=
|
|
||||||
github.com/zeebo/pcg v1.0.1/go.mod h1:09F0S9iiKrwn9rlI5yjLkmrug154/YRW6KnnXVDM/l4=
|
|
||||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
|
||||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
|
||||||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
|
||||||
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
|
||||||
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.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.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-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=
|
|
||||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
|
||||||
golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
|
|
||||||
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
|
|
||||||
golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
|
||||||
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
|
||||||
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
|
||||||
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
|
|
||||||
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
|
||||||
golang.org/x/exp v0.0.0-20220916125017-b168a2c6b86b h1:SCE/18RnFsLrjydh/R/s5EVvHoZprqEQUuoxK8q2Pc4=
|
|
||||||
golang.org/x/exp v0.0.0-20220916125017-b168a2c6b86b/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE=
|
|
||||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
|
||||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
|
||||||
golang.org/x/image v0.0.0-20200119044424-58c23975cae1 h1:5h3ngYt7+vXCDZCup/HkCQgW5XwmSvR/nA2JmJ0RErg=
|
|
||||||
golang.org/x/image v0.0.0-20200119044424-58c23975cae1/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
|
||||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
|
||||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
|
||||||
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
|
||||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
|
||||||
golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
|
||||||
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
|
||||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
|
||||||
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
|
|
||||||
golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
|
||||||
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
|
||||||
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
|
|
||||||
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
|
|
||||||
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
|
||||||
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
|
|
||||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
|
||||||
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
|
||||||
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=
|
|
||||||
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
|
||||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
|
||||||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
|
||||||
golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
|
||||||
golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
|
||||||
golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
|
||||||
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
|
||||||
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
|
||||||
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
|
||||||
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
|
||||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
|
||||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
|
||||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
|
||||||
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.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=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
|
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
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=
|
|
||||||
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
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=
|
|
||||||
golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
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=
|
|
||||||
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
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/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=
|
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
|
||||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
|
||||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
|
||||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
|
||||||
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=
|
|
||||||
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
|
||||||
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
|
||||||
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
|
||||||
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=
|
|
||||||
golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
|
|
||||||
golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
|
|
||||||
golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
|
|
||||||
golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
|
||||||
golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
|
||||||
golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
|
||||||
golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
|
||||||
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
|
||||||
golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
|
||||||
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=
|
|
||||||
google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
|
||||||
google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
|
||||||
google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
|
||||||
google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
|
||||||
google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
|
||||||
google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
|
||||||
google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
|
||||||
google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
|
||||||
google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
|
||||||
google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
|
|
||||||
google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
|
|
||||||
google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM=
|
|
||||||
google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=
|
|
||||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
|
||||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
|
||||||
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
|
||||||
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
|
|
||||||
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
|
||||||
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
|
||||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
|
||||||
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
|
||||||
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
|
||||||
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
|
||||||
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
|
||||||
google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
|
||||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
|
||||||
google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
|
|
||||||
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
|
||||||
google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
|
||||||
google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
|
||||||
google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
|
||||||
google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
|
||||||
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
|
||||||
google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
|
|
||||||
google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
|
||||||
google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U=
|
|
||||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
|
||||||
google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA=
|
|
||||||
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
|
||||||
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
|
||||||
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
|
||||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
|
||||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
|
||||||
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
|
||||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
|
||||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
|
||||||
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
|
||||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
|
||||||
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
|
||||||
google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=
|
|
||||||
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
|
|
||||||
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
|
||||||
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
|
||||||
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
|
||||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
|
||||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
|
||||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
|
||||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
|
||||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
|
||||||
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
|
||||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
|
||||||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
|
||||||
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
|
|
||||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
|
||||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
|
||||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
|
||||||
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
|
|
||||||
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
|
||||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
|
||||||
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw=
|
|
||||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
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=
|
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
|
||||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
|
||||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
|
||||||
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
|
||||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
|
||||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
|
||||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
|
||||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
|
||||||
lukechampine.com/blake3 v1.1.7 h1:GgRMhmdsuK8+ii6UZFDL8Nb+VyMwadAgcJyfYHxG6n0=
|
|
||||||
lukechampine.com/blake3 v1.1.7/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA=
|
|
||||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
|
||||||
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
|
||||||
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|
|
||||||
storj.io/drpc v0.0.32 h1:5p5ZwsK/VOgapaCu+oxaPVwO6UwIs+iwdMiD50+R4PI=
|
|
||||||
storj.io/drpc v0.0.32/go.mod h1:6rcOyR/QQkSTX/9L5ZGtlZaE2PtXTTZl8d+ulSeeYEg=
|
|
|
@ -1,41 +0,0 @@
|
||||||
package storage
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/dgraph-io/badger/v3"
|
|
||||||
)
|
|
||||||
|
|
||||||
func hasDB(db *badger.DB, key []byte) bool {
|
|
||||||
return db.View(func(txn *badger.Txn) error {
|
|
||||||
_, err := txn.Get(key)
|
|
||||||
return err
|
|
||||||
}) == nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func putDB(db *badger.DB, key, value []byte) (err error) {
|
|
||||||
return db.Update(func(txn *badger.Txn) error {
|
|
||||||
return txn.Set(key, value)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func getDB(db *badger.DB, key []byte) (value []byte, err error) {
|
|
||||||
err = db.View(func(txn *badger.Txn) error {
|
|
||||||
item, err := txn.Get(key)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
value, err = item.ValueCopy(value)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func getTxn(txn *badger.Txn, key []byte) (value []byte, err error) {
|
|
||||||
item, err := txn.Get(key)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return item.ValueCopy(value)
|
|
||||||
}
|
|
|
@ -1,109 +0,0 @@
|
||||||
package storage
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treestorage"
|
|
||||||
)
|
|
||||||
|
|
||||||
type aclKeys struct {
|
|
||||||
spaceId string
|
|
||||||
rootKey []byte
|
|
||||||
headKey []byte
|
|
||||||
}
|
|
||||||
|
|
||||||
func newAclKeys(spaceId string) aclKeys {
|
|
||||||
return aclKeys{
|
|
||||||
spaceId: spaceId,
|
|
||||||
rootKey: treestorage.JoinStringsToBytes("space", spaceId, "a", "rootId"),
|
|
||||||
headKey: treestorage.JoinStringsToBytes("space", spaceId, "a", "headId"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a aclKeys) HeadIdKey() []byte {
|
|
||||||
return a.headKey
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a aclKeys) RootIdKey() []byte {
|
|
||||||
return a.rootKey
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a aclKeys) RawRecordKey(id string) []byte {
|
|
||||||
return treestorage.JoinStringsToBytes("space", a.spaceId, "a", id)
|
|
||||||
}
|
|
||||||
|
|
||||||
type treeKeys struct {
|
|
||||||
id string
|
|
||||||
spaceId string
|
|
||||||
headsKey []byte
|
|
||||||
rootKey []byte
|
|
||||||
rawChangePrefix []byte
|
|
||||||
}
|
|
||||||
|
|
||||||
func newTreeKeys(spaceId, id string) treeKeys {
|
|
||||||
return treeKeys{
|
|
||||||
id: id,
|
|
||||||
spaceId: spaceId,
|
|
||||||
headsKey: treestorage.JoinStringsToBytes("space", spaceId, "t", id, "heads"),
|
|
||||||
rootKey: treestorage.JoinStringsToBytes("space", spaceId, "t", "rootId", id),
|
|
||||||
rawChangePrefix: treestorage.JoinStringsToBytes("space", spaceId, "t", id),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t treeKeys) HeadsKey() []byte {
|
|
||||||
return t.headsKey
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t treeKeys) RootIdKey() []byte {
|
|
||||||
return t.rootKey
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t treeKeys) RawChangeKey(id string) []byte {
|
|
||||||
return treestorage.JoinStringsToBytes("space", t.spaceId, "t", t.id, id)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t treeKeys) RawChangePrefix() []byte {
|
|
||||||
return t.rawChangePrefix
|
|
||||||
}
|
|
||||||
|
|
||||||
type spaceKeys struct {
|
|
||||||
spaceId string
|
|
||||||
headerKey []byte
|
|
||||||
treePrefixKey []byte
|
|
||||||
spaceSettingsIdKey []byte
|
|
||||||
}
|
|
||||||
|
|
||||||
func newSpaceKeys(spaceId string) spaceKeys {
|
|
||||||
return spaceKeys{
|
|
||||||
spaceId: spaceId,
|
|
||||||
headerKey: treestorage.JoinStringsToBytes("space", "header", spaceId),
|
|
||||||
treePrefixKey: treestorage.JoinStringsToBytes("space", spaceId, "t", "rootId"),
|
|
||||||
spaceSettingsIdKey: treestorage.JoinStringsToBytes("space", spaceId, "spaceSettingsId"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s spaceKeys) HeaderKey() []byte {
|
|
||||||
return s.headerKey
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s spaceKeys) TreeRootPrefix() []byte {
|
|
||||||
return s.treePrefixKey
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s spaceKeys) SpaceSettingsId() []byte {
|
|
||||||
return s.spaceSettingsIdKey
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s spaceKeys) TreeDeletedKey(id string) []byte {
|
|
||||||
return treestorage.JoinStringsToBytes("space", s.spaceId, "deleted", id)
|
|
||||||
}
|
|
||||||
|
|
||||||
type storageServiceKeys struct {
|
|
||||||
spacePrefix []byte
|
|
||||||
}
|
|
||||||
|
|
||||||
func newStorageServiceKeys() storageServiceKeys {
|
|
||||||
return storageServiceKeys{spacePrefix: []byte("space/header")}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s storageServiceKeys) SpacePrefix() []byte {
|
|
||||||
return s.spacePrefix
|
|
||||||
}
|
|
|
@ -1,119 +0,0 @@
|
||||||
package storage
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"errors"
|
|
||||||
"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"
|
|
||||||
)
|
|
||||||
|
|
||||||
var ErrIncorrectKey = errors.New("key format is incorrect")
|
|
||||||
|
|
||||||
type listStorage struct {
|
|
||||||
db *badger.DB
|
|
||||||
keys aclKeys
|
|
||||||
id string
|
|
||||||
root *aclrecordproto.RawAclRecordWithId
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
stringId := string(rootId)
|
|
||||||
value, err := getTxn(txn, keys.RawRecordKey(stringId))
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
rootWithId := &aclrecordproto.RawAclRecordWithId{
|
|
||||||
Payload: value,
|
|
||||||
Id: stringId,
|
|
||||||
}
|
|
||||||
|
|
||||||
ls = &listStorage{
|
|
||||||
db: db,
|
|
||||||
keys: newACLKeys(spaceId),
|
|
||||||
id: stringId,
|
|
||||||
root: rootWithId,
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
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 {
|
|
||||||
return newListStorage(spaceId, db, txn)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
err = txn.Set(keys.HeadIdKey(), []byte(root.Id))
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
err = txn.Set(keys.RawRecordKey(root.Id), root.Payload)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = txn.Set(keys.RootIdKey(), []byte(root.Id))
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
ls = &listStorage{
|
|
||||||
db: db,
|
|
||||||
keys: newACLKeys(spaceId),
|
|
||||||
id: root.Id,
|
|
||||||
root: root,
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l *listStorage) Id() string {
|
|
||||||
return l.id
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l *listStorage) Root() (*aclrecordproto.RawAclRecordWithId, error) {
|
|
||||||
return l.root, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (l *listStorage) Head() (head string, err error) {
|
|
||||||
bytes, err := getDB(l.db, l.keys.HeadIdKey())
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
head = string(bytes)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
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 = liststorage.ErrUnknownRecord
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
raw = &aclrecordproto.RawAclRecordWithId{
|
|
||||||
Payload: res,
|
|
||||||
Id: id,
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
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 {
|
|
||||||
return putDB(l.db, l.keys.RawRecordKey(rec.Id), rec.Payload)
|
|
||||||
}
|
|
|
@ -1,72 +0,0 @@
|
||||||
package storage
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"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 liststorage.ListStorage, root *aclrecordproto.RawAclRecordWithId, head string) {
|
|
||||||
require.Equal(t, store.Id(), root.Id)
|
|
||||||
|
|
||||||
aclRoot, err := store.Root()
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Equal(t, root, aclRoot)
|
|
||||||
|
|
||||||
aclHead, err := store.Head()
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Equal(t, head, aclHead)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestListStorage(t *testing.T) {
|
|
||||||
fx := newFixture(t)
|
|
||||||
fx.open(t)
|
|
||||||
defer fx.stop(t)
|
|
||||||
spaceId := "spaceId"
|
|
||||||
aclRoot := &aclrecordproto.RawAclRecordWithId{Payload: []byte("root"), Id: "someRootId"}
|
|
||||||
|
|
||||||
fx.db.Update(func(txn *badger.Txn) error {
|
|
||||||
_, err := createListStorage(spaceId, fx.db, txn, aclRoot)
|
|
||||||
require.NoError(t, err)
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
|
|
||||||
var listStore liststorage.ListStorage
|
|
||||||
fx.db.View(func(txn *badger.Txn) (err error) {
|
|
||||||
listStore, err = newListStorage(spaceId, fx.db, txn)
|
|
||||||
require.NoError(t, err)
|
|
||||||
testList(t, listStore, aclRoot, aclRoot.Id)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
|
|
||||||
t.Run("create same storage returns no error", func(t *testing.T) {
|
|
||||||
fx.db.View(func(txn *badger.Txn) error {
|
|
||||||
// this is ok, because we only create new list storage when we create space storage
|
|
||||||
listStore, err := createListStorage(spaceId, fx.db, txn, aclRoot)
|
|
||||||
require.NoError(t, err)
|
|
||||||
testList(t, listStore, aclRoot, aclRoot.Id)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
t.Run("set head", func(t *testing.T) {
|
|
||||||
head := "newHead"
|
|
||||||
require.NoError(t, listStore.SetHead(head))
|
|
||||||
aclHead, err := listStore.Head()
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Equal(t, head, aclHead)
|
|
||||||
})
|
|
||||||
|
|
||||||
t.Run("add raw record and get raw record", func(t *testing.T) {
|
|
||||||
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)
|
|
||||||
require.Equal(t, newRec, aclRec)
|
|
||||||
})
|
|
||||||
}
|
|
|
@ -1,194 +0,0 @@
|
||||||
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"
|
|
||||||
"github.com/dgraph-io/badger/v3"
|
|
||||||
)
|
|
||||||
|
|
||||||
type spaceStorage struct {
|
|
||||||
spaceId string
|
|
||||||
spaceSettingsId string
|
|
||||||
objDb *badger.DB
|
|
||||||
keys spaceKeys
|
|
||||||
aclStorage liststorage.ListStorage
|
|
||||||
header *spacesyncproto.RawSpaceHeaderWithId
|
|
||||||
}
|
|
||||||
|
|
||||||
var spaceValidationFunc = spacestorage.ValidateSpaceStorageCreatePayload
|
|
||||||
|
|
||||||
func newSpaceStorage(objDb *badger.DB, spaceId string) (store spacestorage.SpaceStorage, err error) {
|
|
||||||
keys := newSpaceKeys(spaceId)
|
|
||||||
err = objDb.View(func(txn *badger.Txn) error {
|
|
||||||
header, err := getTxn(txn, keys.HeaderKey())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
aclStorage, err := newListStorage(spaceId, objDb, txn)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
spaceSettingsId, err := getTxn(txn, keys.SpaceSettingsId())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
store = &spaceStorage{
|
|
||||||
spaceId: spaceId,
|
|
||||||
spaceSettingsId: string(spaceSettingsId),
|
|
||||||
objDb: objDb,
|
|
||||||
keys: keys,
|
|
||||||
header: &spacesyncproto.RawSpaceHeaderWithId{
|
|
||||||
RawHeader: header,
|
|
||||||
Id: spaceId,
|
|
||||||
},
|
|
||||||
aclStorage: aclStorage,
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
if err == badger.ErrKeyNotFound {
|
|
||||||
err = spacestorage.ErrSpaceStorageMissing
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func createSpaceStorage(db *badger.DB, payload spacestorage.SpaceStorageCreatePayload) (store spacestorage.SpaceStorage, err error) {
|
|
||||||
keys := newSpaceKeys(payload.SpaceHeaderWithId.Id)
|
|
||||||
if hasDB(db, keys.HeaderKey()) {
|
|
||||||
err = spacestorage.ErrSpaceStorageExists
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = spaceValidationFunc(payload)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
spaceStore := &spaceStorage{
|
|
||||||
spaceId: payload.SpaceHeaderWithId.Id,
|
|
||||||
objDb: db,
|
|
||||||
keys: keys,
|
|
||||||
spaceSettingsId: payload.SpaceSettingsWithId.Id,
|
|
||||||
header: payload.SpaceHeaderWithId,
|
|
||||||
}
|
|
||||||
_, err = spaceStore.CreateTreeStorage(storage.TreeStorageCreatePayload{
|
|
||||||
RootRawChange: payload.SpaceSettingsWithId,
|
|
||||||
Changes: []*treechangeproto.RawTreeChangeWithId{payload.SpaceSettingsWithId},
|
|
||||||
Heads: []string{payload.SpaceSettingsWithId.Id},
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = db.Update(func(txn *badger.Txn) error {
|
|
||||||
err = txn.Set(keys.SpaceSettingsId(), []byte(payload.SpaceSettingsWithId.Id))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
aclStorage, err := createListStorage(payload.SpaceHeaderWithId.Id, db, txn, payload.AclWithId)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = txn.Set(keys.HeaderKey(), payload.SpaceHeaderWithId.RawHeader)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
spaceStore.aclStorage = aclStorage
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
store = spaceStore
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *spaceStorage) Id() string {
|
|
||||||
return s.spaceId
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *spaceStorage) SpaceSettingsId() string {
|
|
||||||
return s.spaceSettingsId
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *spaceStorage) TreeStorage(id string) (storage.TreeStorage, error) {
|
|
||||||
return newTreeStorage(s.objDb, s.spaceId, id)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *spaceStorage) CreateTreeStorage(payload storage.TreeStorageCreatePayload) (ts storage.TreeStorage, err error) {
|
|
||||||
return createTreeStorage(s.objDb, s.spaceId, payload)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *spaceStorage) AclStorage() (liststorage.ListStorage, error) {
|
|
||||||
return s.aclStorage, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *spaceStorage) SpaceHeader() (header *spacesyncproto.RawSpaceHeaderWithId, err error) {
|
|
||||||
return s.header, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *spaceStorage) StoredIds() (ids []string, err error) {
|
|
||||||
err = s.objDb.View(func(txn *badger.Txn) error {
|
|
||||||
opts := badger.DefaultIteratorOptions
|
|
||||||
opts.PrefetchValues = false
|
|
||||||
opts.Prefix = s.keys.TreeRootPrefix()
|
|
||||||
|
|
||||||
it := txn.NewIterator(opts)
|
|
||||||
defer it.Close()
|
|
||||||
|
|
||||||
for it.Rewind(); it.Valid(); it.Next() {
|
|
||||||
item := it.Item()
|
|
||||||
id := make([]byte, 0, len(item.Key()))
|
|
||||||
id = item.KeyCopy(id)
|
|
||||||
if len(id) <= len(s.keys.TreeRootPrefix())+1 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
id = id[len(s.keys.TreeRootPrefix())+1:]
|
|
||||||
ids = append(ids, string(id))
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *spaceStorage) SetTreeDeletedStatus(id, status string) (err error) {
|
|
||||||
return s.objDb.Update(func(txn *badger.Txn) error {
|
|
||||||
return txn.Set(s.keys.TreeDeletedKey(id), []byte(status))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *spaceStorage) TreeDeletedStatus(id string) (status string, err error) {
|
|
||||||
err = s.objDb.View(func(txn *badger.Txn) error {
|
|
||||||
res, err := getTxn(txn, s.keys.TreeDeletedKey(id))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
status = string(res)
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
if err == badger.ErrKeyNotFound {
|
|
||||||
err = nil
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *spaceStorage) TreeRoot(id string) (root *treechangeproto.RawTreeChangeWithId, err error) {
|
|
||||||
keys := newTreeKeys(s.spaceId, id)
|
|
||||||
err = s.objDb.View(func(txn *badger.Txn) error {
|
|
||||||
bytes, err := getTxn(txn, keys.RawChangeKey(id))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
root = &treechangeproto.RawTreeChangeWithId{
|
|
||||||
RawChange: bytes,
|
|
||||||
Id: id,
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *spaceStorage) Close() (err error) {
|
|
||||||
return nil
|
|
||||||
}
|
|
|
@ -1,126 +0,0 @@
|
||||||
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"
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
"sort"
|
|
||||||
"strconv"
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
func spaceTestPayload() spacestorage.SpaceStorageCreatePayload {
|
|
||||||
header := &spacesyncproto.RawSpaceHeaderWithId{
|
|
||||||
RawHeader: []byte("header"),
|
|
||||||
Id: "headerId",
|
|
||||||
}
|
|
||||||
aclRoot := &aclrecordproto.RawAclRecordWithId{
|
|
||||||
Payload: []byte("aclRoot"),
|
|
||||||
Id: "aclRootId",
|
|
||||||
}
|
|
||||||
settings := &treechangeproto.RawTreeChangeWithId{
|
|
||||||
RawChange: []byte("settings"),
|
|
||||||
Id: "settingsId",
|
|
||||||
}
|
|
||||||
return spacestorage.SpaceStorageCreatePayload{
|
|
||||||
AclWithId: aclRoot,
|
|
||||||
SpaceHeaderWithId: header,
|
|
||||||
SpaceSettingsWithId: settings,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func testSpace(t *testing.T, store spacestorage.SpaceStorage, payload spacestorage.SpaceStorageCreatePayload) {
|
|
||||||
header, err := store.SpaceHeader()
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Equal(t, payload.SpaceHeaderWithId, header)
|
|
||||||
|
|
||||||
aclStorage, err := store.AclStorage()
|
|
||||||
require.NoError(t, err)
|
|
||||||
testList(t, aclStorage, payload.AclWithId, payload.AclWithId.Id)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestSpaceStorage_Create(t *testing.T) {
|
|
||||||
fx := newFixture(t)
|
|
||||||
fx.open(t)
|
|
||||||
defer fx.stop(t)
|
|
||||||
|
|
||||||
payload := spaceTestPayload()
|
|
||||||
store, err := createSpaceStorage(fx.db, payload)
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
testSpace(t, store, payload)
|
|
||||||
require.NoError(t, store.Close())
|
|
||||||
|
|
||||||
t.Run("create same storage returns error", func(t *testing.T) {
|
|
||||||
_, err := createSpaceStorage(fx.db, payload)
|
|
||||||
require.Error(t, err)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestSpaceStorage_NewAndCreateTree(t *testing.T) {
|
|
||||||
fx := newFixture(t)
|
|
||||||
fx.open(t)
|
|
||||||
|
|
||||||
payload := spaceTestPayload()
|
|
||||||
store, err := createSpaceStorage(fx.db, payload)
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.NoError(t, store.Close())
|
|
||||||
fx.stop(t)
|
|
||||||
|
|
||||||
fx.open(t)
|
|
||||||
defer fx.stop(t)
|
|
||||||
store, err = newSpaceStorage(fx.db, payload.SpaceHeaderWithId.Id)
|
|
||||||
require.NoError(t, err)
|
|
||||||
testSpace(t, store, payload)
|
|
||||||
|
|
||||||
t.Run("create tree, get tree and mark deleted", func(t *testing.T) {
|
|
||||||
payload := treeTestPayload()
|
|
||||||
treeStore, err := store.CreateTreeStorage(payload)
|
|
||||||
require.NoError(t, err)
|
|
||||||
testTreePayload(t, treeStore, payload)
|
|
||||||
|
|
||||||
otherStore, err := store.TreeStorage(payload.RootRawChange.Id)
|
|
||||||
require.NoError(t, err)
|
|
||||||
testTreePayload(t, otherStore, payload)
|
|
||||||
|
|
||||||
initialStatus := "deleted"
|
|
||||||
err = store.SetTreeDeletedStatus(otherStore.Id(), initialStatus)
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
status, err := store.TreeDeletedStatus(otherStore.Id())
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Equal(t, initialStatus, status)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestSpaceStorage_StoredIds(t *testing.T) {
|
|
||||||
fx := newFixture(t)
|
|
||||||
fx.open(t)
|
|
||||||
defer fx.stop(t)
|
|
||||||
|
|
||||||
payload := spaceTestPayload()
|
|
||||||
store, err := createSpaceStorage(fx.db, payload)
|
|
||||||
require.NoError(t, err)
|
|
||||||
defer func() {
|
|
||||||
require.NoError(t, store.Close())
|
|
||||||
}()
|
|
||||||
|
|
||||||
n := 5
|
|
||||||
var ids []string
|
|
||||||
for i := 0; i < n; i++ {
|
|
||||||
treePayload := treeTestPayload()
|
|
||||||
treePayload.RootRawChange.Id += strconv.Itoa(i)
|
|
||||||
ids = append(ids, treePayload.RootRawChange.Id)
|
|
||||||
_, err := store.CreateTreeStorage(treePayload)
|
|
||||||
require.NoError(t, err)
|
|
||||||
}
|
|
||||||
ids = append(ids, payload.SpaceSettingsWithId.Id)
|
|
||||||
sort.Strings(ids)
|
|
||||||
|
|
||||||
storedIds, err := store.StoredIds()
|
|
||||||
require.NoError(t, err)
|
|
||||||
sort.Strings(storedIds)
|
|
||||||
require.Equal(t, ids, storedIds)
|
|
||||||
}
|
|
|
@ -1,84 +0,0 @@
|
||||||
package storage
|
|
||||||
|
|
||||||
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/spacestorage"
|
|
||||||
"github.com/dgraph-io/badger/v3"
|
|
||||||
)
|
|
||||||
|
|
||||||
type storageService struct {
|
|
||||||
keys storageServiceKeys
|
|
||||||
db *badger.DB
|
|
||||||
}
|
|
||||||
|
|
||||||
type ClientStorage interface {
|
|
||||||
spacestorage.SpaceStorageProvider
|
|
||||||
app.ComponentRunnable
|
|
||||||
AllSpaceIds() (ids []string, err error)
|
|
||||||
}
|
|
||||||
|
|
||||||
func New() ClientStorage {
|
|
||||||
return &storageService{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *storageService) Init(a *app.App) (err error) {
|
|
||||||
provider := a.MustComponent(badgerprovider.CName).(badgerprovider.BadgerProvider)
|
|
||||||
s.db = provider.Badger()
|
|
||||||
s.keys = newStorageServiceKeys()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *storageService) Name() (name string) {
|
|
||||||
return spacestorage.CName
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *storageService) SpaceStorage(id string) (spacestorage.SpaceStorage, error) {
|
|
||||||
return newSpaceStorage(s.db, id)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *storageService) SpaceExists(id string) bool {
|
|
||||||
return s.db.View(func(txn *badger.Txn) error {
|
|
||||||
_, err := getTxn(txn, newSpaceKeys(id).HeaderKey())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}) == nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *storageService) CreateSpaceStorage(payload spacestorage.SpaceStorageCreatePayload) (spacestorage.SpaceStorage, error) {
|
|
||||||
return createSpaceStorage(s.db, payload)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *storageService) AllSpaceIds() (ids []string, err error) {
|
|
||||||
err = s.db.View(func(txn *badger.Txn) error {
|
|
||||||
opts := badger.DefaultIteratorOptions
|
|
||||||
opts.PrefetchValues = false
|
|
||||||
opts.Prefix = s.keys.SpacePrefix()
|
|
||||||
|
|
||||||
it := txn.NewIterator(opts)
|
|
||||||
defer it.Close()
|
|
||||||
|
|
||||||
for it.Rewind(); it.Valid(); it.Next() {
|
|
||||||
item := it.Item()
|
|
||||||
id := item.Key()
|
|
||||||
if len(id) <= len(s.keys.SpacePrefix())+1 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
id = id[len(s.keys.SpacePrefix())+1:]
|
|
||||||
ids = append(ids, string(id))
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *storageService) Run(ctx context.Context) (err error) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *storageService) Close(ctx context.Context) (err error) {
|
|
||||||
return s.db.Close()
|
|
||||||
}
|
|
|
@ -1,181 +0,0 @@
|
||||||
package storage
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"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"
|
|
||||||
)
|
|
||||||
|
|
||||||
type treeStorage struct {
|
|
||||||
db *badger.DB
|
|
||||||
keys treeKeys
|
|
||||||
id string
|
|
||||||
root *treechangeproto.RawTreeChangeWithId
|
|
||||||
}
|
|
||||||
|
|
||||||
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())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
root, err := getTxn(txn, keys.RawChangeKey(treeId))
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
rootWithId := &treechangeproto.RawTreeChangeWithId{
|
|
||||||
RawChange: root,
|
|
||||||
Id: treeId,
|
|
||||||
}
|
|
||||||
|
|
||||||
ts = &treeStorage{
|
|
||||||
db: db,
|
|
||||||
keys: keys,
|
|
||||||
id: treeId,
|
|
||||||
root: rootWithId,
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
if err == badger.ErrKeyNotFound {
|
|
||||||
err = treestorage.ErrUnknownTreeId
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
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 = treestorage.ErrTreeExists
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = db.Update(func(txn *badger.Txn) error {
|
|
||||||
heads := treestorage.CreateHeadsPayload(payload.Heads)
|
|
||||||
|
|
||||||
for _, ch := range payload.Changes {
|
|
||||||
err = txn.Set(keys.RawChangeKey(ch.Id), ch.GetRawChange())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
err = txn.Set(keys.RawChangeKey(payload.RootRawChange.Id), payload.RootRawChange.GetRawChange())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = txn.Set(keys.HeadsKey(), heads)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = txn.Set(keys.RootIdKey(), nil)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
ts = &treeStorage{
|
|
||||||
db: db,
|
|
||||||
keys: keys,
|
|
||||||
id: payload.RootRawChange.Id,
|
|
||||||
root: payload.RootRawChange,
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *treeStorage) Id() string {
|
|
||||||
return t.id
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *treeStorage) Root() (raw *treechangeproto.RawTreeChangeWithId, err error) {
|
|
||||||
return t.root, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *treeStorage) Heads() (heads []string, err error) {
|
|
||||||
headsBytes, err := getDB(t.db, t.keys.HeadsKey())
|
|
||||||
if err != nil {
|
|
||||||
if err == badger.ErrKeyNotFound {
|
|
||||||
err = treestorage.ErrUnknownTreeId
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
heads = treestorage.ParseHeads(headsBytes)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *treeStorage) SetHeads(heads []string) (err error) {
|
|
||||||
payload := treestorage.CreateHeadsPayload(heads)
|
|
||||||
return putDB(t.db, t.keys.HeadsKey(), payload)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *treeStorage) AddRawChange(change *treechangeproto.RawTreeChangeWithId) (err error) {
|
|
||||||
return putDB(t.db, t.keys.RawChangeKey(change.Id), change.RawChange)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *treeStorage) GetRawChange(ctx context.Context, id string) (raw *treechangeproto.RawTreeChangeWithId, err error) {
|
|
||||||
res, err := getDB(t.db, t.keys.RawChangeKey(id))
|
|
||||||
if err != nil {
|
|
||||||
if err == badger.ErrKeyNotFound {
|
|
||||||
err = treestorage.ErrUnknownTreeId
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
raw = &treechangeproto.RawTreeChangeWithId{
|
|
||||||
RawChange: res,
|
|
||||||
Id: id,
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *treeStorage) HasChange(ctx context.Context, id string) (bool, error) {
|
|
||||||
return hasDB(t.db, t.keys.RawChangeKey(id)), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *treeStorage) Delete() (err error) {
|
|
||||||
storedKeys, err := t.storedKeys()
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = t.db.Update(func(txn *badger.Txn) error {
|
|
||||||
for _, k := range storedKeys {
|
|
||||||
err = txn.Delete(k)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *treeStorage) storedKeys() (keys [][]byte, err error) {
|
|
||||||
err = t.db.View(func(txn *badger.Txn) error {
|
|
||||||
opts := badger.DefaultIteratorOptions
|
|
||||||
opts.PrefetchValues = false
|
|
||||||
// this will get all raw changes and also "heads"
|
|
||||||
opts.Prefix = t.keys.RawChangePrefix()
|
|
||||||
|
|
||||||
it := txn.NewIterator(opts)
|
|
||||||
defer it.Close()
|
|
||||||
|
|
||||||
for it.Rewind(); it.Valid(); it.Next() {
|
|
||||||
item := it.Item()
|
|
||||||
key := item.Key()
|
|
||||||
keyCopy := make([]byte, 0, len(key))
|
|
||||||
keyCopy = item.KeyCopy(keyCopy)
|
|
||||||
keys = append(keys, keyCopy)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
keys = append(keys, t.keys.RootIdKey())
|
|
||||||
return
|
|
||||||
}
|
|
|
@ -1,188 +0,0 @@
|
||||||
package storage
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"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() 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 treestorage.TreeStorageCreatePayload{
|
|
||||||
RootRawChange: rootRawChange,
|
|
||||||
Changes: changes,
|
|
||||||
Heads: []string{rootRawChange.Id},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type fixture struct {
|
|
||||||
dir string
|
|
||||||
db *badger.DB
|
|
||||||
}
|
|
||||||
|
|
||||||
func testTreePayload(t *testing.T, store treestorage.TreeStorage, payload treestorage.TreeStorageCreatePayload) {
|
|
||||||
require.Equal(t, payload.RootRawChange.Id, store.Id())
|
|
||||||
|
|
||||||
root, err := store.Root()
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Equal(t, root, payload.RootRawChange)
|
|
||||||
|
|
||||||
heads, err := store.Heads()
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Equal(t, payload.Heads, heads)
|
|
||||||
|
|
||||||
for _, ch := range payload.Changes {
|
|
||||||
dbCh, err := store.GetRawChange(context.Background(), ch.Id)
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Equal(t, ch, dbCh)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func newFixture(t *testing.T) *fixture {
|
|
||||||
dir, err := os.MkdirTemp("", "")
|
|
||||||
require.NoError(t, err)
|
|
||||||
return &fixture{dir: dir}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (fx *fixture) open(t *testing.T) {
|
|
||||||
var err error
|
|
||||||
fx.db, err = badger.Open(badger.DefaultOptions(fx.dir))
|
|
||||||
require.NoError(t, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (fx *fixture) stop(t *testing.T) {
|
|
||||||
require.NoError(t, fx.db.Close())
|
|
||||||
}
|
|
||||||
|
|
||||||
func (fx *fixture) testNoKeysExist(t *testing.T, spaceId, treeId string) {
|
|
||||||
treeKeys := newTreeKeys(spaceId, treeId)
|
|
||||||
|
|
||||||
var keys [][]byte
|
|
||||||
err := fx.db.View(func(txn *badger.Txn) error {
|
|
||||||
opts := badger.DefaultIteratorOptions
|
|
||||||
opts.PrefetchValues = false
|
|
||||||
opts.Prefix = treeKeys.RawChangePrefix()
|
|
||||||
|
|
||||||
it := txn.NewIterator(opts)
|
|
||||||
defer it.Close()
|
|
||||||
|
|
||||||
for it.Rewind(); it.Valid(); it.Next() {
|
|
||||||
item := it.Item()
|
|
||||||
key := item.Key()
|
|
||||||
keyCopy := make([]byte, 0, len(key))
|
|
||||||
keyCopy = item.KeyCopy(key)
|
|
||||||
keys = append(keys, keyCopy)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Equal(t, 0, len(keys))
|
|
||||||
|
|
||||||
err = fx.db.View(func(txn *badger.Txn) error {
|
|
||||||
_, err = getTxn(txn, treeKeys.RootIdKey())
|
|
||||||
require.Equal(t, err, badger.ErrKeyNotFound)
|
|
||||||
|
|
||||||
_, err = getTxn(txn, treeKeys.HeadsKey())
|
|
||||||
require.Equal(t, err, badger.ErrKeyNotFound)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestTreeStorage_Create(t *testing.T) {
|
|
||||||
fx := newFixture(t)
|
|
||||||
fx.open(t)
|
|
||||||
defer fx.stop(t)
|
|
||||||
|
|
||||||
spaceId := "spaceId"
|
|
||||||
payload := treeTestPayload()
|
|
||||||
store, err := createTreeStorage(fx.db, spaceId, payload)
|
|
||||||
require.NoError(t, err)
|
|
||||||
testTreePayload(t, store, payload)
|
|
||||||
|
|
||||||
t.Run("create same storage returns error", func(t *testing.T) {
|
|
||||||
_, err := createTreeStorage(fx.db, spaceId, payload)
|
|
||||||
require.Error(t, err)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestTreeStorage_Methods(t *testing.T) {
|
|
||||||
fx := newFixture(t)
|
|
||||||
fx.open(t)
|
|
||||||
payload := treeTestPayload()
|
|
||||||
spaceId := "spaceId"
|
|
||||||
_, err := createTreeStorage(fx.db, spaceId, payload)
|
|
||||||
require.NoError(t, err)
|
|
||||||
fx.stop(t)
|
|
||||||
|
|
||||||
fx.open(t)
|
|
||||||
defer fx.stop(t)
|
|
||||||
store, err := newTreeStorage(fx.db, spaceId, payload.RootRawChange.Id)
|
|
||||||
require.NoError(t, err)
|
|
||||||
testTreePayload(t, store, payload)
|
|
||||||
|
|
||||||
t.Run("update heads", func(t *testing.T) {
|
|
||||||
newHeads := []string{"a", "b"}
|
|
||||||
require.NoError(t, store.SetHeads(newHeads))
|
|
||||||
heads, err := store.Heads()
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Equal(t, newHeads, heads)
|
|
||||||
})
|
|
||||||
|
|
||||||
t.Run("add raw change, get change and has change", func(t *testing.T) {
|
|
||||||
newChange := &treechangeproto.RawTreeChangeWithId{RawChange: []byte("ab"), Id: "newId"}
|
|
||||||
require.NoError(t, store.AddRawChange(newChange))
|
|
||||||
rawCh, err := store.GetRawChange(context.Background(), newChange.Id)
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Equal(t, newChange, rawCh)
|
|
||||||
has, err := store.HasChange(context.Background(), newChange.Id)
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.True(t, has)
|
|
||||||
})
|
|
||||||
|
|
||||||
t.Run("get and has for unknown change", func(t *testing.T) {
|
|
||||||
incorrectId := "incorrectId"
|
|
||||||
_, err := store.GetRawChange(context.Background(), incorrectId)
|
|
||||||
require.Error(t, err)
|
|
||||||
has, err := store.HasChange(context.Background(), incorrectId)
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.False(t, has)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestTreeStorage_Delete(t *testing.T) {
|
|
||||||
fx := newFixture(t)
|
|
||||||
fx.open(t)
|
|
||||||
payload := treeTestPayload()
|
|
||||||
spaceId := "spaceId"
|
|
||||||
_, err := createTreeStorage(fx.db, spaceId, payload)
|
|
||||||
require.NoError(t, err)
|
|
||||||
fx.stop(t)
|
|
||||||
|
|
||||||
fx.open(t)
|
|
||||||
defer fx.stop(t)
|
|
||||||
store, err := newTreeStorage(fx.db, spaceId, payload.RootRawChange.Id)
|
|
||||||
require.NoError(t, err)
|
|
||||||
testTreePayload(t, store, payload)
|
|
||||||
|
|
||||||
t.Run("add raw change, get change and has change", func(t *testing.T) {
|
|
||||||
newChange := &treechangeproto.RawTreeChangeWithId{RawChange: []byte("ab"), Id: "newId"}
|
|
||||||
require.NoError(t, store.AddRawChange(newChange))
|
|
||||||
|
|
||||||
err = store.Delete()
|
|
||||||
require.NoError(t, err)
|
|
||||||
|
|
||||||
_, err = newTreeStorage(fx.db, spaceId, payload.RootRawChange.Id)
|
|
||||||
require.Equal(t, err, treestorage.ErrUnknownTreeId)
|
|
||||||
|
|
||||||
fx.testNoKeysExist(t, spaceId, payload.RootRawChange.Id)
|
|
||||||
})
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
.PHONY: proto test
|
|
||||||
export GOPRIVATE=github.com/anytypeio
|
|
||||||
|
|
||||||
proto:
|
|
||||||
@echo 'Generating protobuf packages (Go)...'
|
|
||||||
|
|
||||||
@$(eval GOGO_START := GOGO_NO_UNDERSCORE=1 GOGO_EXPORT_ONEOF_INTERFACE=1)
|
|
||||||
@$(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
|
|
||||||
$(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
|
|
|
@ -1,11 +0,0 @@
|
||||||
//go:generate mockgen -destination mock_updatelistener/mock_updatelistener.go github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/synctree/updatelistener UpdateListener
|
|
||||||
package updatelistener
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/objecttree"
|
|
||||||
)
|
|
||||||
|
|
||||||
type UpdateListener interface {
|
|
||||||
Update(tree objecttree.ObjectTree)
|
|
||||||
Rebuild(tree objecttree.ObjectTree)
|
|
||||||
}
|
|
|
@ -2,8 +2,8 @@ package fileblockstore
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/logger"
|
"github.com/anytypeio/any-sync/app/logger"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonfile/fileproto/fileprotoerr"
|
"github.com/anytypeio/any-sync/commonfile/fileproto/fileprotoerr"
|
||||||
blocks "github.com/ipfs/go-block-format"
|
blocks "github.com/ipfs/go-block-format"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
)
|
)
|
|
@ -2,8 +2,8 @@ package fileprotoerr
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonfile/fileproto"
|
"github.com/anytypeio/any-sync/commonfile/fileproto"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/rpc/rpcerr"
|
"github.com/anytypeio/any-sync/net/rpc/rpcerr"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -2,7 +2,7 @@ package fileservice
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonfile/fileblockstore"
|
"github.com/anytypeio/any-sync/commonfile/fileblockstore"
|
||||||
blocks "github.com/ipfs/go-block-format"
|
blocks "github.com/ipfs/go-block-format"
|
||||||
"github.com/ipfs/go-blockservice"
|
"github.com/ipfs/go-blockservice"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
|
@ -3,9 +3,9 @@ package fileservice
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app"
|
"github.com/anytypeio/any-sync/app"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/logger"
|
"github.com/anytypeio/any-sync/app/logger"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonfile/fileblockstore"
|
"github.com/anytypeio/any-sync/commonfile/fileblockstore"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
chunker "github.com/ipfs/go-ipfs-chunker"
|
chunker "github.com/ipfs/go-ipfs-chunker"
|
||||||
ipld "github.com/ipfs/go-ipld-format"
|
ipld "github.com/ipfs/go-ipld-format"
|
|
@ -2,10 +2,10 @@ package commonspace
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/syncacl"
|
"github.com/anytypeio/any-sync/commonspace/object/acl/syncacl"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/syncobjectgetter"
|
"github.com/anytypeio/any-sync/commonspace/object/syncobjectgetter"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/treegetter"
|
"github.com/anytypeio/any-sync/commonspace/object/treegetter"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/settings"
|
"github.com/anytypeio/any-sync/commonspace/settings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type commonSpaceGetter struct {
|
type commonSpaceGetter struct {
|
|
@ -1,8 +1,8 @@
|
||||||
package commonspace
|
package commonspace
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treestorage"
|
"github.com/anytypeio/any-sync/commonspace/object/tree/treestorage"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacestorage"
|
"github.com/anytypeio/any-sync/commonspace/spacestorage"
|
||||||
)
|
)
|
||||||
|
|
||||||
type commonStorage struct {
|
type commonStorage struct {
|
|
@ -1,11 +1,11 @@
|
||||||
//go:generate mockgen -destination mock_confconnector/mock_confconnector.go github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/confconnector ConfConnector
|
//go:generate mockgen -destination mock_confconnector/mock_confconnector.go github.com/anytypeio/any-sync/commonspace/confconnector ConfConnector
|
||||||
package confconnector
|
package confconnector
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/peer"
|
"github.com/anytypeio/any-sync/net/peer"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/pool"
|
"github.com/anytypeio/any-sync/net/pool"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/nodeconf"
|
"github.com/anytypeio/any-sync/nodeconf"
|
||||||
"golang.org/x/exp/slices"
|
"golang.org/x/exp/slices"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Code generated by MockGen. DO NOT EDIT.
|
// Code generated by MockGen. DO NOT EDIT.
|
||||||
// Source: github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/confconnector (interfaces: ConfConnector)
|
// Source: github.com/anytypeio/any-sync/commonspace/confconnector (interfaces: ConfConnector)
|
||||||
|
|
||||||
// Package mock_confconnector is a generated GoMock package.
|
// Package mock_confconnector is a generated GoMock package.
|
||||||
package mock_confconnector
|
package mock_confconnector
|
||||||
|
@ -8,9 +8,9 @@ import (
|
||||||
context "context"
|
context "context"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
|
|
||||||
peer "github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/peer"
|
peer "github.com/anytypeio/any-sync/net/peer"
|
||||||
pool "github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/pool"
|
pool "github.com/anytypeio/any-sync/net/pool"
|
||||||
nodeconf "github.com/anytypeio/go-anytype-infrastructure-experiments/common/nodeconf"
|
nodeconf "github.com/anytypeio/any-sync/nodeconf"
|
||||||
gomock "github.com/golang/mock/gomock"
|
gomock "github.com/golang/mock/gomock"
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,16 +2,16 @@ package headsync
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/ldiff"
|
"github.com/anytypeio/any-sync/app/ldiff"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/confconnector"
|
"github.com/anytypeio/any-sync/commonspace/confconnector"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/synctree"
|
"github.com/anytypeio/any-sync/commonspace/object/tree/synctree"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/treegetter"
|
"github.com/anytypeio/any-sync/commonspace/object/treegetter"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/settings/deletionstate"
|
"github.com/anytypeio/any-sync/commonspace/settings/deletionstate"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacestorage"
|
"github.com/anytypeio/any-sync/commonspace/spacestorage"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto"
|
"github.com/anytypeio/any-sync/commonspace/spacesyncproto"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/syncstatus"
|
"github.com/anytypeio/any-sync/commonspace/syncstatus"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/peer"
|
"github.com/anytypeio/any-sync/net/peer"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/rpc/rpcerr"
|
"github.com/anytypeio/any-sync/net/rpc/rpcerr"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
|
@ -3,20 +3,20 @@ package headsync
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/ldiff"
|
"github.com/anytypeio/any-sync/app/ldiff"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/ldiff/mock_ldiff"
|
"github.com/anytypeio/any-sync/app/ldiff/mock_ldiff"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/logger"
|
"github.com/anytypeio/any-sync/app/logger"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/confconnector/mock_confconnector"
|
"github.com/anytypeio/any-sync/commonspace/confconnector/mock_confconnector"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
|
"github.com/anytypeio/any-sync/commonspace/object/acl/aclrecordproto"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treechangeproto"
|
"github.com/anytypeio/any-sync/commonspace/object/tree/treechangeproto"
|
||||||
mock_treestorage "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treestorage/mock_treestorage"
|
mock_treestorage "github.com/anytypeio/any-sync/commonspace/object/tree/treestorage/mock_treestorage"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/treegetter/mock_treegetter"
|
"github.com/anytypeio/any-sync/commonspace/object/treegetter/mock_treegetter"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/settings/deletionstate/mock_deletionstate"
|
"github.com/anytypeio/any-sync/commonspace/settings/deletionstate/mock_deletionstate"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacestorage/mock_spacestorage"
|
"github.com/anytypeio/any-sync/commonspace/spacestorage/mock_spacestorage"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto"
|
"github.com/anytypeio/any-sync/commonspace/spacesyncproto"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto/mock_spacesyncproto"
|
"github.com/anytypeio/any-sync/commonspace/spacesyncproto/mock_spacesyncproto"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/syncstatus"
|
"github.com/anytypeio/any-sync/commonspace/syncstatus"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/net/peer"
|
"github.com/anytypeio/any-sync/net/peer"
|
||||||
"github.com/golang/mock/gomock"
|
"github.com/golang/mock/gomock"
|
||||||
"github.com/libp2p/go-libp2p/core/sec"
|
"github.com/libp2p/go-libp2p/core/sec"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
|
@ -1,16 +1,16 @@
|
||||||
//go:generate mockgen -destination mock_headsync/mock_headsync.go github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/headsync DiffSyncer
|
//go:generate mockgen -destination mock_headsync/mock_headsync.go github.com/anytypeio/any-sync/commonspace/headsync DiffSyncer
|
||||||
package headsync
|
package headsync
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/ldiff"
|
"github.com/anytypeio/any-sync/app/ldiff"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/confconnector"
|
"github.com/anytypeio/any-sync/commonspace/confconnector"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/treegetter"
|
"github.com/anytypeio/any-sync/commonspace/object/treegetter"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/settings/deletionstate"
|
"github.com/anytypeio/any-sync/commonspace/settings/deletionstate"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacestorage"
|
"github.com/anytypeio/any-sync/commonspace/spacestorage"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto"
|
"github.com/anytypeio/any-sync/commonspace/spacesyncproto"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/syncstatus"
|
"github.com/anytypeio/any-sync/commonspace/syncstatus"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/periodicsync"
|
"github.com/anytypeio/any-sync/util/periodicsync"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
|
@ -1,14 +1,14 @@
|
||||||
package headsync
|
package headsync
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/ldiff"
|
"github.com/anytypeio/any-sync/app/ldiff"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/ldiff/mock_ldiff"
|
"github.com/anytypeio/any-sync/app/ldiff/mock_ldiff"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/logger"
|
"github.com/anytypeio/any-sync/app/logger"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/headsync/mock_headsync"
|
"github.com/anytypeio/any-sync/commonspace/headsync/mock_headsync"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/tree/treestorage/mock_treestorage"
|
"github.com/anytypeio/any-sync/commonspace/object/tree/treestorage/mock_treestorage"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/settings/deletionstate/mock_deletionstate"
|
"github.com/anytypeio/any-sync/commonspace/settings/deletionstate/mock_deletionstate"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacestorage/mock_spacestorage"
|
"github.com/anytypeio/any-sync/commonspace/spacestorage/mock_spacestorage"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/periodicsync/mock_periodicsync"
|
"github.com/anytypeio/any-sync/util/periodicsync/mock_periodicsync"
|
||||||
"github.com/golang/mock/gomock"
|
"github.com/golang/mock/gomock"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
|
@ -1,5 +1,5 @@
|
||||||
// Code generated by MockGen. DO NOT EDIT.
|
// Code generated by MockGen. DO NOT EDIT.
|
||||||
// Source: github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/headsync (interfaces: DiffSyncer)
|
// Source: github.com/anytypeio/any-sync/commonspace/headsync (interfaces: DiffSyncer)
|
||||||
|
|
||||||
// Package mock_headsync is a generated GoMock package.
|
// Package mock_headsync is a generated GoMock package.
|
||||||
package mock_headsync
|
package mock_headsync
|
||||||
|
@ -8,7 +8,7 @@ import (
|
||||||
context "context"
|
context "context"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
|
|
||||||
deletionstate "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/settings/deletionstate"
|
deletionstate "github.com/anytypeio/any-sync/commonspace/settings/deletionstate"
|
||||||
gomock "github.com/golang/mock/gomock"
|
gomock "github.com/golang/mock/gomock"
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,8 +2,8 @@ package headsync
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/ldiff"
|
"github.com/anytypeio/any-sync/app/ldiff"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto"
|
"github.com/anytypeio/any-sync/commonspace/spacesyncproto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Client interface {
|
type Client interface {
|
|
@ -3,8 +3,8 @@ package headsync
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/ldiff"
|
"github.com/anytypeio/any-sync/app/ldiff"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/spacesyncproto"
|
"github.com/anytypeio/any-sync/commonspace/spacesyncproto"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"testing"
|
"testing"
|
|
@ -1,8 +1,8 @@
|
||||||
package accountdata
|
package accountdata
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/encryptionkey"
|
"github.com/anytypeio/any-sync/util/keys/asymmetric/encryptionkey"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/signingkey"
|
"github.com/anytypeio/any-sync/util/keys/asymmetric/signingkey"
|
||||||
)
|
)
|
||||||
|
|
||||||
type AccountData struct { // TODO: create a convenient constructor for this
|
type AccountData struct { // TODO: create a convenient constructor for this
|
|
@ -1,7 +1,7 @@
|
||||||
package aclrecordproto
|
package aclrecordproto
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/symmetric"
|
"github.com/anytypeio/any-sync/util/keys/symmetric"
|
||||||
)
|
)
|
||||||
|
|
||||||
func AclReadKeyDerive(signKey []byte, encKey []byte) (*symmetric.Key, error) {
|
func AclReadKeyDerive(signKey []byte, encKey []byte) (*symmetric.Key, error) {
|
|
@ -1,11 +1,11 @@
|
||||||
package list
|
package list
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
|
"github.com/anytypeio/any-sync/commonspace/object/acl/aclrecordproto"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/keychain"
|
"github.com/anytypeio/any-sync/commonspace/object/keychain"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/cidutil"
|
"github.com/anytypeio/any-sync/util/cidutil"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/signingkey"
|
"github.com/anytypeio/any-sync/util/keys/asymmetric/signingkey"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/symmetric"
|
"github.com/anytypeio/any-sync/util/keys/symmetric"
|
||||||
"github.com/gogo/protobuf/proto"
|
"github.com/gogo/protobuf/proto"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
|
@ -1,12 +1,12 @@
|
||||||
package list
|
package list
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/accountdata"
|
"github.com/anytypeio/any-sync/commonspace/object/accountdata"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
|
"github.com/anytypeio/any-sync/commonspace/object/acl/aclrecordproto"
|
||||||
acllistbuilder2 "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/testutils/acllistbuilder"
|
acllistbuilder2 "github.com/anytypeio/any-sync/commonspace/object/acl/testutils/acllistbuilder"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/keychain"
|
"github.com/anytypeio/any-sync/commonspace/object/keychain"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/cidutil"
|
"github.com/anytypeio/any-sync/util/cidutil"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/signingkey"
|
"github.com/anytypeio/any-sync/util/keys/asymmetric/signingkey"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
|
@ -4,13 +4,13 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/app/logger"
|
"github.com/anytypeio/any-sync/app/logger"
|
||||||
aclrecordproto2 "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
|
aclrecordproto2 "github.com/anytypeio/any-sync/commonspace/object/acl/aclrecordproto"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/keychain"
|
"github.com/anytypeio/any-sync/commonspace/object/keychain"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys"
|
"github.com/anytypeio/any-sync/util/keys"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/encryptionkey"
|
"github.com/anytypeio/any-sync/util/keys/asymmetric/encryptionkey"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/signingkey"
|
"github.com/anytypeio/any-sync/util/keys/asymmetric/signingkey"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/symmetric"
|
"github.com/anytypeio/any-sync/util/keys/symmetric"
|
||||||
"github.com/gogo/protobuf/proto"
|
"github.com/gogo/protobuf/proto"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"hash/fnv"
|
"hash/fnv"
|
|
@ -1,9 +1,9 @@
|
||||||
package list
|
package list
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/accountdata"
|
"github.com/anytypeio/any-sync/commonspace/object/accountdata"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/encryptionkey"
|
"github.com/anytypeio/any-sync/util/keys/asymmetric/encryptionkey"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/util/keys/asymmetric/signingkey"
|
"github.com/anytypeio/any-sync/util/keys/asymmetric/signingkey"
|
||||||
)
|
)
|
||||||
|
|
||||||
type aclStateBuilder struct {
|
type aclStateBuilder struct {
|
|
@ -1,14 +1,14 @@
|
||||||
//go:generate mockgen -destination mock_list/mock_list.go github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/list AclList
|
//go:generate mockgen -destination mock_list/mock_list.go github.com/anytypeio/any-sync/commonspace/object/acl/list AclList
|
||||||
package list
|
package list
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/accountdata"
|
"github.com/anytypeio/any-sync/commonspace/object/accountdata"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
|
"github.com/anytypeio/any-sync/commonspace/object/acl/aclrecordproto"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/liststorage"
|
"github.com/anytypeio/any-sync/commonspace/object/acl/liststorage"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/keychain"
|
"github.com/anytypeio/any-sync/commonspace/object/keychain"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package list
|
package list
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
|
"github.com/anytypeio/any-sync/commonspace/object/acl/aclrecordproto"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/testutils/acllistbuilder"
|
"github.com/anytypeio/any-sync/commonspace/object/acl/testutils/acllistbuilder"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"testing"
|
"testing"
|
|
@ -1,5 +1,5 @@
|
||||||
// Code generated by MockGen. DO NOT EDIT.
|
// Code generated by MockGen. DO NOT EDIT.
|
||||||
// Source: github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/list (interfaces: AclList)
|
// Source: github.com/anytypeio/any-sync/commonspace/object/acl/list (interfaces: AclList)
|
||||||
|
|
||||||
// Package mock_list is a generated GoMock package.
|
// Package mock_list is a generated GoMock package.
|
||||||
package mock_list
|
package mock_list
|
||||||
|
@ -7,8 +7,8 @@ package mock_list
|
||||||
import (
|
import (
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
|
|
||||||
aclrecordproto "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
|
aclrecordproto "github.com/anytypeio/any-sync/commonspace/object/acl/aclrecordproto"
|
||||||
list "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/list"
|
list "github.com/anytypeio/any-sync/commonspace/object/acl/list"
|
||||||
gomock "github.com/golang/mock/gomock"
|
gomock "github.com/golang/mock/gomock"
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,7 +3,7 @@ package liststorage
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
|
"github.com/anytypeio/any-sync/commonspace/object/acl/aclrecordproto"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
//go:generate mockgen -destination mock_liststorage/mock_liststorage.go github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/liststorage ListStorage
|
//go:generate mockgen -destination mock_liststorage/mock_liststorage.go github.com/anytypeio/any-sync/commonspace/object/acl/liststorage ListStorage
|
||||||
package liststorage
|
package liststorage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
|
"github.com/anytypeio/any-sync/commonspace/object/acl/aclrecordproto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
|
@ -1,5 +1,5 @@
|
||||||
// Code generated by MockGen. DO NOT EDIT.
|
// Code generated by MockGen. DO NOT EDIT.
|
||||||
// Source: github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/liststorage (interfaces: ListStorage)
|
// Source: github.com/anytypeio/any-sync/commonspace/object/acl/liststorage (interfaces: ListStorage)
|
||||||
|
|
||||||
// Package mock_liststorage is a generated GoMock package.
|
// Package mock_liststorage is a generated GoMock package.
|
||||||
package mock_liststorage
|
package mock_liststorage
|
||||||
|
@ -8,7 +8,7 @@ import (
|
||||||
context "context"
|
context "context"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
|
|
||||||
aclrecordproto "github.com/anytypeio/go-anytype-infrastructure-experiments/common/commonspace/object/acl/aclrecordproto"
|
aclrecordproto "github.com/anytypeio/any-sync/commonspace/object/acl/aclrecordproto"
|
||||||
gomock "github.com/golang/mock/gomock"
|
gomock "github.com/golang/mock/gomock"
|
||||||
)
|
)
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue