Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes

TAO_Notify::Routing_Slip_Persistence_Manager Class Reference

Manage interaction between Routing_Slip and persistent storage. More...

#include <Routing_Slip_Persistence_Manager.h>

Collaboration diagram for TAO_Notify::Routing_Slip_Persistence_Manager:
Collaboration graph
[legend]

List of all members.

Classes

class  Block_Header
 private: Storage for header information of all persistent block. More...
class  Event_Header
 An Event block header. More...
class  Overflow_Header
 An overflow block header. More...
class  Routing_Slip_Header
 private: Storage for header information for Routing_Slip blocks. More...

Public Types

typedef ACE_UINT64 Block_Serial_Number
 A unique identifier for logical blocks in persistent storage.
typedef ACE_UINT32 Block_Number
 The physical address of a block in persistent storage.
typedef ACE_UINT16 Block_Size
 The size of a block in persistent storage.
typedef ACE_UINT16 Block_Type
 A code to indicate the type of block in persistent storage.

Public Member Functions

 Routing_Slip_Persistence_Manager (Standard_Event_Persistence_Factory *factory)
 The constructor.
 ~Routing_Slip_Persistence_Manager ()
 The destructor.
void set_callback (Persistent_Callback *callback)
 Set up callbacks.
bool store (const ACE_Message_Block &event, const ACE_Message_Block &routing_slip)
 Store an event + routing slip.
bool update (const ACE_Message_Block &routing_slip)
 Update the routing slip.
bool remove ()
 Remove our associated event and routing slip from the Persistent_File_Allocator.
bool reload (ACE_Message_Block *&event, ACE_Message_Block *&routing_slip)
 Call this method to recover data during event reload.
Routing_Slip_Persistence_Managerload_next ()
 Get next RSPM during reload.
bool store_root ()
 Commit root data to disk, which should only be done for a root node.
bool load (Block_Number block_number, Block_Serial_Number expected_serial_number)
 Reload data into this RSPM from the given block/serial#.
bool is_root () const
 Is this RSPM attached to the root block?
void release_all ()
 During cleanup for shut down, release all chained RSPMs.

Private Member Functions

bool store_i (const ACE_Message_Block &event, const ACE_Message_Block &routing_slip)
bool update_i (const ACE_Message_Block &routing_slip)
bool store_event (const ACE_Message_Block &event)
size_t fill_block (Persistent_Storage_Block &psb, size_t offset_into_block, const ACE_Message_Block *data, size_t offset_into_msg)
size_t fill_block (Persistent_Storage_Block &psb, size_t offset_into_block, unsigned char *data, size_t data_size)
bool build_chain (Persistent_Storage_Block *first_block, Block_Header &first_header, ACE_Unbounded_Stack< size_t > &allocated_blocks, const ACE_Message_Block &data)
 Build a chain of Persistent_Storage_Blocks.
bool reload_chain (Persistent_Storage_Block *first_block, Block_Header &first_header, ACE_Unbounded_Stack< size_t > &allocated_blocks, ACE_Message_Block *amb, ACE_UINT64 expected_serial_number)
 Reload a chain from persistent store.
bool update_next_manager (Routing_Slip_Persistence_Manager *next)
 Locked method to do the work of setting the next_manager_.
bool persisted ()
 Have we been persisted yet?
size_t write_first_routing_slip_block (bool prepare_only=false)
 Write out our first event block.
void dllist_push_back ()
 Insert ourselves into a linked list of Routing_Slip_Persistnce_Managers.
void insert_before (Routing_Slip_Persistence_Manager *node)
void remove_from_dllist ()
 Remove ourselves from a linked list of Routing_Slip_Persistence_Managers.

Private Attributes

TAO_SYNCH_MUTEX lock_
bool removed_
ACE_UINT64 serial_number_
Persistent_File_Allocatorallocator_
Standard_Event_Persistence_Factoryfactory_
Event_Header event_header_
Routing_Slip_Header routing_slip_header_
Persistent_Storage_Blockfirst_event_block_
Persistent_Storage_Blockfirst_routing_slip_block_
Routing_Slip_Persistence_Managerprev_manager_
 We are part of a doubly-linked list.
