You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.



Main Page   Compound List   File List   Compound Members  

tmTransactionService Class Reference

#include <tmTransactionService.h>

List of all members.

Public Member Functions

virtual ~tmTransactionService ()
NS_DECL_ISUPPORTS NS_IMETHOD OnMessageAvailable (const nsID &aTarget, const PRUint8 *aData, PRUint32 aDataLength)
NS_IMETHOD Init (const nsACString &aProfileName)
NS_IMETHOD Attach (const nsACString &aQueueName, tmITransactionObserver *aObserver)
NS_IMETHOD Detach (const nsACString &aQueueName)
NS_IMETHOD Flush (const nsACString &aQueueName)
NS_IMETHOD PostTransaction (const nsACString &aQueueName, const PRUint8 *aData, PRUint32 aDataLen)

Protected Member Functions

void SendMessage (tmTransaction *aTrans)
nsresult OnAttachReply (tmTransaction *aTrans)
nsresult OnDetachReply (tmTransaction *aTrans)
nsresult OnFlushReply (tmTransaction *aTrans)
nsresult OnPost (tmTransaction *aTrans)
nsresult DispatchStoredMessages (queue_mapping *aQMapping)
PRUint32 GetQueueID (const nsACString &aQueueName)
char * GetJoinedQueueName (PRUint32 aQueueID)
queue_mapping * GetQueueMap (PRUint32 aQueueID)

Protected Attributes

nsCString mProfileName
PLHashTable * mObservers
tmVector mQueueMaps
tmVector mWaitingMessages


Detailed Description

The client side piece of the entire Transaction Service. Code interested in sharing information with other running processes connect through this service and send transactions that will be broadcast out to any processes that have hooked into the Transaction Manager (a module for the IPC daemon) as listeners for the particular profile and domain the sender is broadcasting information for.


Constructor & Destructor Documentation

virtual tmTransactionService::~tmTransactionService   [virtual]
 

Reclaim all the memory allocated: PL_hashtable, nsvoidarrays


Member Function Documentation

NS_IMETHOD tmTransactionService::Attach const nsACString &    aQueueName,
tmITransactionObserver *    aObserver
 

Sends a message to attach to the queue named by the arg passed in and link those transactions to the observer passed in.

Returns:
NS_OK if everything goes well and the attach message is sent

TM_ERROR_QUEUE_EXISTS if the queue already exists which means someone has already attached to it.

NS_ERROR_OUT_OF_MEMORY if any of the various allocations fail

NS_ERROR_INVALID_ARG if there was a problem creating the transaction

NS_IMETHOD tmTransactionService::Detach const nsACString &    aQueueName
 

Sends a message to remove the listener from the queue named by the arg passed in. Actual detachment locally doesn't happen until the DETACH_REPLY message is recieved. If the queue named has not been attached to yet this message is queued until the ATTACH_REPLY is received for that queue.

Returns:
NS_OK if everything goes well and the detach message is sent

NS_ERROR_OUT_OF_MEMORY if any of the various allocations fail

NS_ERROR_INVALID_ARG if there was a problem creating the transaction

nsresult tmTransactionService::DispatchStoredMessages queue_mapping *    aQMapping [protected]
 

Cycle through the collection of transactions waiting to go out and send any that are waiting on an ATTACH_REPLY from the queue specified by the queue_mapping passed in.

Returns:
NS_OK

NS_ERROR_INVALID_ARG if the queue_mapping passed in is null

NS_IMETHOD tmTransactionService::Flush const nsACString &    aQueueName
 

Sends a message to flush the queue named by the arg, removing all transactions from that queue. A client should not assume the queue has been flushed until receiving the FLUSH_REPLY message. If the queue named has not been attached to yet this message is queued until the ATTACH_REPLY is received for that queue.

Returns:
NS_OK if everything goes well and the detach message is sent

NS_ERROR_OUT_OF_MEMORY if any of the various allocations fail

NS_ERROR_INVALID_ARG if there was a problem creating the transaction

char* tmTransactionService::GetJoinedQueueName PRUint32    aQueueID [protected]
 

Returns:
the joined queue name - profile name + domain (prefs, cookies etc) corresponding to the ID passed in. nsnull if the ID is not found.

PRUint32 tmTransactionService::GetQueueID const nsACString &    aQueueName [protected]
 

Returns:
the ID corresponding to the queue name passed in

TM_INVALID_ID if the name is not found.

queue_mapping* tmTransactionService::GetQueueMap PRUint32    aQueueID [protected]
 

Returns:
the queue_mapping object that contains the ID passed in.

nsnull if the ID is not found.

NS_IMETHOD tmTransactionService::Init const nsACString &    aProfileName
 

This gets the IPC Service and registers as a listener for transaction IPC messages. Some internal storage is created and the profile name that we are interested in is cached.

Returns:
NS_OK if all goes well

NS_ERROR_FAILURE if we are unable to get the IPC Service or if we fail to initialize the hashtable

nsresult tmTransactionService::OnAttachReply tmTransaction   aTrans [protected]
 

Pulls the queueID out of the ATTACH_REPLY message and stores it in the proper queue_mapping object. Calls DispatchStoredMessages() to make sure we send any messages that have been waiting on the ATTACH_REPLY. Also calls the OnAttachReply() method for the observer of the queue.

Returns:
NS_OK

nsresult tmTransactionService::OnDetachReply tmTransaction   aTrans [protected]
 

Removes the queue_mapping object and calls the OnDetachReply() method on the observer of the queue detached.

Returns:
NS_OK

nsresult tmTransactionService::OnFlushReply tmTransaction   aTrans [protected]
 

Calls the OnFlushReply method of the observer of the queue.

Returns:
NS_OK

NS_DECL_ISUPPORTS NS_IMETHOD tmTransactionService::OnMessageAvailable const nsID &    aTarget,
const PRUint8 *    aData,
PRUint32    aDataLength
 

The transaction is constructed from the raw data and passed on to the proper handler.

Returns:
NS_OK if everything was successful

NS_ERROR_INVALID_ARG if there was a problem creating the transaction

NS_ERROR_OUT_OF_MEMORY if allocation of space for the copy of the message fails.

nsresult tmTransactionService::OnPost tmTransaction   aTrans [protected]
 

Calls the OnPost method of the observer of the queue.

Returns:
NS_OK

NS_IMETHOD tmTransactionService::PostTransaction const nsACString &    aQueueName,
const PRUint8 *    aData,
PRUint32    aDataLen
 

A transaction is created to add to the queue named in the arg. The Transaction Manager will send a POST_REPLY message to indicate the success of posting the message to the queue. If the queue named has not been attached to yet this message is queued until the ATTACH_REPLY is received for that queue.

Returns:
NS_OK if everything goes well and the post is sent.

NS_ERROR_OUT_OF_MEMORY if any of the various allocations fail

NS_ERROR_INVALID_ARG if there was a problem creating the transaction

void tmTransactionService::SendMessage tmTransaction   aTrans [protected]
 

Pulls the raw message out of the transaction and sends it to the IPC service to be delivered to the TM.


The documentation for this class was generated from the following file:
Generated on Mon Feb 24 10:22:51 2003 for transaction manager by doxygen1.3-rc3