47 case CounterUnit::kCount:
49 case CounterUnit::kBytes:
51 case CounterUnit::kUndefined:
63 if (unit ==
"count")
return CounterUnit::kCount;
64 if (unit ==
"bytes")
return CounterUnit::kBytes;
65 if (unit ==
"undefined")
return CounterUnit::kUndefined;
66 return InvalidArgument(
"Invalid unit: {}", s);
81 virtual int64_t
value()
const = 0;
87 virtual bool IsNoop()
const {
return false; }
90 static std::shared_ptr<Counter>
Noop();
98 using Counter::Increment;
104 std::atomic<int64_t> count_{0};
Abstract counter for tracking event totals.
Definition counter.h:70
virtual void Increment()
Increment the counter by 1.
Definition counter.h:75
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:87
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:84
Thread-safe counter backed by std::atomic<int64_t>.
Definition counter.h:94
int64_t value() const override
Return the current count.
CounterUnit unit() const override
Return the unit for this counter.
Definition counter.h:101
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.
Define symbol visibility macros for core Iceberg APIs.
Core Apache Iceberg C++ APIs.
Definition arrow_io_util.h:33
ICEBERG_EXPORT std::string_view ToString(Expression::Operation op)
Returns a string representation of an expression operation.
std::expected< T, E > Result
Result alias.
Definition result.h:88
CounterUnit
Unit for a Counter metric.
Definition counter.h:38
ICEBERG_EXPORT Result< CounterUnit > CounterUnitFromString(std::string_view s)
Parse a CounterUnit from a string.
Definition counter.h:61
Define Result, Status, and error helpers.
Provide string utility helpers.