llarp::dht::Bucket

More...

Public Classes

Name
struct SetIntersector

Public Types

Name
using std::map< Key_t, Val_t, XorMetric > BucketStorage_t
using std::function< uint64_t()> Random_t

Public Functions

Name
Bucket(const Key_t & us, Random_t r)
size_t size() const
bool GetRandomNodeExcluding(Key_t & result, const std::set< Key_t > & exclude) const
bool FindClosest(const Key_t & target, Key_t & result) const
bool GetManyRandom(std::set< Key_t > & result, size_t N) const
bool FindCloseExcluding(const Key_t & target, Key_t & result, const std::set< Key_t > & exclude) const
bool GetManyNearExcluding(const Key_t & target, std::set< Key_t > & result, size_t N, const std::set< Key_t > & exclude) const
void PutNode(const Val_t & val)
void DelNode(const Key_t & key)
bool HasNode(const Key_t & key) const
template <typename Predicate >
void
RemoveIf(Predicate pred)
template <typename Visit_t >
void
ForEachNode(Visit_t visit)
void Clear()

Public Attributes

Name
BucketStorage_t nodes
Random_t random

Detailed Description

template <typename Val_t >
struct llarp::dht::Bucket;

Public Types Documentation

using BucketStorage_t

using llarp::dht::Bucket< Val_t >::BucketStorage_t =  std::map<Key_t, Val_t, XorMetric>;

using Random_t

using llarp::dht::Bucket< Val_t >::Random_t =  std::function<uint64_t()>;

Public Functions Documentation

function Bucket

inline Bucket(
    const Key_t & us,
    Random_t r
)

function size

inline size_t size() const

function GetRandomNodeExcluding

inline bool GetRandomNodeExcluding(
    Key_t & result,
    const std::set< Key_t > & exclude
) const

function FindClosest

inline bool FindClosest(
    const Key_t & target,
    Key_t & result
) const

function GetManyRandom

inline bool GetManyRandom(
    std::set< Key_t > & result,
    size_t N
) const

function FindCloseExcluding

inline bool FindCloseExcluding(
    const Key_t & target,
    Key_t & result,
    const std::set< Key_t > & exclude
) const

function GetManyNearExcluding

inline bool GetManyNearExcluding(
    const Key_t & target,
    std::set< Key_t > & result,
    size_t N,
    const std::set< Key_t > & exclude
) const

function PutNode

inline void PutNode(
    const Val_t & val
)

function DelNode

inline void DelNode(
    const Key_t & key
)

function HasNode

inline bool HasNode(
    const Key_t & key
) const

function RemoveIf

template <typename Predicate >
inline void RemoveIf(
    Predicate pred
)

function ForEachNode

template <typename Visit_t >
inline void ForEachNode(
    Visit_t visit
)

function Clear

inline void Clear()

Public Attributes Documentation

variable nodes

BucketStorage_t nodes;

variable random

Random_t random;

Updated on 2026-01-10 at 22:49:45 +0000