Add tracing spans for PUT requests. Add tracing spans for DELETE requests. Add tracing spans for SELECT requests. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
32 lines
816 B
Go
32 lines
816 B
Go
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
|
|
}
|