Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

recovery::RecoveryStore Class Reference

#include <recoveryStore.h>

List of all members.

Public Types

typedef ACE_Hash_Map_Manager<
ACE_CString, ACE_CString,
ACE_Thread_Mutex > 
STORE_HASH_MAP
typedef ACE_Hash_Map_Iterator<
ACE_CString, ACE_CString,
ACE_Thread_Mutex > 
STORE_HASH_MAP_ITER
typedef ACE_Hash_Map_Entry<
ACE_CString, ACE_CString > 
STORE_HASH_MAP_ENTRY

Public Member Functions

 RecoveryStore (const ACE_CString &file_name, bool load=true, ACE_UINT32 max_size=0)
 ~RecoveryStore (void)
int open (void)
int close (void)
ACE_UINT32 get_max_size (void)
void set_max_size (ACE_UINT32 size)
ACE_UINT32 get_current_size (void)
ACE_UINT32 get_n_records (void)
int log (const ACE_CString &id, const ACE_CString &data, bool bsave=true)
int exists (const ACE_CString &id)
int retrieve (const ACE_CString &id, ACE_CString &data)
int update (const ACE_CString &id, const ACE_CString &data, bool bsave=true)
int remove (const ACE_CString &id, bool bsave=true)
STORE_HASH_MAP_ITER get_iterator (void)
int save (void)
int load (void)
int unlink (void)

Protected Attributes

RecoveryStore::STORE_HASH_MAP rec_hash_
ACE_CString file_name_
ACE_UINT32 max_size_
ACE_UINT32 current_size_
ACE_UINT32 num_records_
ACE_Recursive_Thread_Mutex mutex_


Detailed Description

A container class for storing recovery information using ACE_CString class. This implementation uses an ACE_Hash_Map_Manager internally to store recovery info. stored in ACE_CString. Permits fast searches by id. It also supports saving data into a file.
Author:
Matej Sekoranja, Jozef Stefan Institute, Slovenia
Version:
"@(#) $Id: recoveryStore.h,v 1.8 2006/09/01 02:20:55 cparedes Exp $" keys must not contain SEPARATOR_CHAR --- this restriction should be somehow removed in implementation...


Member Typedef Documentation

typedef ACE_Hash_Map_Manager<ACE_CString, ACE_CString, ACE_Thread_Mutex> recovery::RecoveryStore::STORE_HASH_MAP
 

typedef ACE_Hash_Map_Entry<ACE_CString, ACE_CString> recovery::RecoveryStore::STORE_HASH_MAP_ENTRY
 

typedef ACE_Hash_Map_Iterator<ACE_CString, ACE_CString, ACE_Thread_Mutex> recovery::RecoveryStore::STORE_HASH_MAP_ITER
 


Constructor & Destructor Documentation

recovery::RecoveryStore::RecoveryStore const ACE_CString &  file_name,
bool  load = true,
ACE_UINT32  max_size = 0
 

Constructor

Parameters:
file_name file name of recovery file
load load existing recovery file
max_size maximum size of the store
See also:
set_max_size

recovery::RecoveryStore::~RecoveryStore void   ) 
 

Destructor


Member Function Documentation

int recovery::RecoveryStore::close void   ) 
 

Finalization method
Calls ACE_Hash_Map close() method.

Returns:
0 on success, -1 on failure

int recovery::RecoveryStore::exists const ACE_CString &  id  ) 
 

Checks if recordwith key id is already mapped

Parameters:
id id of the record
Returns:
0 if record with key id is mapped, otherwise -1

ACE_UINT32 recovery::RecoveryStore::get_current_size void   ) 
 

Gets the current size (in bytes) of the store (id+data).

Returns:
current size (in bytes) of the store (id+data)

STORE_HASH_MAP_ITER recovery::RecoveryStore::get_iterator void   ) 
 

Get iterator of the store

Returns:
iterator of the store

ACE_UINT32 recovery::RecoveryStore::get_max_size void   ) 
 

Get the current set value of the max size of the store.

Returns:
current set value of max size

ACE_UINT32 recovery::RecoveryStore::get_n_records void   ) 
 

Get the number of records in the store right now.

Returns:
number of records in the store

int recovery::RecoveryStore::load void   ) 
 

Load records from the recovery file to the store

Returns:
0 on success, -1 on failure

int recovery::RecoveryStore::log const ACE_CString &  id,
const ACE_CString &  data,
bool  bsave = true
 

Insert rec into storage

Parameters:
id id of the record
data record data
bsave save data to recovery file after operation
Returns:
0 on success, -1 on failure, 1 if store if full

int recovery::RecoveryStore::open void   ) 
 

Initialization method
Calls ACE_Hash_Map open() method.

Returns:
0 if successful, -1 if failed

int recovery::RecoveryStore::remove const ACE_CString &  id,
bool  bsave = true
 

Remove record data with the given id from the storage

Parameters:
id id of the record
bsave save data to recovery file after operation
Returns:
0 on success, -1 on failure

int recovery::RecoveryStore::retrieve const ACE_CString &  id,
ACE_CString &  data
 

Set data to the record data with the given id

Parameters:
id id of the record
data record data
Returns:
0 on success, -1 on failure

int recovery::RecoveryStore::save void   ) 
 

Save records from the store to the recovery file

Returns:
0 on success, -1 on failure

void recovery::RecoveryStore::set_max_size ACE_UINT32  size  ) 
 

Set the max size of the store; size == 0 means infinite.

Parameters:
size max size of the store

int recovery::RecoveryStore::unlink void   ) 
 

Remove recovery store file

Returns:
0 on success, -1 on failure

int recovery::RecoveryStore::update const ACE_CString &  id,
const ACE_CString &  data,
bool  bsave = true
 

Update data in the storage to the record with the given id

Parameters:
id id of the record
data record data
bsave save data to recovery file after operation
Returns:
0 on success, -1 on failure, 1 if store if full


Member Data Documentation

ACE_UINT32 recovery::RecoveryStore::current_size_ [protected]
 

The current size (in bytes) of the store

ACE_CString recovery::RecoveryStore::file_name_ [protected]
 

Recovery store file name

ACE_UINT32 recovery::RecoveryStore::max_size_ [protected]
 

The maximum size of the store.

ACE_Recursive_Thread_Mutex recovery::RecoveryStore::mutex_ [protected]
 

Thread mutex for thread-safe code

ACE_UINT32 recovery::RecoveryStore::num_records_ [protected]
 

The current number of records in the store

RecoveryStore::STORE_HASH_MAP recovery::RecoveryStore::rec_hash_ [protected]
 

The ACE implementation of hash map (ACE_Hash_Map_Manager)


The documentation for this class was generated from the following file:
Generated on Thu Apr 30 02:37:39 2009 for ACS C++ API by doxygen 1.3.8