diff --git a/core/anytype/bootstrap.go b/core/anytype/bootstrap.go index 133328687..420f9c409 100644 --- a/core/anytype/bootstrap.go +++ b/core/anytype/bootstrap.go @@ -46,8 +46,8 @@ import ( "github.com/anytypeio/go-anytype-middleware/core/recordsbatcher" "github.com/anytypeio/go-anytype-middleware/core/relation" "github.com/anytypeio/go-anytype-middleware/core/session" - "github.com/anytypeio/go-anytype-middleware/core/status" "github.com/anytypeio/go-anytype-middleware/core/subscription" + "github.com/anytypeio/go-anytype-middleware/core/syncstatus" "github.com/anytypeio/go-anytype-middleware/core/wallet" "github.com/anytypeio/go-anytype-middleware/metrics" "github.com/anytypeio/go-anytype-middleware/pkg/lib/cafe" @@ -127,13 +127,13 @@ func Bootstrap(a *app.App, components ...app.Component) { fileSyncUpdateInterval := 5 * time.Second fileSyncStatusRegistry := filesyncstatus.NewRegistry(fileSyncService, fileStore, syncStatusIndexer, fileSyncUpdateInterval) - linkedFilesStatusWatcher := status.NewLinkedFilesWatcher(spaceService, fileSyncStatusRegistry) - subObjectsStatusWatcher := status.NewSubObjectsWatcher() - statusUpdateReceiver := status.NewUpdateReceiver(coreService, linkedFilesStatusWatcher, subObjectsStatusWatcher, cfg, eventService.Send) - objectStatusWatcher := status.NewSpaceObjectWatcher(spaceService, statusUpdateReceiver) + linkedFilesStatusWatcher := syncstatus.NewLinkedFilesWatcher(spaceService, fileSyncStatusRegistry) + subObjectsStatusWatcher := syncstatus.NewSubObjectsWatcher() + statusUpdateReceiver := syncstatus.NewUpdateReceiver(coreService, linkedFilesStatusWatcher, subObjectsStatusWatcher, cfg, eventService.Send) + objectStatusWatcher := syncstatus.NewSpaceObjectWatcher(spaceService, statusUpdateReceiver) fileSyncStatusWatcher := filesyncstatus.New(fileSyncStatusRegistry, statusUpdateReceiver, fileSyncUpdateInterval) - statusService := status.New(sbtProvider, spaceService, coreService, fileSyncStatusWatcher, objectStatusWatcher, subObjectsStatusWatcher, linkedFilesStatusWatcher) + syncStatusService := syncstatus.New(sbtProvider, spaceService, coreService, fileSyncStatusWatcher, objectStatusWatcher, subObjectsStatusWatcher, linkedFilesStatusWatcher) fileService := files.New(fileSyncStatusWatcher, objectStore) @@ -178,7 +178,7 @@ func Bootstrap(a *app.App, components ...app.Component) { Register(fileSyncStatusWatcher). Register(indexerService). Register(linkedFilesStatusWatcher). - Register(statusService). + Register(syncStatusService). Register(history.New()). Register(gateway.New()). Register(export.New(sbtProvider)). diff --git a/core/block/service.go b/core/block/service.go index 0d5d55b38..f01151999 100644 --- a/core/block/service.go +++ b/core/block/service.go @@ -38,7 +38,7 @@ import ( "github.com/anytypeio/go-anytype-middleware/core/filestorage/filesync" "github.com/anytypeio/go-anytype-middleware/core/relation" "github.com/anytypeio/go-anytype-middleware/core/session" - "github.com/anytypeio/go-anytype-middleware/core/status" + "github.com/anytypeio/go-anytype-middleware/core/syncstatus" "github.com/anytypeio/go-anytype-middleware/metrics" "github.com/anytypeio/go-anytype-middleware/pb" "github.com/anytypeio/go-anytype-middleware/pkg/lib/bundle" @@ -123,7 +123,7 @@ type TemplateIDGetter interface { type Service struct { anytype core.Service - status status.Service + syncStatus syncstatus.Service sendEvent func(event *pb.Event) closed bool linkPreview linkpreview.LinkPreview @@ -155,7 +155,7 @@ func (s *Service) Name() string { func (s *Service) Init(a *app.App) (err error) { s.anytype = a.MustComponent(core.CName).(core.Service) - s.status = a.MustComponent(status.CName).(status.Service) + s.syncStatus = a.MustComponent(syncstatus.CName).(syncstatus.Service) s.linkPreview = a.MustComponent(linkpreview.CName).(linkpreview.LinkPreview) s.process = a.MustComponent(process.CName).(process.Service) s.sendEvent = a.MustComponent(event.CName).(event.Sender).Send @@ -215,7 +215,7 @@ func (s *Service) OpenBlock( return } afterShowTime := time.Now() - _, err = s.status.Watch(id, func() []string { + _, err = s.syncStatus.Watch(id, func() []string { ob.Lock() defer ob.Unlock() bs := ob.NewState() @@ -224,7 +224,7 @@ func (s *Service) OpenBlock( }) if err == nil { ob.AddHook(func(_ smartblock.ApplyInfo) error { - s.status.Unwatch(id) + s.syncStatus.Unwatch(id) return nil }, smartblock.HookOnClose) } diff --git a/core/status/linked_files_watcher.go b/core/syncstatus/linked_files_watcher.go similarity index 99% rename from core/status/linked_files_watcher.go rename to core/syncstatus/linked_files_watcher.go index a2dec7d6c..a2763f3a8 100644 --- a/core/status/linked_files_watcher.go +++ b/core/syncstatus/linked_files_watcher.go @@ -1,4 +1,4 @@ -package status +package syncstatus import ( "context" diff --git a/core/status/service.go b/core/syncstatus/service.go similarity index 99% rename from core/status/service.go rename to core/syncstatus/service.go index a2660c61d..e2abfa07f 100644 --- a/core/status/service.go +++ b/core/syncstatus/service.go @@ -1,4 +1,4 @@ -package status +package syncstatus import ( "context" diff --git a/core/status/service_test.go b/core/syncstatus/service_test.go similarity index 98% rename from core/status/service_test.go rename to core/syncstatus/service_test.go index 880c35d46..3bda9c886 100644 --- a/core/status/service_test.go +++ b/core/syncstatus/service_test.go @@ -1,4 +1,4 @@ -package status +package syncstatus // // import ( diff --git a/core/status/space_object_watcher.go b/core/syncstatus/space_object_watcher.go similarity index 97% rename from core/status/space_object_watcher.go rename to core/syncstatus/space_object_watcher.go index fab472a34..9c31541e9 100644 --- a/core/status/space_object_watcher.go +++ b/core/syncstatus/space_object_watcher.go @@ -1,4 +1,4 @@ -package status +package syncstatus import ( "context" diff --git a/core/status/sub_objects_watcher.go b/core/syncstatus/sub_objects_watcher.go similarity index 97% rename from core/status/sub_objects_watcher.go rename to core/syncstatus/sub_objects_watcher.go index 2d5a908ce..16a70557f 100644 --- a/core/status/sub_objects_watcher.go +++ b/core/syncstatus/sub_objects_watcher.go @@ -1,4 +1,4 @@ -package status +package syncstatus import ( "sync" diff --git a/core/status/update_receiver.go b/core/syncstatus/update_receiver.go similarity index 99% rename from core/status/update_receiver.go rename to core/syncstatus/update_receiver.go index f15d2b5b9..728f92a4f 100644 --- a/core/status/update_receiver.go +++ b/core/syncstatus/update_receiver.go @@ -1,4 +1,4 @@ -package status +package syncstatus import ( "context" diff --git a/util/testMock/mockStatus/status.go b/util/testMock/mockStatus/status.go index c8f1fc9ec..383b31a03 100644 --- a/util/testMock/mockStatus/status.go +++ b/util/testMock/mockStatus/status.go @@ -7,12 +7,12 @@ import ( "github.com/golang/mock/gomock" "github.com/anytypeio/go-anytype-middleware/app/testapp" - "github.com/anytypeio/go-anytype-middleware/core/status" + "github.com/anytypeio/go-anytype-middleware/core/syncstatus" ) func RegisterMockStatus(ctrl *gomock.Controller, ta *testapp.TestApp) *MockService { ms := NewMockService(ctrl) - ms.EXPECT().Name().AnyTimes().Return(status.CName) + ms.EXPECT().Name().AnyTimes().Return(syncstatus.CName) ms.EXPECT().Init(gomock.Any()).AnyTimes() ms.EXPECT().Run(context.Background()).AnyTimes() ms.EXPECT().Close(context.Background()).AnyTimes()