libmoost
moost::kvds::KvdsPageStore< PageMapT >::Store Class Reference

List of all members.

Public Member Functions

 Store (page_size_t page_size)
 ~Store ()
page_size_t get_page_size () const
void open (char const dsname[], bool newdb)
void save ()
void close ()
bool erase (itemid_t itemid)
bool exists (itemid_t itemid)
size_t size () const
bool empty ()
void clear ()
bool size (itemid_t itemid, size_t &size)
bool read (void *data, page_size_t size, itemid_t itemid)
void write (void const *data, page_size_t size, itemid_t itemid)
void append (void const *data, page_size_t size, itemid_t itemid)
itemid_t get_next_free_id ()
std::streampos get_item_pos (itemid_t itemid) const

Private Types

enum  { PADSIZE = 0xFF }
typedef
moost::container::sparse_hash_set
< itemid_t
free_list_t

Private Member Functions

template<typename valsizeT >
void openT (char const dsname[], bool newdb)
template<typename valsizeT >
bool sizeT (itemid_t itemid, size_t &size)
template<typename valsizeT >
bool readT (void *data, page_size_t size, itemid_t itemid)
template<typename valsizeT >
void writeT (void const *data, size_t size, itemid_t itemid)
template<typename valsizeT >
void appendT (void const *data, size_t size, itemid_t itemid)
template<typename valsizeT >
std::streampos get_item_posT (itemid_t itemid) const
void pad (page_size_t size)

Static Private Member Functions

static char const * GetPadding ()

Private Attributes

page_size_t const page_size_
size_t item_cnt_
free_list_t free_list_
std::fstream store_
std::string store_fname_
std::string dsname_
std::string freelist_fname_

Detailed Description

template<typename PageMapT>
class moost::kvds::KvdsPageStore< PageMapT >::Store

Definition at line 656 of file kvds_page_store.hpp.


Member Typedef Documentation

template<typename PageMapT>
typedef moost::container::sparse_hash_set<itemid_t> moost::kvds::KvdsPageStore< PageMapT >::Store::free_list_t [private]

Definition at line 1170 of file kvds_page_store.hpp.


Member Enumeration Documentation

template<typename PageMapT>
anonymous enum [private]
Enumerator:
PADSIZE 

Definition at line 1141 of file kvds_page_store.hpp.


Constructor & Destructor Documentation

template<typename PageMapT>
moost::kvds::KvdsPageStore< PageMapT >::Store::Store ( page_size_t  page_size) [inline]

Definition at line 659 of file kvds_page_store.hpp.

Here is the call graph for this function:

template<typename PageMapT>
moost::kvds::KvdsPageStore< PageMapT >::Store::~Store ( ) [inline]

Definition at line 676 of file kvds_page_store.hpp.

Here is the call graph for this function:


Member Function Documentation

template<typename PageMapT>
void moost::kvds::KvdsPageStore< PageMapT >::Store::append ( void const *  data,
page_size_t  size,
itemid_t  itemid 
) [inline]

Definition at line 869 of file kvds_page_store.hpp.

Here is the call graph for this function:

template<typename PageMapT>
template<typename valsizeT >
void moost::kvds::KvdsPageStore< PageMapT >::Store::appendT ( void const *  data,
size_t  size,
itemid_t  itemid 
) [inline, private]

Definition at line 1096 of file kvds_page_store.hpp.

Here is the call graph for this function:

template<typename PageMapT>
void moost::kvds::KvdsPageStore< PageMapT >::Store::clear ( ) [inline]

Definition at line 763 of file kvds_page_store.hpp.

Here is the call graph for this function:

template<typename PageMapT>
void moost::kvds::KvdsPageStore< PageMapT >::Store::close ( ) [inline]

Definition at line 726 of file kvds_page_store.hpp.

Here is the caller graph for this function:

template<typename PageMapT>
bool moost::kvds::KvdsPageStore< PageMapT >::Store::empty ( ) [inline]

Definition at line 758 of file kvds_page_store.hpp.

template<typename PageMapT>
bool moost::kvds::KvdsPageStore< PageMapT >::Store::erase ( itemid_t  itemid) [inline]

Definition at line 734 of file kvds_page_store.hpp.

Here is the call graph for this function:

template<typename PageMapT>
bool moost::kvds::KvdsPageStore< PageMapT >::Store::exists ( itemid_t  itemid) [inline]

Definition at line 748 of file kvds_page_store.hpp.

Here is the caller graph for this function:

template<typename PageMapT>
std::streampos moost::kvds::KvdsPageStore< PageMapT >::Store::get_item_pos ( itemid_t  itemid) const [inline]

Definition at line 924 of file kvds_page_store.hpp.

Here is the caller graph for this function:

template<typename PageMapT>
template<typename valsizeT >
std::streampos moost::kvds::KvdsPageStore< PageMapT >::Store::get_item_posT ( itemid_t  itemid) const [inline, private]

Definition at line 1135 of file kvds_page_store.hpp.

template<typename PageMapT>
itemid_t moost::kvds::KvdsPageStore< PageMapT >::Store::get_next_free_id ( ) [inline]

This function only gets what the next free item will be but it doesn't actually reserve it just in case there is an error before it's been used and we end up losing a page. It is, therefore, up to the caller to ensure that all the code from getting the next free ID to using (or disgarding) it is an atomic action.

If there's a free page use that instead

Arrrrr.... no more space in the store!!!

Definition at line 904 of file kvds_page_store.hpp.

Here is the call graph for this function:

template<typename PageMapT>
page_size_t moost::kvds::KvdsPageStore< PageMapT >::Store::get_page_size ( ) const [inline]

Definition at line 684 of file kvds_page_store.hpp.

template<typename PageMapT>
static char const* moost::kvds::KvdsPageStore< PageMapT >::Store::GetPadding ( ) [inline, static, private]

Definition at line 1142 of file kvds_page_store.hpp.

Here is the caller graph for this function:

template<typename PageMapT>
void moost::kvds::KvdsPageStore< PageMapT >::Store::open ( char const  dsname[],
bool  newdb 
) [inline]

Definition at line 686 of file kvds_page_store.hpp.

Here is the caller graph for this function:

template<typename PageMapT>
template<typename valsizeT >
void moost::kvds::KvdsPageStore< PageMapT >::Store::openT ( char const  dsname[],
bool  newdb 
) [inline, private]

Truncate stores and associated free list index (they must exist or open 'in' fails)

IO errors will generate an exception

Definition at line 960 of file kvds_page_store.hpp.

template<typename PageMapT>
void moost::kvds::KvdsPageStore< PageMapT >::Store::pad ( page_size_t  size) [inline, private]

Definition at line 1148 of file kvds_page_store.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename PageMapT>
bool moost::kvds::KvdsPageStore< PageMapT >::Store::read ( void *  data,
page_size_t  size,
itemid_t  itemid 
) [inline]

Definition at line 807 of file kvds_page_store.hpp.

Here is the call graph for this function:

template<typename PageMapT>
template<typename valsizeT >
bool moost::kvds::KvdsPageStore< PageMapT >::Store::readT ( void *  data,
page_size_t  size,
itemid_t  itemid 
) [inline, private]

Definition at line 1035 of file kvds_page_store.hpp.

Here is the call graph for this function:

template<typename PageMapT>
void moost::kvds::KvdsPageStore< PageMapT >::Store::save ( ) [inline]

Definition at line 715 of file kvds_page_store.hpp.

template<typename PageMapT>
size_t moost::kvds::KvdsPageStore< PageMapT >::Store::size ( ) const [inline]

Definition at line 753 of file kvds_page_store.hpp.

Here is the caller graph for this function:

template<typename PageMapT>
bool moost::kvds::KvdsPageStore< PageMapT >::Store::size ( itemid_t  itemid,
size_t &  size 
) [inline]

Definition at line 774 of file kvds_page_store.hpp.

Here is the call graph for this function:

template<typename PageMapT>
template<typename valsizeT >
bool moost::kvds::KvdsPageStore< PageMapT >::Store::sizeT ( itemid_t  itemid,
size_t &  size 
) [inline, private]

Definition at line 1013 of file kvds_page_store.hpp.

Here is the call graph for this function:

template<typename PageMapT>
void moost::kvds::KvdsPageStore< PageMapT >::Store::write ( void const *  data,
page_size_t  size,
itemid_t  itemid 
) [inline]

Definition at line 840 of file kvds_page_store.hpp.

Here is the call graph for this function:

template<typename PageMapT>
template<typename valsizeT >
void moost::kvds::KvdsPageStore< PageMapT >::Store::writeT ( void const *  data,
size_t  size,
itemid_t  itemid 
) [inline, private]

Definition at line 1061 of file kvds_page_store.hpp.

Here is the call graph for this function:


Member Data Documentation

template<typename PageMapT>
std::string moost::kvds::KvdsPageStore< PageMapT >::Store::dsname_ [private]

Definition at line 1174 of file kvds_page_store.hpp.

template<typename PageMapT>
free_list_t moost::kvds::KvdsPageStore< PageMapT >::Store::free_list_ [private]

Definition at line 1171 of file kvds_page_store.hpp.

template<typename PageMapT>
std::string moost::kvds::KvdsPageStore< PageMapT >::Store::freelist_fname_ [private]

Definition at line 1175 of file kvds_page_store.hpp.

template<typename PageMapT>
size_t moost::kvds::KvdsPageStore< PageMapT >::Store::item_cnt_ [private]

Definition at line 1169 of file kvds_page_store.hpp.

template<typename PageMapT>
page_size_t const moost::kvds::KvdsPageStore< PageMapT >::Store::page_size_ [private]

Definition at line 1168 of file kvds_page_store.hpp.

template<typename PageMapT>
std::fstream moost::kvds::KvdsPageStore< PageMapT >::Store::store_ [private]

Definition at line 1172 of file kvds_page_store.hpp.

template<typename PageMapT>
std::string moost::kvds::KvdsPageStore< PageMapT >::Store::store_fname_ [private]

Definition at line 1173 of file kvds_page_store.hpp.


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