Public Types | Public Member Functions

graphlab::coherent_dht< KeyType, ValueType > Class Template Reference
[GraphLab RPC]

#include <coherent_dht.hpp>

List of all members.

Public Types

typedef
dc_impl::coherent_lru_list
< KeyType, ValueType > 
lru_entry_type
typedef boost::unordered_map
< KeyType, ValueType > 
map_type
typedef boost::unordered_map
< KeyType, lru_entry_type * > 
cache_type
 datatype of the local cache map
typedef
boost::intrusive::member_hook
< lru_entry_type, typename
lru_entry_type::lru_member_hook_type,&lru_entry_type::member_hook_ > 
MemberOption
typedef boost::intrusive::list
< lru_entry_type, MemberOption,
boost::intrusive::constant_time_size
< false > > 
lru_list_type
 datatype of the intrusive LRU list embedded in the cache map

Public Member Functions

 coherent_dht (distributed_control &dc, size_t max_cache_size=1024)
 Constructor. Creates the integer map.
void attach_modification_trigger (boost::function< void(const KeyType &, const ValueType &, bool)> trigger)
void detach_modification_trigger ()
ValueType & begin_critical_section (const KeyType &key)
void end_critical_section (const KeyType &key)
void set (const KeyType &key, const ValueType &newval)
void set_impl (const KeyType &key, const ValueType &newval, procid_t source)
void set_synchronous (const KeyType &key, const ValueType &newval)
void set_synchronous_impl (const KeyType &key, const ValueType &newval, procid_t source)
void push_changes (const KeyType &key, bool async, procid_t ignoreproc)
std::pair< bool, ValueType > get (const KeyType &key) const
procid_t owning_machine (const KeyType &key) const
bool in_cache (const KeyType &key) const
bool asynchronous_get (const KeyType &key) const
double cache_miss_rate ()
 Returns the number of misses divided by the number of requests.
size_t num_gets () const
 Returns the number of requests.
size_t num_misses () const
 Returns the number of cache misses.
size_t cache_size () const
 Returns the current size of the cache.
void subscribe (const KeyType &key, bool async=false) const
void full_barrier ()
void invalidate (const KeyType &key) const
 Invalidates the cache entry associated with this key.

Detailed Description

template<typename KeyType, typename ValueType>
class graphlab::coherent_dht< KeyType, ValueType >

This implements a processor consistent cache coherent distributed hash table. Each machine has a part of the hash table as well as a cache. The system implements automatic cache invalidation as well as automatic cache subscription (currently through a rather poor heuristic). This class also implements some functionality which provide more fine-grained control over the invalidation policy, allowing stronger consistency levels to be implemented on top of this class.

Definition at line 68 of file coherent_dht.hpp.


Member Typedef Documentation

template<typename KeyType, typename ValueType>
typedef boost::unordered_map<KeyType, ValueType> graphlab::coherent_dht< KeyType, ValueType >::map_type

datatype of the data map. maps from key to the value

Definition at line 73 of file coherent_dht.hpp.


Member Function Documentation

template<typename KeyType, typename ValueType>
bool graphlab::coherent_dht< KeyType, ValueType >::asynchronous_get ( const KeyType &  key  )  const [inline]

Puts out a prefetch request for this key.

Definition at line 384 of file coherent_dht.hpp.

template<typename KeyType, typename ValueType>
void graphlab::coherent_dht< KeyType, ValueType >::attach_modification_trigger ( boost::function< void(const KeyType &, const ValueType &, bool)>  trigger  )  [inline]

Attaches a modification trigger which is signalled whenever the local cache/storage of any index is updated or invalidated. Only one modification trigger can be attached. The trigger is only signalled after the update/invalidation is complete. The trigger is called with three parameters, the key, the value as well as a boolean flag "is_in_cache".

The "key" is the key of the entry which was just updated/invalidated. The "value" is the current value of the entry. This is only set if is_in_cache is true Note that the call to the trigger is not locked and the "is_in_cache" flag could very well be outdated when the call is issued. The flag should therefore not be treated as "truth" but simply as a hint about the state of the internal cache.

Definition at line 133 of file coherent_dht.hpp.

template<typename KeyType, typename ValueType>
ValueType& graphlab::coherent_dht< KeyType, ValueType >::begin_critical_section ( const KeyType &  key  )  [inline]

acquire a lock on the key. The lock should be released using end_critical_section() as soon as possible. There is no guarantee that the lock on this key is fine-grained.

Definition at line 151 of file coherent_dht.hpp.

template<typename KeyType, typename ValueType>
void graphlab::coherent_dht< KeyType, ValueType >::detach_modification_trigger (  )  [inline]

Detaches the modification trigger

Definition at line 142 of file coherent_dht.hpp.

template<typename KeyType, typename ValueType>
void graphlab::coherent_dht< KeyType, ValueType >::end_critical_section ( const KeyType &  key  )  [inline]

Releases a lock on the key as a acquired by begin_critical_section()

Definition at line 166 of file coherent_dht.hpp.

template<typename KeyType, typename ValueType>
std::pair<bool, ValueType> graphlab::coherent_dht< KeyType, ValueType >::get ( const KeyType &  key  )  const [inline]

Gets the value associated with the key. returns true on success. get will read from the cache if data is already available in the cache. If not, get will obtain the data from across the network

Definition at line 325 of file coherent_dht.hpp.

template<typename KeyType, typename ValueType>
bool graphlab::coherent_dht< KeyType, ValueType >::in_cache ( const KeyType &  key  )  const [inline]

Returns true of the key is current in the cache

Definition at line 366 of file coherent_dht.hpp.

template<typename KeyType, typename ValueType>
procid_t graphlab::coherent_dht< KeyType, ValueType >::owning_machine ( const KeyType &  key  )  const [inline]

Returns the machine responsible for storing the key

Definition at line 357 of file coherent_dht.hpp.

template<typename KeyType, typename ValueType>
void graphlab::coherent_dht< KeyType, ValueType >::push_changes ( const KeyType &  key,
bool  async,
procid_t  ignoreproc 
) [inline]

Push the current value of the key to all machines. If async=true, when this call returns, all machines are guaranteed to have the most up to date value of the key.

Definition at line 273 of file coherent_dht.hpp.

template<typename KeyType, typename ValueType>
void graphlab::coherent_dht< KeyType, ValueType >::set_impl ( const KeyType &  key,
const ValueType &  newval,
procid_t  source 
) [inline]

Sets the key to the value if the key belongs to a remote machine. It is guaranteed that if the current machine sets a key to a new value subsequent reads will never return the previous value. (i.e. it will return the new value or later values set by other processors).

Definition at line 186 of file coherent_dht.hpp.

template<typename KeyType, typename ValueType>
void graphlab::coherent_dht< KeyType, ValueType >::set_synchronous_impl ( const KeyType &  key,
const ValueType &  newval,
procid_t  source 
) [inline]

Forces synchronization of this key This operation is synchronous. When this function returns all machines are guarnateed to have the updated value

Definition at line 232 of file coherent_dht.hpp.

template<typename KeyType, typename ValueType>
void graphlab::coherent_dht< KeyType, ValueType >::subscribe ( const KeyType &  key,
bool  async = false 
) const [inline]

Subscribes to this key. This key will be a permanent entry in the cache and can not be invalidated. Key modifications are automatically sent to this machine.

Definition at line 417 of file coherent_dht.hpp.


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