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

Rename sync components

This commit is contained in:
mcrakhman 2024-08-14 00:32:08 +02:00
parent 5a412b31e9
commit e3a209ae9a
No known key found for this signature in database
GPG key ID: DED12CFEF5B8396B
10 changed files with 29 additions and 29 deletions

View file

@ -18,7 +18,6 @@ import (
"github.com/anyproto/any-sync/app/ocache" "github.com/anyproto/any-sync/app/ocache"
"github.com/anyproto/any-sync/commonspace/config" "github.com/anyproto/any-sync/commonspace/config"
"github.com/anyproto/any-sync/commonspace/credentialprovider" "github.com/anyproto/any-sync/commonspace/credentialprovider"
"github.com/anyproto/any-sync/commonspace/globalsync"
"github.com/anyproto/any-sync/commonspace/object/accountdata" "github.com/anyproto/any-sync/commonspace/object/accountdata"
"github.com/anyproto/any-sync/commonspace/object/acl/list" "github.com/anyproto/any-sync/commonspace/object/acl/list"
"github.com/anyproto/any-sync/commonspace/object/tree/objecttree" "github.com/anyproto/any-sync/commonspace/object/tree/objecttree"
@ -44,6 +43,7 @@ import (
"github.com/anyproto/any-sync/nodeconf" "github.com/anyproto/any-sync/nodeconf"
"github.com/anyproto/any-sync/testutil/accounttest" "github.com/anyproto/any-sync/testutil/accounttest"
"github.com/anyproto/any-sync/util/crypto" "github.com/anyproto/any-sync/util/crypto"
"github.com/anyproto/any-sync/util/syncqueues"
) )
// //
@ -692,7 +692,7 @@ func newFixtureWithData(t *testing.T, spaceId string, keys *accountdata.AccountK
process: newSpaceProcess(spaceId), process: newSpaceProcess(spaceId),
} }
fx.app.Register(fx.account). fx.app.Register(fx.account).
Register(globalsync.New()). Register(syncqueues.New()).
Register(fx.config). Register(fx.config).
Register(peerPool). Register(peerPool).
Register(rpctest.NewTestServer()). Register(rpctest.NewTestServer()).

View file

@ -10,11 +10,11 @@ import (
"go.uber.org/zap" "go.uber.org/zap"
"storj.io/drpc" "storj.io/drpc"
"github.com/anyproto/any-sync/commonspace/globalsync"
"github.com/anyproto/any-sync/commonspace/spacesyncproto" "github.com/anyproto/any-sync/commonspace/spacesyncproto"
"github.com/anyproto/any-sync/commonspace/sync/syncdeps" "github.com/anyproto/any-sync/commonspace/sync/syncdeps"
"github.com/anyproto/any-sync/net/peer" "github.com/anyproto/any-sync/net/peer"
"github.com/anyproto/any-sync/net/streampool" "github.com/anyproto/any-sync/net/streampool"
syncqueues2 "github.com/anyproto/any-sync/util/syncqueues"
) )
type RequestManager interface { type RequestManager interface {
@ -31,19 +31,19 @@ type StreamResponse struct {
} }
type requestManager struct { type requestManager struct {
requestPool globalsync.RequestPool requestPool syncqueues2.RequestPool
incomingGuard *globalsync.Guard incomingGuard *syncqueues2.Guard
limit *globalsync.Limit limit *syncqueues2.Limit
handler syncdeps.SyncHandler handler syncdeps.SyncHandler
metric syncdeps.QueueSizeUpdater metric syncdeps.QueueSizeUpdater
} }
func NewRequestManager(handler syncdeps.SyncHandler, metric syncdeps.QueueSizeUpdater, requestPool globalsync.RequestPool, limit *globalsync.Limit) RequestManager { func NewRequestManager(handler syncdeps.SyncHandler, metric syncdeps.QueueSizeUpdater, requestPool syncqueues2.RequestPool, limit *syncqueues2.Limit) RequestManager {
return &requestManager{ return &requestManager{
requestPool: requestPool, requestPool: requestPool,
limit: limit, limit: limit,
handler: handler, handler: handler,
incomingGuard: globalsync.NewGuard(), incomingGuard: syncqueues2.NewGuard(),
metric: metric, metric: metric,
} }
} }

View file

@ -10,7 +10,6 @@ import (
"github.com/anyproto/any-sync/app" "github.com/anyproto/any-sync/app"
"github.com/anyproto/any-sync/app/logger" "github.com/anyproto/any-sync/app/logger"
"github.com/anyproto/any-sync/commonspace/globalsync"
"github.com/anyproto/any-sync/commonspace/peermanager" "github.com/anyproto/any-sync/commonspace/peermanager"
"github.com/anyproto/any-sync/commonspace/spacestate" "github.com/anyproto/any-sync/commonspace/spacestate"
"github.com/anyproto/any-sync/commonspace/spacesyncproto" "github.com/anyproto/any-sync/commonspace/spacesyncproto"
@ -19,6 +18,7 @@ import (
"github.com/anyproto/any-sync/net/streampool" "github.com/anyproto/any-sync/net/streampool"
"github.com/anyproto/any-sync/nodeconf" "github.com/anyproto/any-sync/nodeconf"
"github.com/anyproto/any-sync/util/multiqueue" "github.com/anyproto/any-sync/util/multiqueue"
"github.com/anyproto/any-sync/util/syncqueues"
) )
const CName = "common.commonspace.sync" const CName = "common.commonspace.sync"
@ -77,8 +77,8 @@ func (s *syncService) Init(a *app.App) (err error) {
s.peerManager = a.MustComponent(peermanager.CName).(peermanager.PeerManager) s.peerManager = a.MustComponent(peermanager.CName).(peermanager.PeerManager)
s.streamPool = a.MustComponent(streampool.CName).(streampool.StreamPool) s.streamPool = a.MustComponent(streampool.CName).(streampool.StreamPool)
s.commonMetric, _ = a.Component(metric.CName).(metric.Metric) s.commonMetric, _ = a.Component(metric.CName).(metric.Metric)
globalSync := a.MustComponent(globalsync.CName).(globalsync.GlobalSync) syncQueues := a.MustComponent(syncqueues.CName).(syncqueues.SyncQueues)
s.manager = NewRequestManager(s.handler, s.metric, globalSync.RequestPool(s.spaceId), globalSync.Limit(s.spaceId)) s.manager = NewRequestManager(s.handler, s.metric, syncQueues.RequestPool(s.spaceId), syncQueues.Limit(s.spaceId))
s.ctx, s.cancel = context.WithCancel(context.Background()) s.ctx, s.cancel = context.WithCancel(context.Background())
return nil return nil
} }

View file

@ -1,4 +1,4 @@
package globalsync package syncqueues
import "strings" import "strings"

View file

@ -1,4 +1,4 @@
package globalsync package syncqueues
import "sync" import "sync"

View file

@ -1,4 +1,4 @@
package globalsync package syncqueues
import ( import (
"fmt" "fmt"

View file

@ -1,4 +1,4 @@
package globalsync package syncqueues
import ( import (
"fmt" "fmt"

View file

@ -1,4 +1,4 @@
package globalsync package syncqueues
import ( import (
"context" "context"

View file

@ -1,4 +1,4 @@
package globalsync package syncqueues
import ( import (
"context" "context"
@ -9,27 +9,27 @@ import (
"github.com/anyproto/any-sync/nodeconf" "github.com/anyproto/any-sync/nodeconf"
) )
const CName = "common.commonspace.globalsync" const CName = "common.util.syncqueues"
var log = logger.NewNamed(CName) var log = logger.NewNamed(CName)
type GlobalSync interface { type SyncQueues interface {
app.ComponentRunnable app.ComponentRunnable
RequestPool(spaceId string) RequestPool RequestPool(spaceId string) RequestPool
Limit(spaceId string) *Limit Limit(spaceId string) *Limit
} }
func New() GlobalSync { func New() SyncQueues {
return &globalSync{} return &syncQueues{}
} }
type globalSync struct { type syncQueues struct {
limit *Limit limit *Limit
rp RequestPool rp RequestPool
nodeConf nodeconf.Service nodeConf nodeconf.Service
} }
func (g *globalSync) Init(a *app.App) (err error) { func (g *syncQueues) Init(a *app.App) (err error) {
g.rp = NewRequestPool(time.Second*30, time.Minute) g.rp = NewRequestPool(time.Second*30, time.Minute)
g.nodeConf = a.MustComponent(nodeconf.CName).(nodeconf.Service) g.nodeConf = a.MustComponent(nodeconf.CName).(nodeconf.Service)
var nodeIds []string var nodeIds []string
@ -40,24 +40,24 @@ func (g *globalSync) Init(a *app.App) (err error) {
return return
} }
func (g *globalSync) Run(ctx context.Context) (err error) { func (g *syncQueues) Run(ctx context.Context) (err error) {
g.rp.Run() g.rp.Run()
return return
} }
func (g *globalSync) Close(ctx context.Context) (err error) { func (g *syncQueues) Close(ctx context.Context) (err error) {
g.rp.Close() g.rp.Close()
return return
} }
func (g *globalSync) RequestPool(spaceId string) RequestPool { func (g *syncQueues) RequestPool(spaceId string) RequestPool {
return g.rp return g.rp
} }
func (g *globalSync) Limit(spaceId string) *Limit { func (g *syncQueues) Limit(spaceId string) *Limit {
return g.limit return g.limit
} }
func (g *globalSync) Name() string { func (g *syncQueues) Name() string {
return CName return CName
} }

View file

@ -1,4 +1,4 @@
package globalsync package syncqueues
import ( import (
"context" "context"