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

Change treesyncer component and mocks

This commit is contained in:
mcrakhman 2023-09-27 22:41:33 +02:00
parent 61bd9aae1e
commit ce7bce7e48
No known key found for this signature in database
GPG key ID: DED12CFEF5B8396B
39 changed files with 565 additions and 365 deletions

View file

@ -10,6 +10,7 @@ import (
"github.com/anyproto/any-sync/commonspace/credentialprovider"
"github.com/anyproto/any-sync/commonspace/object/tree/objecttree"
"github.com/anyproto/any-sync/commonspace/object/treemanager"
"github.com/anyproto/any-sync/commonspace/object/treesyncer"
"github.com/anyproto/any-sync/commonspace/objecttreebuilder"
"github.com/anyproto/any-sync/commonspace/peermanager"
"github.com/anyproto/any-sync/commonspace/spacestorage"
@ -269,6 +270,32 @@ func (n noOpSyncer) Close() error {
return nil
}
type mockTreeSyncer struct {
}
func (m mockTreeSyncer) Init(a *app.App) (err error) {
return nil
}
func (m mockTreeSyncer) Name() (name string) {
return treesyncer.CName
}
func (m mockTreeSyncer) Run(ctx context.Context) (err error) {
return nil
}
func (m mockTreeSyncer) Close(ctx context.Context) (err error) {
return nil
}
func (m mockTreeSyncer) StartSync() {
}
func (m mockTreeSyncer) SyncAll(ctx context.Context, peerId string, existing, missing []string) error {
return nil
}
type mockTreeManager struct {
space Space
cache ocache.OCache
@ -277,10 +304,6 @@ type mockTreeManager struct {
waitLoad chan struct{}
}
func (t *mockTreeManager) NewTreeSyncer(spaceId string, treeManager treemanager.TreeManager) treemanager.TreeSyncer {
return noOpSyncer{}
}
func (t *mockTreeManager) MarkTreeDeleted(ctx context.Context, spaceId, treeId string) error {
t.markedIds = append(t.markedIds, treeId)
return nil