Routing_Slip_Persistence_Managernext_manager_
ACE_Unbounded_Stack< size_t > allocated_event_blocks_
ACE_Unbounded_Stack< size_t > allocated_routing_slip_blocks_
Persistent_Callbackcallback_
ACE_Message_Blockevent_mb_
 If these are non-zero we own 'em.
ACE_Message_Blockrouting_slip_mb_

Detailed Description

Manage interaction between Routing_Slip and persistent storage.

todo: to complete the strategization of event persistent storage this should become an interface that is implemented differently by different strategies. For now it interacts with Standard_Event_Persistence.

Definition at line 50 of file Routing_Slip_Persistence_Manager.h.


Member Typedef Documentation

The physical address of a block in persistent storage.

Definition at line 56 of file Routing_Slip_Persistence_Manager.h.

A unique identifier for logical blocks in persistent storage.

Definition at line 54 of file Routing_Slip_Persistence_Manager.h.

The size of a block in persistent storage.

Definition at line 58 of file Routing_Slip_Persistence_Manager.h.

A code to indicate the type of block in persistent storage.

Definition at line 60 of file Routing_Slip_Persistence_Manager.h.


Constructor & Destructor Documentation

TAO_Notify::Routing_Slip_Persistence_Manager::Routing_Slip_Persistence_Manager ( Standard_Event_Persistence_Factory factory  ) 

The constructor.

Definition at line 7 of file Routing_Slip_Persistence_Manager.cpp.

{

Routing_Slip_Persistence_Manager::Routing_Slip_Persistence_Manager(
  Standard_Event_Persistence_Factory* factory)
  : removed_(false)
  , serial_number_(0)
  , allocator_(factory->allocator())
  , factory_(factory)
  , first_event_block_(0)
  , first_routing_slip_block_(0)
  , callback_(0)

TAO_Notify::Routing_Slip_Persistence_Manager::~Routing_Slip_Persistence_Manager (  ) 

The destructor.

Definition at line 23 of file Routing_Slip_Persistence_Manager.cpp.

{
  this->prev_manager_ = this;
  this->next_manager_ = this;
}

Routing_Slip_Persistence_Manager::~Routing_Slip_Persistence_Manager()
{
  ACE_ASSERT(this->prev_manager_ == this);
  ACE_ASSERT(this->next_manager_ == this);
  delete this->first_event_block_;
  this->first_event_block_ = 0;
  delete this->first_routing_slip_block_;


Member Function Documentation

bool TAO_Notify::Routing_Slip_Persistence_Manager::build_chain ( Persistent_Storage_Block first_block,
Block_Header first_header,
ACE_Unbounded_Stack< size_t > &  allocated_blocks,
const ACE_Message_Block data 
) [private]

Build a chain of Persistent_Storage_Blocks.

Definition at line 549 of file Routing_Slip_Persistence_Manager.cpp.

{
  size_t data_size = data.total_length();
  size_t remainder = data_size;
  bool result = true;
  // Save the number of items currently on the allocation list for
  ACE_Unbounded_Stack<size_t> blocks_to_free;
  size_t block_number = 0;

  // reverse the order so when we pop, we free up things closer to block 0
  // first
  while (allocated_blocks.pop(block_number) == 0)
  {
    blocks_to_free.push(block_number);
  }
  size_t pos = first_header.put_header(
    *first_block);
  const ACE_Message_Block* mblk = &data;
  remainder = this->fill_block(*first_block, pos, mblk, 0);
  while ((remainder == 0) && (mblk->cont() != 0))
  {
    pos += mblk->length();
    mblk = mblk->cont();
    remainder = this->fill_block(*first_block, pos, mblk, 0);
  }
  first_header.data_size = 
    static_cast<TAO_Notify::Routing_Slip_Persistence_Manager::Block_Size> (data_size - remainder);
  first_header.next_overflow = 0;

  Block_Header* prevhdr = &first_header;
  Persistent_Storage_Block* prevblk = first_block;

  while (remainder > 0)
  {
    Overflow_Header* hdr = 0;
    ACE_NEW_RETURN(hdr, Overflow_Header, result);

    Persistent_Storage_Block* curblk = this->allocator_->allocate();
    allocated_blocks.push(curblk->block_number());
    // Set the previous block's overflow "pointer" to us.
    prevhdr->next_overflow = ACE_Utils::truncate_cast<Block_Number> (curblk->block_number());
    prevhdr->put_header(*prevblk);
    pos = hdr->put_header(*curblk);
    hdr->data_size = 
      static_cast<TAO_Notify::Routing_Slip_Persistence_Manager::Block_Size> (remainder);

    size_t offset_into_msg = mblk->length() - remainder;
    remainder = this->fill_block(*curblk, pos, mblk, offset_into_msg);
    while ((remainder == 0) && (mblk->cont() != 0))
    {
      pos += mblk->length();
      mblk = mblk->cont();
      remainder = this->fill_block(*curblk, pos, mblk, 0);
    }

    hdr->data_size = hdr->data_size - 
      static_cast<TAO_Notify::Routing_Slip_Persistence_Manager::Block_Size> (remainder);
    if (prevblk != first_block)
    {
      // allocator obtains ownership, so write out and delete the header
      // only.
      result &= this->allocator_->write(prevblk);

      if (prevhdr != &first_header)
        delete prevhdr;
    }
    prevblk = curblk;
    prevhdr = hdr;
  }
  if (prevblk != first_block)
  {
    prevhdr->put_header(*prevblk);
    result &= this->allocator_->write(prevblk);

    if (prevhdr != &first_header)
      delete prevhdr;
  }
  pos = first_header.put_header(
    *first_block);
  // Free all but the first routing_slip_block
  while (blocks_to_free.pop(block_number) == 0)

void TAO_Notify::Routing_Slip_Persistence_Manager::dllist_push_back (  )  [private]

Insert ourselves into a linked list of Routing_Slip_Persistnce_Managers.

Definition at line 768 of file Routing_Slip_Persistence_Manager.cpp.

size_t TAO_Notify::Routing_Slip_Persistence_Manager::fill_block ( Persistent_Storage_Block psb,
size_t  offset_into_block,
const ACE_Message_Block data,
size_t  offset_into_msg 
) [private]

Fill in a block with data, and return the number of bytes of data remaining to be written.

Definition at line 516 of file Routing_Slip_Persistence_Manager.cpp.

{

size_t TAO_Notify::Routing_Slip_Persistence_Manager::fill_block ( Persistent_Storage_Block psb,
size_t  offset_into_block,
unsigned char *  data,
size_t  data_size 
) [private]

Definition at line 526 of file Routing_Slip_Persistence_Manager.cpp.

{
  size_t result = 0;
  if (data_size > 0)
  {
    const size_t max_size = this->allocator_->block_size() - offset_into_block;
    size_t size_to_copy = data_size;
    if (size_to_copy > max_size)
    {
      size_to_copy = max_size;
      result = data_size - size_to_copy;
    }
    else
    {

void TAO_Notify::Routing_Slip_Persistence_Manager::insert_before ( Routing_Slip_Persistence_Manager node  )  [private]

Definition at line 774 of file Routing_Slip_Persistence_Manager.cpp.

{
  insert_before (&this->factory_->root());
}

void
Routing_Slip_Persistence_Manager::insert_before (Routing_Slip_Persistence_Manager * node)
{
  // Since this is a private function, the caller should have done locking
  // on the factory before calling here.  The same is true for removals.
  ACE_ASSERT(this->prev_manager_ == this);
  ACE_ASSERT(this->next_manager_ == this);

bool TAO_Notify::Routing_Slip_Persistence_Manager::is_root (  )  const

Is this RSPM attached to the root block?

Definition at line 736 of file Routing_Slip_Persistence_Manager.cpp.

{
  return (0 != this->first_routing_slip_block_);
}

bool TAO_Notify::Routing_Slip_Persistence_Manager::load ( Block_Number  block_number,
Block_Serial_Number  expected_serial_number 
)

Reload data into this RSPM from the given block/serial#.

Returns:
false if the reload is not successful.

NOTE: There is no need to worry about guarding anything. We assume that there will be one and only one thread doing the entire reload process.

Definition at line 105 of file Routing_Slip_Persistence_Manager.cpp.

{
  /**
   * NOTE: There is no need to worry about guarding anything.  We assume
   *       that there will be one and only one thread doing the entire
   *       reload process.
   */
  bool result = false;
  size_t block_size = this->allocator_->block_size();
  this->first_routing_slip_block_ =
    this->allocator_->allocate_at(block_number);
  this->first_routing_slip_block_->set_allocator_owns(false);
  this->first_routing_slip_block_->set_sync();

  this->serial_number_ = expected_serial_number;

  ACE_NEW_NORETURN(this->routing_slip_mb_, ACE_Message_Block(block_size));
  ACE_NEW_NORETURN(this->event_mb_, ACE_Message_Block(block_size));
  if (this->event_mb_ != 0 && this->routing_slip_mb_ != 0)
  {
    if (this->reload_chain(
          this->first_routing_slip_block_,
          this->routing_slip_header_,
          this->allocated_routing_slip_blocks_,
          this->routing_slip_mb_,
          expected_serial_number))
    {
      if (this->routing_slip_header_.event_block != 0)
      {
        this->first_event_block_ = this->allocator_->allocate_at(
          this->routing_slip_header_.event_block);
        result = this->reload_chain(
          this->first_event_block_,
          this->event_header_,
          this->allocated_event_blocks_,
          this->event_mb_,
          0);
      }
      else if (block_number == ROUTING_SLIP_ROOT_BLOCK_NUMBER)
      {
        // only the root can lack event
        result = true;
      }
      else
      {
        ACE_ERROR((LM_ERROR,
          ACE_TEXT(
            "(%P|%t) Reloaded Persistent Event is missing event.\n")
          ));
      }
    }
  }
  if (! result)
  {
    delete this->routing_slip_mb_;

Routing_Slip_Persistence_Manager * TAO_Notify::Routing_Slip_Persistence_Manager::load_next (  ) 

Get next RSPM during reload.

After using the data from the reload method, call this method to get the next RSPM. It returns a null pointer when all persistent events have been reloaded.

Definition at line 170 of file Routing_Slip_Persistence_Manager.cpp.

{
  Routing_Slip_Persistence_Manager * result;
  ACE_NEW_RETURN(result, Routing_Slip_Persistence_Manager (this->factory_), 0);

  if (result->load(this->routing_slip_header_.next_routing_slip_block,
    this->routing_slip_header_.next_serial_number))
  {
    result->dllist_push_back();
  }
  else
  {
    // steal the psb for use as the next psb.
    // delete the rspm.  We'll create another one later.
    Persistent_Storage_Block * next_psb = result->first_routing_slip_block_;
    result->first_routing_slip_block_ = 0;
//    next_psb->set_allocator_owns(true);
    this->factory_->done_reloading (
      next_psb,

bool TAO_Notify::Routing_Slip_Persistence_Manager::persisted (  )  [private]

Have we been persisted yet?

Definition at line 730 of file Routing_Slip_Persistence_Manager.cpp.

void TAO_Notify::Routing_Slip_Persistence_Manager::release_all (  ) 

During cleanup for shut down, release all chained RSPMs.

Definition at line 742 of file Routing_Slip_Persistence_Manager.cpp.

{
  return this->serial_number_ == ROUTING_SLIP_ROOT_SERIAL_NUMBER;
}

void
Routing_Slip_Persistence_Manager::release_all ()
{
  ACE_ASSERT(is_root());
  while (this->next_manager_ != this)
  {

bool TAO_Notify::Routing_Slip_Persistence_Manager::reload ( ACE_Message_Block *&  event,
ACE_Message_Block *&  routing_slip 
)

Call this method to recover data during event reload.

It should not fail under normal circumstances. Caller owns the resulting message blocks and is responsible for deleting them. Reload the event and routing_slip from the Persistent_File_Allocator.

Definition at line 83 of file Routing_Slip_Persistence_Manager.cpp.

{
  bool result = false;
  if (this->event_mb_ != 0 && this->routing_slip_mb_ != 0)
  {
    event = this->event_mb_;
    this->event_mb_ = 0;
    routing_slip = this->routing_slip_mb_;
    this->routing_slip_mb_ = 0;
    result = true;
  }
  else

bool TAO_Notify::Routing_Slip_Persistence_Manager::reload_chain ( Persistent_Storage_Block first_block,
Block_Header first_header,
ACE_Unbounded_Stack< size_t > &  allocated_blocks,
ACE_Message_Block amb,
ACE_UINT64  expected_serial_number 
) [private]

Reload a chain from persistent store.

Definition at line 641 of file Routing_Slip_Persistence_Manager.cpp.

{
  bool result = false;
  size_t block_size = this->allocator_->block_size();
  if (this->allocator_->read(first_block))
  {
    size_t pos = 0;
    size_t nextptr = 0;
    ACE_Message_Block* mbptr = amb;
    ACE_Message_Block* mbnew = 0;

    pos = first_header.extract_header(*first_block);
    if (first_header.serial_number == expected_serial_number)
    {
      // We have to copy the first block because we cache it.
      ACE_OS::memcpy(mbptr->wr_ptr(), first_block->data(),
        block_size);
      mbptr->rd_ptr(pos);
      mbptr->wr_ptr(pos + first_header.data_size);
      nextptr = first_header.next_overflow;
      while (nextptr != 0)
      {
        Overflow_Header overflow_header;
        ACE_NEW_RETURN(mbnew, ACE_Message_Block(block_size), result);
        mbptr->cont(mbnew);
        Persistent_Storage_Block* psb = this->allocator_->allocate_at(nextptr);
        mbptr = mbnew;
        // Deallocate the PSB's data and reallocate it to our wr_ptr()...
        psb->reassign_data(static_cast<unsigned char*> (static_cast<void*> (mbptr->wr_ptr())), true);
        // ...read into the PSB (whose data is inside of the AMB)...
        this->allocator_->read(psb);
        allocated_blocks.push(psb->block_number());
        // ...extract all headers so we know the data's size...
        pos = overflow_header.extract_header(*psb);
        // ...set up the region that somebody else can look at...
        mbptr->rd_ptr(pos);
        mbptr->wr_ptr(pos + overflow_header.data_size);
        // ...then make sure we don't delete data since we don't own it.
        psb->reassign_data(0);
        delete psb;
        nextptr = overflow_header.next_overflow;

bool TAO_Notify::Routing_Slip_Persistence_Manager::remove ( void   ) 

Remove our associated event and routing slip from the Persistent_File_Allocator.

Definition at line 226 of file Routing_Slip_Persistence_Manager.cpp.

{
  bool result = false;
  ACE_GUARD_RETURN(TAO_SYNCH_MUTEX, ace_mon, this->lock_, result);
  // Assert that this is in the dllist
  ACE_ASSERT(this->prev_manager_ != this);
  ACE_ASSERT(this->persisted());
  Routing_Slip_Persistence_Manager* prev = this->prev_manager_;
  // Once our previous manager removes us, we can deallocate in any order
  this->factory_->lock.acquire();
  this->remove_from_dllist();
  result = prev->update_next_manager(this);
  this->factory_->lock.release();
  size_t block_number = 0;
  if (this->first_routing_slip_block_ != 0)
  {
    this->allocator_->free(this->first_routing_slip_block_->block_number());
    delete this->first_routing_slip_block_;
    this->first_routing_slip_block_ = 0;
  }
  if (this->first_event_block_ != 0)
  {
    this->allocator_->free(this->first_event_block_->block_number());
    delete this->first_event_block_;
    this->first_event_block_ = 0;
  }
  while (this->allocated_routing_slip_blocks_.pop(block_number) == 0)
  {
    this->allocator_->free(block_number);
  }
  while (this->allocated_event_blocks_.pop(block_number) == 0)
  {
    this->allocator_->free(block_number);
  }
  this->removed_ = true;

void TAO_Notify::Routing_Slip_Persistence_Manager::remove_from_dllist (  )  [private]

Remove ourselves from a linked list of Routing_Slip_Persistence_Managers.

Definition at line 788 of file Routing_Slip_Persistence_Manager.cpp.

{
  // Since this is a private function, the caller should have done locking
  // on the factory before calling here.  The same is true for insertions.
  ACE_ASSERT(this->persisted());
  ACE_ASSERT(this->prev_manager_ != this);

void TAO_Notify::Routing_Slip_Persistence_Manager::set_callback ( Persistent_Callback callback  ) 

Set up callbacks.

Definition at line 38 of file Routing_Slip_Persistence_Manager.cpp.

bool TAO_Notify::Routing_Slip_Persistence_Manager::store ( const ACE_Message_Block event,
const ACE_Message_Block routing_slip 
)

Store an event + routing slip.

Definition at line 197 of file Routing_Slip_Persistence_Manager.cpp.

{
  bool result = false;
  ACE_GUARD_RETURN(TAO_SYNCH_MUTEX, ace_mon, this->lock_, result);

bool TAO_Notify::Routing_Slip_Persistence_Manager::store_event ( const ACE_Message_Block event  )  [private]

Definition at line 493 of file Routing_Slip_Persistence_Manager.cpp.

{
  bool result = true;
  size_t event_size = event.total_length();
  if (event_size != 0)
  {
    if (this->first_event_block_ == 0)
    {
      this->first_event_block_ = this->allocator_->allocate();
      this->first_event_block_->set_allocator_owns(false);
    }

    result = this->build_chain(this->first_event_block_,
      this->event_header_, this->allocated_event_blocks_,

bool TAO_Notify::Routing_Slip_Persistence_Manager::store_i ( const ACE_Message_Block event,
const ACE_Message_Block routing_slip 
) [private]

Definition at line 416 of file Routing_Slip_Persistence_Manager.cpp.

  : Block_Header (BT_Routing_Slip)
{
}

bool
Routing_Slip_Persistence_Manager::store_i(const ACE_Message_Block& event,
  const ACE_Message_Block& routing_slip)
{
  bool result = false;

  bool initially_persisted = this->persisted();
  if (!initially_persisted)
  {
    this->factory_->lock.acquire();
    this->factory_->preallocate_next_record(this->serial_number_,
      this->first_routing_slip_block_,
      this->routing_slip_header_.next_serial_number,
      this->routing_slip_header_.next_routing_slip_block);
    this->routing_slip_header_.serial_number = this->serial_number_;
  }

  result = this->build_chain(this->first_routing_slip_block_,
    this->routing_slip_header_, this->allocated_routing_slip_blocks_,
    routing_slip);

  if (result)
  {
    // No need for a callback here since we do our own below
    result &= this->store_event(event);
    // If we have an event block allocated, update our header
    if (this->first_event_block_ != 0)
    {
      this->routing_slip_header_.event_block =
        ACE_Utils::truncate_cast<Block_Number> (this->first_event_block_->block_number());
    }
    else
    {
      ACE_ERROR((LM_ERROR,
        ACE_TEXT(
          "(%P|%t) No Event is being stored with this routing slip.\n")
        ));
    }
    // Always write our first block out.
    this->dllist_push_back();
    result &= (this->write_first_routing_slip_block() != 0);
    // because the first rs blocks everywhere have been given sync, we are
    // guaranteed that they will be totally written by the time we get to this
    // empty callback-only block.
    Persistent_Storage_Block* callbackblock =
      this->allocator_->allocate_nowrite();
    callbackblock->set_callback(this->callback_);
    result &= this->allocator_->write(callbackblock);
  }

bool TAO_Notify::Routing_Slip_Persistence_Manager::store_root (  ) 

Commit root data to disk, which should only be done for a root node.

Definition at line 45 of file Routing_Slip_Persistence_Manager.cpp.

{
  ACE_GUARD(TAO_SYNCH_MUTEX, ace_mon, this->lock_);
  this->callback_ = callback;
}

bool
Routing_Slip_Persistence_Manager::store_root()
{
  bool result = false;

  this->factory_->get_preallocated_pointer (
    this->routing_slip_header_.next_serial_number,
    this->routing_slip_header_.next_routing_slip_block);

  // we should already have a psb, but JIC
  ACE_ASSERT(this->first_routing_slip_block_ != 0);
  ACE_ASSERT(this->first_routing_slip_block_->block_number() ==
    ROUTING_SLIP_ROOT_BLOCK_NUMBER);

  // Don't take any chances.  Use hard-wired root serial number.
  this->routing_slip_header_.serial_number = ROUTING_SLIP_ROOT_SERIAL_NUMBER;

  // This will eventually break after something like 58000 years.
  // At such time we should change this to !=.
  ACE_ASSERT(this->routing_slip_header_.next_serial_number >
    ROUTING_SLIP_ROOT_SERIAL_NUMBER);

  ACE_Message_Block versioninfo(2);
  versioninfo.wr_ptr()[0] = 1; // Major version number
  versioninfo.wr_ptr()[1] = 0; // Minor version number
  versioninfo.wr_ptr(2);
  ACE_GUARD_RETURN(TAO_SYNCH_MUTEX, ace_mon, this->lock_, result);
  result = this->build_chain(this->first_routing_slip_block_,
    this->routing_slip_header_, this->allocated_routing_slip_blocks_,
    versioninfo);
  if (result)

bool TAO_Notify::Routing_Slip_Persistence_Manager::update ( const ACE_Message_Block routing_slip  ) 

Update the routing slip.

We must always overwrite the first block last, and it may not chance. Other blocks should be freed and reallocated.

Definition at line 210 of file Routing_Slip_Persistence_Manager.cpp.

{
  bool result = false;
  ACE_GUARD_RETURN(TAO_SYNCH_MUTEX, ace_mon, this->lock_, result);
  // If we have not gotten the event yet or we have no allocator, fail
  if (!this->removed_)
  {
    if (this->persisted())

bool TAO_Notify::Routing_Slip_Persistence_Manager::update_i ( const ACE_Message_Block routing_slip  )  [private]

Definition at line 472 of file Routing_Slip_Persistence_Manager.cpp.

{
  bool result = true;
  size_t routing_slip_size = routing_slip.total_length();
  if (routing_slip_size != 0)
  {
    result = this->build_chain(this->first_routing_slip_block_,
      this->routing_slip_header_, this->allocated_routing_slip_blocks_,
      routing_slip);

    result &= this->allocator_->write(this->first_routing_slip_block_);
  }

bool TAO_Notify::Routing_Slip_Persistence_Manager::update_next_manager ( Routing_Slip_Persistence_Manager next  )  [private]

Locked method to do the work of setting the next_manager_.

Definition at line 695 of file Routing_Slip_Persistence_Manager.cpp.

{
  bool result = false;
  ACE_GUARD_RETURN(TAO_SYNCH_MUTEX, ace_mon, this->lock_, result);
  ACE_ASSERT(this->persisted());
  if (!this->removed_)
  {
    bool updated = false;
    if (this->next_manager_ != 0)
    {
      if (this->routing_slip_header_.next_serial_number !=
        next->routing_slip_header_.next_serial_number)
      {
        this->routing_slip_header_.next_serial_number =
          next->routing_slip_header_.next_serial_number;
        updated = true;
      }
      if (this->routing_slip_header_.next_routing_slip_block !=
        next->routing_slip_header_.next_routing_slip_block)
      {
        this->routing_slip_header_.next_routing_slip_block =
          next->routing_slip_header_.next_routing_slip_block;
        updated = true;
      }
    }
    if (updated)

size_t TAO_Notify::Routing_Slip_Persistence_Manager::write_first_routing_slip_block ( bool  prepare_only = false  )  [private]

Write out our first event block.

Definition at line 755 of file Routing_Slip_Persistence_Manager.cpp.


Member Data Documentation

Definition at line 253 of file Routing_Slip_Persistence_Manager.h.

Definition at line 254 of file Routing_Slip_Persistence_Manager.h.

Definition at line 244 of file Routing_Slip_Persistence_Manager.h.

Definition at line 255 of file Routing_Slip_Persistence_Manager.h.

Definition at line 246 of file Routing_Slip_Persistence_Manager.h.

If these are non-zero we own 'em.

Definition at line 258 of file Routing_Slip_Persistence_Manager.h.

Definition at line 245 of file Routing_Slip_Persistence_Manager.h.

Definition at line 248 of file Routing_Slip_Persistence_Manager.h.

Definition at line 249 of file Routing_Slip_Persistence_Manager.h.

Definition at line 241 of file Routing_Slip_Persistence_Manager.h.

Definition at line 252 of file Routing_Slip_Persistence_Manager.h.

We are part of a doubly-linked list.

Definition at line 251 of file Routing_Slip_Persistence_Manager.h.

Definition at line 242 of file Routing_Slip_Persistence_Manager.h.

Definition at line 247 of file Routing_Slip_Persistence_Manager.h.

Definition at line 259 of file Routing_Slip_Persistence_Manager.h.

Definition at line 243 of file Routing_Slip_Persistence_Manager.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines