17 #ifndef GRPC_CORE_LIB_SLICE_SLICE_WEAK_HASH_TABLE_H 18 #define GRPC_CORE_LIB_SLICE_SLICE_WEAK_HASH_TABLE_H 39 template <
typename T,
size_t Size>
44 return MakeRefCounted<SliceWeakHashTable<T, Size>>();
55 entries_[idx].Set(key, std::move(value));
63 const auto& entry = entries_[idx];
64 return grpc_slice_eq(entry.key(), key) ? entry.value() :
nullptr;
78 const T* value()
const {
79 if (!is_set_)
return nullptr;
87 value_ = std::move(value);
static RefCountedPtr< SliceWeakHashTable > Create()
Creates a new table of at most size entries.
Definition: slice_weak_hash_table.h:43
A grpc_slice s, if initialized, represents the byte range s.bytes[0..s.length-1]. ...
Definition: slice.h:60
Round Robin Policy.
Definition: backend_metric.cc:24
~SliceWeakHashTable()=default
void grpc_slice_unref_internal(const grpc_slice &slice)
Definition: slice_internal.h:272
Definition: slice_weak_hash_table.h:40
Definition: ref_counted_ptr.h:35
uint32_t grpc_slice_hash_internal(const grpc_slice &s)
Definition: slice_internal.h:333
Definition: ref_counted.h:248
void Add(const grpc_slice &key, T value)
Add a mapping from key to value, taking ownership of key.
Definition: slice_weak_hash_table.h:53
SliceWeakHashTable()=default
Use Create function instead of using this directly.
GPRAPI int grpc_slice_eq(grpc_slice a, grpc_slice b)
Definition: slice.cc:458
const T * Get(const grpc_slice &key) const
Returns the value from the table associated with / key or null if not found.
Definition: slice_weak_hash_table.h:61