Some checks failed
DCO action / DCO (pull_request) Successful in 1m39s
Build / Build Components (1.20) (pull_request) Failing after 1m54s
Build / Build Components (1.21) (pull_request) Successful in 2m28s
Tests and linters / Tests (1.20) (pull_request) Failing after 2m43s
Vulncheck / Vulncheck (pull_request) Failing after 2m56s
Tests and linters / Lint (pull_request) Failing after 3m45s
Tests and linters / Staticcheck (pull_request) Failing after 4m4s
Tests and linters / Tests (1.21) (pull_request) Failing after 9m11s
Tests and linters / Tests with -race (pull_request) Failing after 9m26s
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
31 lines
677 B
Go
31 lines
677 B
Go
package shard
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-observability/tracing"
|
|
"go.opentelemetry.io/otel/attribute"
|
|
"go.opentelemetry.io/otel/trace"
|
|
)
|
|
|
|
// LogicalObjectsCount returns logical objects count.
|
|
func (s *Shard) LogicalObjectsCount(ctx context.Context) (uint64, error) {
|
|
_, span := tracing.StartSpanFromContext(ctx, "Shard.LogicalObjectsCount",
|
|
trace.WithAttributes(
|
|
attribute.String("shard_id", s.ID().String()),
|
|
))
|
|
defer span.End()
|
|
|
|
s.m.RLock()
|
|
defer s.m.RUnlock()
|
|
|
|
if s.GetMode().NoMetabase() {
|
|
return 0, ErrDegradedMode
|
|
}
|
|
|
|
cc, err := s.metaBase.ObjectCounters(ctx)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
return cc.Logic, nil
|
|
}
|