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

Fasttrack getting all changes

This commit is contained in:
mcrakhman 2025-01-15 22:18:01 +01:00
parent 3366ffbfb7
commit 53815df4b6
No known key found for this signature in database
GPG key ID: DED12CFEF5B8396B

View file

@ -48,7 +48,14 @@ func (tm *treeMigrator) migrateTreeStorage(ctx context.Context, storage oldstora
if err != nil {
return fmt.Errorf("migration: failed to get heads: %w", err)
}
tm.dfs(ctx, heads, rootChange.Id)
if iterStore, ok := storage.(oldstorage.ChangesIterator); ok {
tm.allChanges, err = iterStore.GetAllChanges()
if err != nil {
return fmt.Errorf("migration: failed to get all changes: %w", err)
}
} else {
tm.dfs(ctx, heads, rootChange.Id)
}
newStorage, err := objecttree.CreateStorage(ctx, rootChange, headStorage, store)
if err != nil && !errors.Is(err, treestorage.ErrTreeExists) {
return fmt.Errorf("migration: failed to create new storage: %w", err)