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:
parent
23fb5629b9
commit
ba90a57c7d
1 changed files with 4 additions and 6 deletions
|
@ -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,11 +60,9 @@ 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 {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue