C++ Distributed Hash Table
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
dht::indexation::Pht Class Reference

Public Types

using Key = std::map< std::string, Blob >
 
using KeySpec = std::map< std::string, size_t >
 
using LookupCallback = std::function< void(std::vector< std::shared_ptr< Value > > &values, const Prefix &p)>
 
typedef void(* LookupCallbackRaw) (std::vector< std::shared_ptr< Value >> *values, Prefix *p, void *user_data)
 
using LookupCallbackSimple = std::function< void(std::vector< std::shared_ptr< Value > > &values)>
 
typedef void(* LookupCallbackSimpleRaw) (std::vector< std::shared_ptr< Value >> *values, void *user_data)
 

Public Member Functions

 Pht (std::string name, KeySpec k_spec, std::shared_ptr< DhtRunner > dht)
 
void lookup (Key k, LookupCallback cb={}, DoneCallbackSimple done_cb={}, bool exact_match=true)
 
void lookup (Key k, LookupCallbackSimple cb={}, DoneCallbackSimple done_cb={}, bool exact_match=true)
 
void insert (Key k, Value v, DoneCallbackSimple done_cb={})
 

Static Public Member Functions

static LookupCallback bindLookupCb (LookupCallbackRaw raw_cb, void *user_data)
 
static LookupCallbackSimple bindLookupCbSimple (LookupCallbackSimpleRaw raw_cb, void *user_data)
 

Static Public Attributes

static constexpr const size_t MAX_NODE_ENTRY_COUNT {16}
 

Detailed Description

Definition at line 288 of file pht.h.

Member Function Documentation

◆ insert()

void dht::indexation::Pht::insert ( Key  k,
Value  v,
DoneCallbackSimple  done_cb = {} 
)
inline

Wrapper function which call the private one.

Parameters
k: Key to insert [i.e map of string, blob]
v: Value to insert
done_cb: Callbakc which going to be call when all the insert is done

Definition at line 348 of file pht.h.

◆ lookup()

void dht::indexation::Pht::lookup ( Key  k,
LookupCallback  cb = {},
DoneCallbackSimple  done_cb = {},
bool  exact_match = true 
)

Lookup a key for a value.


The documentation for this class was generated from the following file: