mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-09 17:45:03 +09:00
Migrate space hash
This commit is contained in:
parent
5ceab3b7cd
commit
4f00849cab
1 changed files with 11 additions and 0 deletions
|
@ -160,9 +160,20 @@ func (s *spaceMigrator) MigrateId(ctx context.Context, id string, progress Progr
|
|||
if len(allErrors) > 0 {
|
||||
return fmt.Errorf("migration failed: %w", errors.Join(allErrors...))
|
||||
}
|
||||
if err := s.migrateHash(ctx, oldStorage, newStorage); err != nil {
|
||||
log.Warn("migration: failed to migrate hash", zap.Error(err))
|
||||
}
|
||||
return s.setMigrated(ctx, newStorage.AnyStore())
|
||||
}
|
||||
|
||||
func (s *spaceMigrator) migrateHash(ctx context.Context, oldStorage oldstorage.SpaceStorage, newStorage spacestorage.SpaceStorage) error {
|
||||
spaceHash, err := oldStorage.ReadSpaceHash()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return newStorage.StateStorage().SetHash(ctx, spaceHash)
|
||||
}
|
||||
|
||||
func (s *spaceMigrator) checkMigrated(ctx context.Context, id string) (bool, spacestorage.SpaceStorage) {
|
||||
storage, err := s.newProvider.WaitSpaceStorage(ctx, id)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue