TAO_PSDL_Datastore Class Reference

This class facilitates implementation of Persistent Service. Helps perform the bind and find to the hash_map. More...

#include <PSDL_Datastore.h>

Collaboration diagram for TAO_PSDL_Datastore:

Collaboration graph
[legend]
List of all members.

Public Types

typedef ACE_Hash_Map_With_Allocator<
TAO_PSDL_String, TAO_PSDL_OctetSeq
NAME_OBJ_REF_MAP
 Hash map used by Persistent Naming Context to keep its state.
typedef ACE_Hash_Map_Entry<
TAO_PSDL_String, TAO_PSDL_OctetSeq
NAME_OBJ_REF_ENTRY
typedef ACE_Allocator_Adapter<
ACE_Malloc< ACE_MMAP_MEMORY_POOL,
TAO_SYNCH_MUTEX > > 
ALLOCATOR
 Allocator we will be using to make the Naming Service persistent.

Public Member Functions

 TAO_PSDL_Datastore ()
 Constructor.
int open (const ACE_TCHAR *file_name, void *base_address=ACE_DEFAULT_BASE_ADDR)
int init (size_t context_size)
 ~TAO_PSDL_Datastore (void)
int bind (const char *name, const CORBA::OctetSeq &octetseq)
int unbind (const char *name)
int find (const char *name, CORBA::OctetSeq &octet_seq)
ACE_Allocatorallocator (void)
 Return allocator.

Private Member Functions

int recreate_all (void)
int create_index (void)
 Helper for the <open> method.
int create_index_helper (void *buffer)

Private Attributes

TAO_SYNCH_MUTEX lock_
ALLOCATORallocator_
NAME_OBJ_REF_MAPobj_ref_map_
 Hash map where we keep entries for all Persistent entries.
const ACE_TCHARindex_file_
 Name of the memory-mapped file used by <allocator_>.
void * base_address_
 Base address for the memory-mapped file.

Detailed Description

This class facilitates implementation of Persistent Service. Helps perform the bind and find to the hash_map.


Member Typedef Documentation

typedef ACE_Allocator_Adapter<ACE_Malloc <ACE_MMAP_MEMORY_POOL, TAO_SYNCH_MUTEX> > TAO_PSDL_Datastore::ALLOCATOR
 

Allocator we will be using to make the Naming Service persistent.

typedef ACE_Hash_Map_Entry<TAO_PSDL_String, TAO_PSDL_OctetSeq> TAO_PSDL_Datastore::NAME_OBJ_REF_ENTRY
 

typedef ACE_Hash_Map_With_Allocator<TAO_PSDL_String, TAO_PSDL_OctetSeq> TAO_PSDL_Datastore::NAME_OBJ_REF_MAP
 

Hash map used by Persistent Naming Context to keep its state.


Constructor & Destructor Documentation

TAO_PSDL_Datastore::TAO_PSDL_Datastore  ) 
 

Constructor.

TAO_PSDL_Datastore::~TAO_PSDL_Datastore void   ) 
 

Destructor. The memory mapped file that was opened/created is not deleted, since we want it to keep the state of the Database until the next run.


Member Function Documentation

ACE_Allocator * TAO_PSDL_Datastore::allocator void   ) 
 

Return allocator.

int TAO_PSDL_Datastore::bind const char *  name,
const CORBA::OctetSeq octetseq
 

int TAO_PSDL_Datastore::create_index void   )  [private]
 

Helper for the <open> method.

int TAO_PSDL_Datastore::create_index_helper void *  buffer  )  [private]
 

Helper for <create_index> method: places hash table into an allocated space.

int TAO_PSDL_Datastore::find const char *  name,
CORBA::OctetSeq octet_seq
 

int TAO_PSDL_Datastore::init size_t  context_size  ) 
 

If <index_> contains no entries (i.e., was just created), create a root Persistent servant with table of size <context_size>, and make an entry for it in the <index_>. If <index_> contains entries, create a Persistent servant for each entry. Return 0 on success and -1 on failure.

int TAO_PSDL_Datastore::open const ACE_TCHAR file_name,
void *  base_address = ACE_DEFAULT_BASE_ADDR
 

Create ACE_Allocator, open/create memory-mapped file with the specified file name/base address. Find or allocate <index_>. Return 0 on success or -1 on failure.

int TAO_PSDL_Datastore::recreate_all void   )  [private]
 

Helper for the <init> method. Iterates over <index_>, and creates a servant for each entry.

int TAO_PSDL_Datastore::unbind const char *  name  ) 
 


Member Data Documentation

ALLOCATOR* TAO_PSDL_Datastore::allocator_ [private]
 

Allocator that deals out memory from a memory-mapped file. We use it whenever we deal with data that should be kept in persistent store.

void* TAO_PSDL_Datastore::base_address_ [private]
 

Base address for the memory-mapped file.

const ACE_TCHAR* TAO_PSDL_Datastore::index_file_ [private]
 

Name of the memory-mapped file used by <allocator_>.

TAO_SYNCH_MUTEX TAO_PSDL_Datastore::lock_ [private]
 

Lock to prevent multiple threads from modifying entries in the <index_> simultanneously.

NAME_OBJ_REF_MAP* TAO_PSDL_Datastore::obj_ref_map_ [private]
 

Hash map where we keep entries for all Persistent entries.


The documentation for this class was generated from the following files:
Generated on Wed Nov 23 16:36:33 2005 for TAO_PSS by  doxygen 1.4.5