1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-11 18:20:28 +09:00

Change bootstrap, remove cycles

This commit is contained in:
mcrakhman 2022-08-02 20:08:07 +02:00 committed by Mikhail Iudin
parent b8b52462e1
commit d5c2ad63fc
No known key found for this signature in database
GPG key ID: FAAAA8BAABDFF1C0
4 changed files with 18 additions and 1263 deletions

View file

@ -8,6 +8,7 @@ import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/app/logger"
"github.com/anytypeio/go-anytype-infrastructure-experiments/config"
"github.com/anytypeio/go-anytype-infrastructure-experiments/service/account"
"github.com/anytypeio/go-anytype-infrastructure-experiments/service/api"
"github.com/anytypeio/go-anytype-infrastructure-experiments/service/node"
"github.com/anytypeio/go-anytype-infrastructure-experiments/service/sync/document"
"github.com/anytypeio/go-anytype-infrastructure-experiments/service/sync/drpcserver"
@ -77,12 +78,6 @@ func main() {
a.Register(conf)
a.Register(acc)
a.Register(nodes)
a.Register(document.New())
a.Register(drpcserver.New())
a.Register(message.New())
a.Register(requesthandler.New())
a.Register(transport.New())
a.Register(treecache.New())
Bootstrap(a)
// start app
@ -110,5 +105,10 @@ func main() {
func Bootstrap(a *app.App) {
a.Register(transport.New()).
Register(drpcserver.New())
Register(drpcserver.New()).
Register(document.New()).
Register(message.New()).
Register(requesthandler.New()).
Register(treecache.New()).
Register(api.New())
}

2
go.mod
View file

@ -4,6 +4,7 @@ go 1.18
require (
github.com/awalterschulze/gographviz v0.0.0-20190522210029-fa59802746ab
github.com/cheggaaa/mb v1.0.3
github.com/goccy/go-graphviz v0.0.9
github.com/gogo/protobuf v1.3.2
github.com/ipfs/go-cid v0.1.0
@ -13,7 +14,6 @@ require (
github.com/multiformats/go-multibase v0.0.3
github.com/multiformats/go-multihash v0.1.0
github.com/stretchr/testify v1.7.0
github.com/cheggaaa/mb v1.0.3
go.uber.org/zap v1.21.0
gopkg.in/yaml.v3 v3.0.1
storj.io/drpc v0.0.32

1256
go.sum

File diff suppressed because it is too large Load diff

View file

@ -8,7 +8,6 @@ import (
"github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/treestorage"
"github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/treestorage/treepb"
"github.com/anytypeio/go-anytype-infrastructure-experiments/service/account"
"github.com/anytypeio/go-anytype-infrastructure-experiments/service/sync/message"
"github.com/anytypeio/go-anytype-infrastructure-experiments/service/sync/syncpb"
"github.com/anytypeio/go-anytype-infrastructure-experiments/service/treecache"
"github.com/anytypeio/go-anytype-infrastructure-experiments/util/slice"
@ -17,7 +16,7 @@ import (
type requestHandler struct {
treeCache treecache.Service
account account.Service
messageService message.Service
messageService MessageSender
}
func New() app.Component {
@ -28,12 +27,16 @@ type RequestHandler interface {
HandleFullSyncContent(ctx context.Context, senderId string, request *syncpb.SyncContent) (err error)
}
type MessageSender interface {
SendMessage(peerId string, msg *syncpb.SyncContent) error
}
const CName = "SyncRequestHandler"
func (r *requestHandler) Init(ctx context.Context, a *app.App) (err error) {
r.treeCache = a.MustComponent(treecache.CName).(treecache.Service)
r.account = a.MustComponent(account.CName).(account.Service)
r.messageService = a.MustComponent(message.CName).(message.Service)
r.messageService = a.MustComponent("MessageService").(MessageSender)
return nil
}