forked from TrueCloudLab/frostfs-node
[#1086] services/control: implement RestoreShard
RPC
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
2ec4a3c897
commit
18cfd8b042
8 changed files with 763 additions and 122 deletions
19
pkg/local_object_storage/engine/restore.go
Normal file
19
pkg/local_object_storage/engine/restore.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
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.
|
||||
func (e *StorageEngine) RestoreShard(id *shard.ID, prm *shard.RestorePrm) error {
|
||||
e.mtx.RLock()
|
||||
defer e.mtx.RUnlock()
|
||||
|
||||
sh, ok := e.shards[id.String()]
|
||||
if !ok {
|
||||
return errShardNotFound
|
||||
}
|
||||
|
||||
_, err := sh.Restore(prm)
|
||||
return err
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue