ObjectStore C++ API Reference

os_transaction_hook

This class provides functions for registering and deregistering transaction hook functions. It also provides enumerators for specifying the type of event to trigger invocation of a given hook function.

Programs using this class must include the header file <ostore/tranhook.hh> after including <ostore/ostore.hh>.

os_transaction_hook::after_begin

This enumerator is used as an argument to register_hook() to specify that a hook function is to be invoked just after each transaction begins.

os_transaction_hook::after_commit

This enumerator is used as an argument to register_hook() to specify that a hook function is to be invoked just after each transaction commit.

os_transaction_hook::before_abort

This enumerator is used as an argument to register_hook() to specify that a hook function is to be invoked just before each transaction abort.

os_transaction_hook::before_commit

This enumerator is used as an argument to register_hook() to specify that a hook function is to be invoked just before each transaction commit.

os_transaction_hook::before_retry

This enumerator is used as an argument to register_hook() to specify that a hook function is to be invoked just before each retry of an aborted transaction.

os_transaction_hook::register_hook()

typedef void (*hook_t)(
      const os_int32 event_type, const os_transaction*
      ); 
Solaris SunPro
typedef void (*hook_t)(
      const os_transaction_hook::event_type, const os_transaction*
      );
static hook_t register_hook(
      os_int32 event_type, hook_t hook_fn
      );
Solaris SunPro
static hook_t register_hook(
      os_transaction_hook::event_type, hook_t hook_fn
      );
Registers hook_fn and specifies that it should be called each time an event of type event_type occurs. event_type is one of the following enumerators:

A pointer to the current hook function is returned, or 0 if there is none. The application must ensure that any previously registered hook functions, as returned by register_hook(), are called at some point during the execution of the current hook function.

When hook_fn is invoked, the arguments passed to it are as follows. The first argument (event_type) is an enumerator indicating the type of event that triggered invocation. The second argument is a pointer to the current transaction. If the first argument is os_transaction_hook::before_retry, the second argument is 0.

Do not abort or commit the current transaction from within a hook function.

os_transaction_hook::deregister_hook()

static void deregister_hook(os_int32 event_type);
Deregisters all hook functions with event type event_type. Note that if a previously registered hook function was returned by register_hook(), it must be reregistered.



[previous] [next]

Copyright © 1997 Object Design, Inc. All rights reserved.

Updated: 03/31/98 17:25:09