My Project 1.7.4
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 Typedef Documentation

◆ Key

using dht::indexation::Pht::Key = std::map<std::string, Blob>

Definition at line 302 of file pht.h.

◆ KeySpec

using dht::indexation::Pht::KeySpec = std::map<std::string, size_t>

Definition at line 306 of file pht.h.

◆ LookupCallback

using dht::indexation::Pht::LookupCallback = std::function<void(std::vector<std::shared_ptr<Value> >& values, const Prefix& p)>

Definition at line 307 of file pht.h.

◆ LookupCallbackRaw

typedef void(* dht::indexation::Pht::LookupCallbackRaw) (std::vector< std::shared_ptr< Value > > *values, Prefix *p, void *user_data)

Definition at line 309 of file pht.h.

◆ LookupCallbackSimple

using dht::indexation::Pht::LookupCallbackSimple = std::function<void(std::vector<std::shared_ptr<Value> >& values)>

Definition at line 317 of file pht.h.

◆ LookupCallbackSimpleRaw

typedef void(* dht::indexation::Pht::LookupCallbackSimpleRaw) (std::vector< std::shared_ptr< Value > > *values, void *user_data)

Definition at line 318 of file pht.h.

Constructor & Destructor Documentation

◆ Pht()

dht::indexation::Pht::Pht ( std::string  name,
KeySpec  k_spec,
std::shared_ptr< DhtRunner dht 
)
inline

Definition at line 327 of file pht.h.

◆ ~Pht()

virtual dht::indexation::Pht::~Pht ( )
inlinevirtual

Definition at line 330 of file pht.h.

Member Function Documentation

◆ bindLookupCb()

static LookupCallback dht::indexation::Pht::bindLookupCb ( LookupCallbackRaw  raw_cb,
void *  user_data 
)
inlinestatic

Definition at line 311 of file pht.h.

◆ bindLookupCbSimple()

static LookupCallbackSimple dht::indexation::Pht::bindLookupCbSimple ( LookupCallbackSimpleRaw  raw_cb,
void *  user_data 
)
inlinestatic

Definition at line 320 of file pht.h.

◆ 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() [1/2]

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

Lookup a key for a value.

◆ lookup() [2/2]

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

Definition at line 336 of file pht.h.

Member Data Documentation

◆ MAX_NODE_ENTRY_COUNT

constexpr const size_t dht::indexation::Pht::MAX_NODE_ENTRY_COUNT {16}
staticconstexpr

Definition at line 299 of file pht.h.


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