2022-01-25 11:54:35 +00:00
|
|
|
package engine
|
|
|
|
|
|
|
|
import "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard"
|
|
|
|
|
|
|
|
// RestoreShard restores objects from dump to the shard with provided identifier.
|
|
|
|
//
|
|
|
|
// Returns an error if shard is not read-only.
|
2022-05-20 18:08:59 +00:00
|
|
|
func (e *StorageEngine) RestoreShard(id *shard.ID, prm shard.RestorePrm) error {
|
2022-01-25 11:54:35 +00:00
|
|
|
e.mtx.RLock()
|
|
|
|
defer e.mtx.RUnlock()
|
|
|
|
|
|
|
|
sh, ok := e.shards[id.String()]
|
|
|
|
if !ok {
|
|
|
|
return errShardNotFound
|
|
|
|
}
|
|
|
|
|
|
|
|
_, err := sh.Restore(prm)
|
|
|
|
return err
|
|
|
|
}
|