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:
parent
d9bacd33c1
commit
ea8b31d045
2 changed files with 23 additions and 0 deletions
20
commonspace/peerstatus/status.go
Normal file
20
commonspace/peerstatus/status.go
Normal 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)
|
||||
}
|
|
@ -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).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue