package engine import ( "context" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/pkg/tracing" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/trace" ) // RestoreShard restores objects from dump to the shard with provided identifier. // // Returns an error if shard is not read-only. func (e *StorageEngine) RestoreShard(ctx context.Context, id *shard.ID, prm shard.RestorePrm) error { ctx, span := tracing.StartSpanFromContext(ctx, "StorageEngine.RestoreShard", trace.WithAttributes( attribute.String("shard_id", id.String()), )) defer span.End() e.mtx.RLock() defer e.mtx.RUnlock() sh, ok := e.shards[id.String()] if !ok { return errShardNotFound } _, err := sh.Restore(ctx, prm) return err }