1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-08 05:57:03 +09:00

GO-3171: add p2p status service during space loading

Signed-off-by: AnastasiaShemyakinskaya <shem98a@mail.ru>
This commit is contained in:
AnastasiaShemyakinskaya 2024-05-17 20:16:24 +02:00
parent d9bacd33c1
commit ea8b31d045
No known key found for this signature in database
GPG key ID: CCD60ED83B103281
2 changed files with 23 additions and 0 deletions

View file

@ -0,0 +1,20 @@
package peerstatus
import (
"github.com/anyproto/any-sync/app"
)
type Status int32
const (
Unknown Status = 0
Connected Status = 1
NotPossible Status = 2
NotConnected Status = 3
)
type StatusUpdateSender interface {
app.ComponentRunnable
SendPeerUpdate()
SendNewStatus(status Status)
}

View file

@ -32,6 +32,7 @@ import (
"github.com/anyproto/any-sync/commonspace/objectsync"
"github.com/anyproto/any-sync/commonspace/objecttreebuilder"
"github.com/anyproto/any-sync/commonspace/peermanager"
"github.com/anyproto/any-sync/commonspace/peerstatus"
"github.com/anyproto/any-sync/commonspace/requestmanager"
"github.com/anyproto/any-sync/commonspace/settings"
"github.com/anyproto/any-sync/commonspace/spacestate"
@ -67,6 +68,7 @@ type SpaceService interface {
type Deps struct {
TreeSyncer treesyncer.TreeSyncer
PeerStatus peerstatus.StatusUpdateSender
}
type spaceService struct {
@ -179,6 +181,7 @@ func (s *spaceService) NewSpace(ctx context.Context, id string, deps Deps) (Spac
statusService := s.statusServiceProvider.NewStatusService()
spaceApp := s.app.ChildApp()
spaceApp.Register(state).
Register(deps.PeerStatus).
Register(peerManager).
Register(newCommonStorage(st)).
Register(statusService).