48 case CounterUnit::kCount:
50 case CounterUnit::kBytes:
52 case CounterUnit::kUndefined:
64 if (unit ==
"count")
return CounterUnit::kCount;
65 if (unit ==
"bytes")
return CounterUnit::kBytes;
66 if (unit ==
"undefined")
return CounterUnit::kUndefined;
67 return InvalidArgument(
"Invalid unit: {}", s);
82 virtual int64_t
value()
const = 0;
88 virtual bool IsNoop()
const {
return false; }
91 static std::shared_ptr<Counter>
Noop();
99 using Counter::Increment;
105 std::atomic<int64_t> count_{0};
Abstract counter for tracking event totals.
Definition counter.h:71
virtual void Increment()
Increment the counter by 1.
Definition counter.h:76
static std::shared_ptr< Counter > Noop()
Return a shared no-op counter singleton.
virtual bool IsNoop() const
Return true if this counter is a no-op.
Definition counter.h:88
virtual int64_t value() const =0
Return the current count.
virtual void Increment(int64_t amount)=0
Increment the counter by the given amount.
virtual CounterUnit unit() const
Return the unit for this counter.
Definition counter.h:85
Thread-safe counter backed by std::atomic<int64_t>.
Definition counter.h:95
int64_t value() const override
Return the current count.
CounterUnit unit() const override
Return the unit for this counter.
Definition counter.h:102
void Increment(int64_t amount) override
Increment the counter by the given amount.
static std::string ToLower(std::string_view str)
Lower-case a UTF-8 string using Unicode simple (1:1) case mapping.
Definition expected.h:1199
Define symbol visibility macros for core Iceberg APIs.
Core Apache Iceberg C++ APIs.
Definition arrow_io_util.h:34
ICEBERG_EXPORT std::string_view ToString(Expression::Operation op)
Returns a string representation of an expression operation.
void unreachable() noexcept
Marks a branch the program can never take.
Definition unreachable.h:35
CounterUnit
Unit for a Counter metric.
Definition counter.h:39
ICEBERG_EXPORT Result< CounterUnit > CounterUnitFromString(std::string_view s)
Parse a CounterUnit from a string.
Definition counter.h:62
Define Result, Status, and error helpers.
Provide string utility helpers.
Portable stand-in for std::unreachable.