libmoost
moost::kvds::KvdsPageMapShared< pagemapT >::metadata Struct Reference

List of all members.

Public Types

typedef KvdsPageMapShared
< pagemapT > 
shared_pagemap_t
typedef shared_pagemap_t::pagemap_t pagemap_t
typedef std::vector
< shared_pagemap_t * > 
shared_pagemaps_t

Public Member Functions

 metadata (shared_pagemap_t *pshared)
bool is_owner (shared_pagemap_t *pshared)
void remove (shared_pagemap_t *pshared)
 Remove pshared from the list of shared pagemaps.

Public Attributes

volatile std::sig_atomic_t isdirty
 If this flag is set we need to perform a save.
boost::shared_ptr< pagemap_tppagemap
boost::shared_ptr
< shared_pagemaps_t
pshared_pagemaps

Detailed Description

template<typename pagemapT>
struct moost::kvds::KvdsPageMapShared< pagemapT >::metadata

This metadata is shared by all instances that share the same pagemap. It is used to ensure only one shared pagemap is the "owner" to prevent, for example, multiple loads/saves when the collection of shared pagemaps is destroyed. Clearly, since they are all sharing the same underlying data it doesn't make sence to have it loaded/saved multiple times.

Definition at line 108 of file kvds_page_store.hpp.


Member Typedef Documentation

template<typename pagemapT >
typedef shared_pagemap_t::pagemap_t moost::kvds::KvdsPageMapShared< pagemapT >::metadata::pagemap_t

Definition at line 111 of file kvds_page_store.hpp.

template<typename pagemapT >
typedef KvdsPageMapShared<pagemapT> moost::kvds::KvdsPageMapShared< pagemapT >::metadata::shared_pagemap_t

Definition at line 110 of file kvds_page_store.hpp.

template<typename pagemapT >
typedef std::vector<shared_pagemap_t *> moost::kvds::KvdsPageMapShared< pagemapT >::metadata::shared_pagemaps_t

Definition at line 112 of file kvds_page_store.hpp.


Constructor & Destructor Documentation

template<typename pagemapT >
moost::kvds::KvdsPageMapShared< pagemapT >::metadata::metadata ( shared_pagemap_t pshared) [inline]

If pshared already exists something is amiss! This should just not be possible. For this reason I am going to assert it's not to happen but do nothing more to report it as an error. Instead I'll just code against adding it to the list more than once. If, later, we notice this asserting we need to figure out why and fix.

We're using a vector rather than (for example) a set because the items are maintained in chronological order. Although this means the search complexity is O(N) the size of the list is unlikely to be too large (probably 10, 20 or so) so the benefits beat the cons.

Definition at line 114 of file kvds_page_store.hpp.

Here is the call graph for this function:


Member Function Documentation

template<typename pagemapT >
bool moost::kvds::KvdsPageMapShared< pagemapT >::metadata::is_owner ( shared_pagemap_t pshared) [inline]

Definition at line 135 of file kvds_page_store.hpp.

template<typename pagemapT >
void moost::kvds::KvdsPageMapShared< pagemapT >::metadata::remove ( shared_pagemap_t pshared) [inline]

Remove pshared from the list of shared pagemaps.

Definition at line 145 of file kvds_page_store.hpp.


Member Data Documentation

template<typename pagemapT >
volatile std::sig_atomic_t moost::kvds::KvdsPageMapShared< pagemapT >::metadata::isdirty

If this flag is set we need to perform a save.

Definition at line 151 of file kvds_page_store.hpp.

template<typename pagemapT >
boost::shared_ptr<pagemap_t> moost::kvds::KvdsPageMapShared< pagemapT >::metadata::ppagemap

This is the actual pagemap entity we are proxying. NB. created on the heap so we access indirectly (via a pointer) to prevent issues with x-thread optimisation

Definition at line 155 of file kvds_page_store.hpp.

template<typename pagemapT >
boost::shared_ptr<shared_pagemaps_t> moost::kvds::KvdsPageMapShared< pagemapT >::metadata::pshared_pagemaps

This is a chronoligically ordered list of users of this map, the first (begin) being the owner NB. created on the heap so we access indirectly (via a pointer) to prevent issues with x-thread optimisation

Definition at line 159 of file kvds_page_store.hpp.


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