DiCE API nvidia_logo_transpbg.gif Up
mi::bridge::IServer_transaction Class Referenceabstract

Database transactions started on the client will be automatically mirrored to the server and exposed as instances of this class to executing Bridge jobs. More...

#include <ibridge_server.h>

Inheritance diagram for mi::bridge::IServer_transaction:

Public Member Functions

virtual IServer_sessionget_session () const =0
 Returns the session of the transaction. More...
 
virtual neuraylib::ITransaction * get_database_transaction () const =0
 Returns the local transaction corresponding to this Bridge transaction, or NULL if this transaction has not yet been started on the client. More...
 
template<class T>
T * get_database_transaction () const
 Returns the local transaction corresponding to this Bridge transaction. More...
 
virtual Sint32 add_transaction_callback (IServer_transaction_callback *callback)=0
 Adds a transaction callback. More...
 
virtual Sint32 remove_transaction_callback (IServer_transaction_callback *callback)=0
 Removes a transaction callback. More...
 
virtual Sint32 create_snapshot (const char *element, IString *snapshot_id)=0
 Creates a snapshot of some database elements. More...
 
virtual Sint32 create_incremental_snapshot_context (const char *element, IString *snapshot_id, IIncremental_snapshot_context **context)=0
 Creates a base snapshot and a context for subsequent incremental snapshots. More...
 
virtual Size get_updated_element_count () const =0
 Returns the number of database elements updated by this transaction so far. More...
 
virtual IServer_job_listget_pending_jobs () const =0
 Returns the list of currently pending jobs for this transaction in the order they will be executed. More...
 
virtual const char * get_id () const =0
 Returns the id of this Bridge transaction. More...
 
- Public Member Functions inherited from mi::base::IInterface
virtual Uint32 retain () const =0
 Increments the reference count. More...
 
virtual Uint32 release () const =0
 Decrements the reference count. More...
 
virtual const IInterfaceget_interface (const Uuid &interface_id) const =0
 Acquires a const interface from another. More...
 
template<class T>
const T * get_interface () const
 Acquires a const interface from another. More...
 
virtual IInterfaceget_interface (const Uuid &interface_id)=0
 Acquires a mutable interface from another. More...
 
template<class T>
T * get_interface ()
 Acquires a mutable interface from another. More...
 
virtual Uuid get_iid () const =0
 Returns the interface ID of the most derived interface. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0x67fd848e, ... >
typedef Interface_declare< id1, ... > Self
 Own type. More...
 
typedef Uuid_t< id1, ... > IID
 Declares the interface ID (IID) of this interface. More...
 
- Public Types inherited from mi::base::IInterface
typedef Uuid_t<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> IID
 Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0x67fd848e, ... >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 
- Static Public Member Functions inherited from mi::base::IInterface
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface. More...
 

Detailed Description

Database transactions started on the client will be automatically mirrored to the server and exposed as instances of this class to executing Bridge jobs.

The relative start and commit order of the mirrored server side transactions will always be the same as on the client. Note however that the server side transactions are started and committed asynchronously so even after committing the client side transaction the mirrored server side transaction might not even have been started yet. For the client to know when a server side transaction has finished it must wait for the last Bridge job executed in the transaction to complete.

Member Function Documentation

 add_transaction_callback()

virtual Sint32 mi::bridge::IServer_transaction::add_transaction_callback ( IServer_transaction_callback callback)
pure virtual

Adds a transaction callback.

The callback will be called when the transaction has been committed or aborted by the client, or if there is an error causing the transaction to be aborted.

See also
remove_transaction_callback()
Parameters
callbackThe callback to be added.
Returns
  • 0: Success.
  • -1: Invalid argument (callback is NULL).
  • -2: The transaction is not open.
  • -3: The transaction callback was already added.
  • <= -4: Unspecified error.

 create_incremental_snapshot_context()

virtual Sint32 mi::bridge::IServer_transaction::create_incremental_snapshot_context ( const char *  element,
IString snapshot_id,
IIncremental_snapshot_context **  context 
)
pure virtual

Creates a base snapshot and a context for subsequent incremental snapshots.

In contrast to regular snapshots, incremental snapshots contain only those elements that have been changed since the last incremental snapshot of the same context. The first incremental snapshot, also called base snapshot, of a given context contains all elements, just as the regular snapshot.

Incremental snapshots must be imported in the same order as they were created, starting with the base snapshot.

Note
The current transaction is only used for the base snapshot, the context itself is not bound to this transaction.
See also
create_snapshot(), mi::bridge::IBridge_server::create_snapshot_context()
Parameters
elementThe top level element that incremental snapshots will be created for.
[out]snapshot_idThe ID of the snapshot will be stored here if the operation is successful.
[out]contextThe context to be used for incremental snapshots.
Returns
  • 0: Success.
  • -1: Invalid parameters (element, snapshot_id, or context is NULL).
  • -2: The specified element does not exist.
  • -3: Failed to create the snapshot.
  • <= -4: Unspecified error.

 create_snapshot()

virtual Sint32 mi::bridge::IServer_transaction::create_snapshot ( const char *  element,
IString snapshot_id 
)
pure virtual

Creates a snapshot of some database elements.

The snapshot will save the provided element and all elements it references in their current state into the disk cache. The snapshot will only reference data already in the disk cache so storage cost of snapshots is very low. Data in the disk cache is guaranteed not to be removed for as long as there exists at least one snapshot that references the data.

See also
create_incremental_snapshot_context(), mi::bridge::IBridge_server::create_snapshot_context()
Parameters
elementThe top level element to save the snapshot for.
[out]snapshot_idThe ID of the snapshot will be stored here if the operation is successful.
Returns
  • 0: Success.
  • -1: Invalid arguments (element or snapshot_id is NULL).
  • -2: The specified element does not exist.
  • -3: Failed to create the snapshot.
  • <= -4: Unspecified error.

 get_database_transaction() [1/2]

template<class T>
T * mi::bridge::IServer_transaction::get_database_transaction ( ) const
inline

Returns the local transaction corresponding to this Bridge transaction.

This templated member function is a wrapper of the non-template variant for the user's convenience. It eliminates the need to call mi::base::IInterface::get_interface(const Uuid&) on the returned pointer, since the return type already is a pointer to the type T specified as template parameter.

 get_database_transaction() [2/2]

virtual neuraylib::ITransaction * mi::bridge::IServer_transaction::get_database_transaction ( ) const
pure virtual

Returns the local transaction corresponding to this Bridge transaction, or NULL if this transaction has not yet been started on the client.

The IServer_transaction instance passed to mi::bridge::IServer_job::execute() will always be started. IServer_transaction instances returned by mi::bridge::IServer_session::get_pending_transactions() are however not always started yet, in which case this method will return NULL.

Returns
the database transaction or NULL if this bridge transaction has not yet been started.

 get_id()

virtual const char * mi::bridge::IServer_transaction::get_id ( ) const
pure virtual

Returns the id of this Bridge transaction.

The id is only guaranteed to be unique among the currently active transactions and is suitable only for log messages and the like. Note that the Bridge transaction id is not the same as the id of the database transaction returned by get_database_transaction().

 get_pending_jobs()

virtual IServer_job_list * mi::bridge::IServer_transaction::get_pending_jobs ( ) const
pure virtual

Returns the list of currently pending jobs for this transaction in the order they will be executed.

Note that jobs added after the call to this method won't be present in the list and that jobs might have completed execution when this list is processed. Also note that jobs within this transaction will execute in sequence but jobs belonging to other transactions might execute in parallel if the transactions execute in parallel.

Two transactions will execute in sequence if the second transaction is started after
the previous transaction was committed. Example: start A, commit A, start B commit B. They will execute in parallel if the second transaction is started before the previous transaction is committed. For instance start A, start B, commit A, commit B.

Returns
A list of pending jobs in the order they will be executed.

 get_session()

virtual IServer_session * mi::bridge::IServer_transaction::get_session ( ) const
pure virtual

Returns the session of the transaction.

 get_updated_element_count()

virtual Size mi::bridge::IServer_transaction::get_updated_element_count ( ) const
pure virtual

Returns the number of database elements updated by this transaction so far.

This number includes elements that have just been uploaded to the disk cache as well as elements that also have been replicated in the database.

 remove_transaction_callback()

virtual Sint32 mi::bridge::IServer_transaction::remove_transaction_callback ( IServer_transaction_callback callback)
pure virtual

Removes a transaction callback.

See also
add_transaction_callback()
Parameters
callbackThe callback to be removed.
Returns
  • 0: Success.
  • -1: Invalid argument (callback is NULL).
  • -2: There is no such callback.
  • <= -3: Unspecified error.