Template Class AttributesHashMapWithCustomHash

Class Documentation

template<typename CustomHash = MetricAttributesHash>
class AttributesHashMapWithCustomHash

Public Functions

inline AttributesHashMapWithCustomHash(size_t attributes_limit = kAggregationCardinalityLimit)
inline Aggregation *Get(const MetricAttributes &attributes) const
inline bool Has(const MetricAttributes &attributes) const
Returns:

check if key is present in hash

inline Aggregation *GetOrSetDefault(const MetricAttributes &attributes, nostd::function_ref<std::unique_ptr<Aggregation>()> aggregation_callback)
Returns:

the pointer to value for given key if present. If not present, it uses the provided callback to generate value and store in the hash

inline Aggregation *GetOrSetDefault(MetricAttributes &&attributes, nostd::function_ref<std::unique_ptr<Aggregation>()> aggregation_callback)
inline void Set(const MetricAttributes &attributes, std::unique_ptr<Aggregation> aggr)

Set the value for given key, overwriting the value if already present

inline void Set(MetricAttributes &&attributes, std::unique_ptr<Aggregation> aggr)
inline bool GetAllEntries(nostd::function_ref<bool(const MetricAttributes&, Aggregation&)> callback) const

Iterate the hash to yield key and value stored in hash.

inline size_t Size()

Return the size of hash.