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

Add id to remove func

This commit is contained in:
Mikhail Rakhmanov 2025-05-05 13:47:19 +02:00
parent 23fb5629b9
commit ba90a57c7d
No known key found for this signature in database
GPG key ID: DED12CFEF5B8396B

View file

@ -34,7 +34,7 @@ type Progress interface {
AddDone(done int64) AddDone(done int64)
} }
type RemoveFunc func(newStorage spacestorage.SpaceStorage, rootPath string) error type RemoveFunc func(newStorage spacestorage.SpaceStorage, id, rootPath string) error
type spaceMigrator struct { type spaceMigrator struct {
oldProvider oldstorage.SpaceStorageProvider oldProvider oldstorage.SpaceStorageProvider
@ -60,12 +60,10 @@ func (s *spaceMigrator) MigrateId(ctx context.Context, id string, progress Progr
storage.Close(ctx) storage.Close(ctx)
return ErrAlreadyMigrated return ErrAlreadyMigrated
} }
if !migrated { err := s.removeFunc(storage, id, s.rootPath)
err := s.removeFunc(storage, s.rootPath)
if err != nil { if err != nil {
return fmt.Errorf("migration: failed to remove new storage: %w", err) return fmt.Errorf("migration: failed to remove new storage: %w", err)
} }
}
oldStorage, err := s.oldProvider.WaitSpaceStorage(ctx, id) oldStorage, err := s.oldProvider.WaitSpaceStorage(ctx, id)
if err != nil { if err != nil {
return fmt.Errorf("migration: failed to get old space storage: %w", err) return fmt.Errorf("migration: failed to get old space storage: %w", err)