mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-10 01:51:07 +09:00
GO-4144 Merge branch 'main' of github.com:anyproto/anytype-heart into go-4144-refactor-internal-details-structure
# Conflicts: # core/block/backlinks/watcher.go # core/block/bookmark/bookmarkimporter/bookmark_importer_decorator.go # core/block/detailservice/mock_detailservice/mock_Service.go # core/block/detailservice/relations.go # core/block/detailservice/relations_test.go # core/block/detailservice/service.go # core/block/detailservice/set_details.go # core/block/editor/collection/collection.go # core/block/editor/dashboard.go # core/block/import/importer.go # core/block/import/importer_test.go # core/block/import/types.go # core/block/object/objectcreator/creator_test.go # core/block/object/objectlink/dependent_objects.go # core/block/source/date.go # core/object.go # core/relations.go # pkg/lib/database/database.go # pkg/lib/database/filter.go # pkg/lib/database/filter_test.go # pkg/lib/localstore/objectstore/spaceindex/queries.go # pkg/lib/localstore/objectstore/spaceindex/queries_test.go
This commit is contained in:
commit
e34cef28ca
121 changed files with 7814 additions and 5186 deletions
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/anyproto/any-sync/app"
|
||||
"github.com/anyproto/any-sync/app/logger"
|
||||
|
@ -104,8 +105,10 @@ func (r *Runner) runMigrations() {
|
|||
func (r *Runner) run(migrations ...Migration) (err error) {
|
||||
spaceId := r.spc.Id()
|
||||
|
||||
start := time.Now()
|
||||
store := r.store.SpaceIndex(spaceId)
|
||||
marketPlaceStore := r.store.SpaceIndex(addr.AnytypeMarketplaceWorkspace)
|
||||
spent := time.Since(start)
|
||||
|
||||
for _, m := range migrations {
|
||||
if e := r.ctx.Err(); e != nil {
|
||||
|
@ -117,8 +120,8 @@ func (r *Runner) run(migrations ...Migration) (err error) {
|
|||
err = errors.Join(err, wrapError(e, m.Name(), spaceId, migrated, toMigrate))
|
||||
continue
|
||||
}
|
||||
log.Debug(fmt.Sprintf("migration '%s' in space '%s' is successful. %d out of %d objects were migrated",
|
||||
m.Name(), spaceId, migrated, toMigrate))
|
||||
log.Debug(fmt.Sprintf("migration '%s' in space '%s' is successful. %d out of %d objects were migrated. Spent: %d micros",
|
||||
m.Name(), spaceId, migrated, toMigrate, spent.Microseconds()))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
@ -14,7 +14,9 @@ import (
|
|||
"github.com/anyproto/anytype-heart/core/domain"
|
||||
"github.com/anyproto/anytype-heart/pkg/lib/bundle"
|
||||
"github.com/anyproto/anytype-heart/pkg/lib/database"
|
||||
"github.com/anyproto/anytype-heart/pkg/lib/localstore/addr"
|
||||
"github.com/anyproto/anytype-heart/pkg/lib/localstore/objectstore"
|
||||
"github.com/anyproto/anytype-heart/pkg/lib/localstore/objectstore/spaceindex"
|
||||
"github.com/anyproto/anytype-heart/pkg/lib/pb/model"
|
||||
mock_space "github.com/anyproto/anytype-heart/space/clientspace/mock_clientspace"
|
||||
"github.com/anyproto/anytype-heart/space/internal/components/dependencies"
|
||||
|
@ -47,6 +49,8 @@ func TestRunner(t *testing.T) {
|
|||
t.Run("context exceeds + space operation in progress -> context.Canceled", func(t *testing.T) {
|
||||
// given
|
||||
store := objectstore.NewStoreFixture(t)
|
||||
store.AddObjects(t, "spaceId", []spaceindex.TestObject{})
|
||||
store.AddObjects(t, addr.AnytypeMarketplaceWorkspace, []spaceindex.TestObject{})
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
space := mock_space.NewMockSpace(t)
|
||||
space.EXPECT().Id().Times(1).Return("")
|
||||
|
@ -78,9 +82,11 @@ func TestRunner(t *testing.T) {
|
|||
t.Run("context exceeds + migration is finished -> no error", func(t *testing.T) {
|
||||
// given
|
||||
store := objectstore.NewStoreFixture(t)
|
||||
store.AddObjects(t, "spaceId", []spaceindex.TestObject{})
|
||||
store.AddObjects(t, addr.AnytypeMarketplaceWorkspace, []spaceindex.TestObject{})
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
space := mock_space.NewMockSpace(t)
|
||||
space.EXPECT().Id().Times(1).Return("")
|
||||
space.EXPECT().Id().Times(1).Return("spaceId")
|
||||
runner := Runner{ctx: ctx, store: store, spc: space}
|
||||
|
||||
// when
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue