DurableTableImpl Class Reference

#include <DurableStoreImpl.h>

List of all members.


Detailed Description

Storage implementation specific piece of a table.

Definition at line 105 of file DurableStoreImpl.h.


Public Member Functions

 DurableTableImpl (std::string table_name, bool multitype)
virtual ~DurableTableImpl ()
virtual int get (const SerializableObject &key, SerializableObject *data)=0
 Get the data for the given key from the datastore and unserialize into the given data object.
virtual int get (const SerializableObject &key, SerializableObject **data, TypeCollection::Allocator_t allocator)
 For a multi-type table, get the data for the given key, calling the provided allocator function to create the object.
virtual int put (const SerializableObject &key, TypeCollection::TypeCode_t typecode, const SerializableObject *data, int flags)=0
 Put data for key in the database.
virtual int del (const SerializableObject &key)=0
 Delete a (key,data) pair from the database.
virtual size_t size () const =0
 Return the number of elements in the table.
virtual DurableIteratoritr ()=0
 Get an iterator to this table.
const char * name ()
 Return the name of this table.

Protected Member Functions

size_t flatten (const SerializableObject &key, u_char *key_buf, size_t size)
 Helper method to flatten a serializable object into a buffer.
template<size_t _size>
size_t flatten (const SerializableObject &key, ScratchBuffer< u_char *, _size > *scratch)

Protected Attributes

std::string table_name_
 Name of the table.
bool multitype_
 Whether single or multi-type table.

Constructor & Destructor Documentation

DurableTableImpl::DurableTableImpl ( std::string  table_name,
bool  multitype 
) [inline]

Definition at line 107 of file DurableStoreImpl.h.

virtual DurableTableImpl::~DurableTableImpl (  )  [inline, virtual]

Definition at line 110 of file DurableStoreImpl.h.


Member Function Documentation

virtual int DurableTableImpl::get ( const SerializableObject &  key,
SerializableObject *  data 
) [pure virtual]

Get the data for the given key from the datastore and unserialize into the given data object.

Parameters:
key Key object
data Data object
Returns:
DS_OK, DS_NOTFOUND if key is not found

virtual int DurableTableImpl::get ( const SerializableObject &  key,
SerializableObject **  data,
TypeCollection::Allocator_t  allocator 
) [virtual]

For a multi-type table, get the data for the given key, calling the provided allocator function to create the object.

Note that a default implementation (that panics) is provided such that subclasses need not support multi-type tables.

Parameters:
key Key object
data Data object
allocator Type allocator class
Returns:
DS_OK, DS_ERR

virtual int DurableTableImpl::put ( const SerializableObject &  key,
TypeCollection::TypeCode_t  typecode,
const SerializableObject *  data,
int  flags 
) [pure virtual]

Put data for key in the database.

Parameters:
key Key object
typecode Typecode (if multitype)
data Data object
flags Bit vector of DurableStoreFlags_t values.
Returns:
DS_OK, DS_ERR // XXX/bowei

virtual int DurableTableImpl::del ( const SerializableObject &  key  )  [pure virtual]

Delete a (key,data) pair from the database.

Returns:
DS_OK, DS_NOTFOUND if key is not found

virtual size_t DurableTableImpl::size (  )  const [pure virtual]

Return the number of elements in the table.

virtual DurableIterator* DurableTableImpl::itr (  )  [pure virtual]

Get an iterator to this table.

Returns:
The new iterator. Caller deletes this pointer.

Referenced by DurableTable< _BaseType >::itr().

const char* DurableTableImpl::name (  )  [inline]

Return the name of this table.

Definition at line 174 of file DurableStoreImpl.h.

References table_name_.

size_t DurableTableImpl::flatten ( const SerializableObject &  key,
u_char *  key_buf,
size_t  size 
) [protected]

Helper method to flatten a serializable object into a buffer.

template<size_t _size>
size_t DurableTableImpl::flatten ( const SerializableObject &  key,
ScratchBuffer< u_char *, _size > *  scratch 
) [inline, protected]

Definition at line 195 of file DurableStoreImpl.h.


Member Data Documentation

std::string DurableTableImpl::table_name_ [protected]

Name of the table.

Definition at line 187 of file DurableStoreImpl.h.

Referenced by name().

bool DurableTableImpl::multitype_ [protected]

Whether single or multi-type table.

Definition at line 188 of file DurableStoreImpl.h.


The documentation for this class was generated from the following file:
Generated on Sat Sep 8 08:36:20 2007 for DTN Reference Implementation by  doxygen 1.5.3