mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-10 01:51:11 +09:00
Add check migrated method
This commit is contained in:
parent
73e79a9173
commit
faa7c53d63
1 changed files with 9 additions and 0 deletions
|
@ -27,6 +27,7 @@ var ErrAlreadyMigrated = errors.New("already migrated")
|
||||||
|
|
||||||
type SpaceMigrator interface {
|
type SpaceMigrator interface {
|
||||||
MigrateId(ctx context.Context, id string, progress Progress) (spacestorage.SpaceStorage, error)
|
MigrateId(ctx context.Context, id string, progress Progress) (spacestorage.SpaceStorage, error)
|
||||||
|
CheckMigrated(ctx context.Context, id string) (bool, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type Progress interface {
|
type Progress interface {
|
||||||
|
@ -49,6 +50,14 @@ func NewSpaceMigrator(oldProvider oldstorage.SpaceStorageProvider, newProvider s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *spaceMigrator) CheckMigrated(ctx context.Context, id string) (bool, error) {
|
||||||
|
migrated, storage := s.checkMigrated(ctx, id)
|
||||||
|
if storage != nil {
|
||||||
|
return migrated, storage.Close(ctx)
|
||||||
|
}
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (s *spaceMigrator) MigrateId(ctx context.Context, id string, progress Progress) (spacestorage.SpaceStorage, error) {
|
func (s *spaceMigrator) MigrateId(ctx context.Context, id string, progress Progress) (spacestorage.SpaceStorage, error) {
|
||||||
migrated, storage := s.checkMigrated(ctx, id)
|
migrated, storage := s.checkMigrated(ctx, id)
|
||||||
if migrated {
|
if migrated {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue