Management classes are offered for both new and existing RTR applications. The types of management classes include:
RTR class
RTRFacilityMember class
RTRFacilityMemberArray class
RTRFacilityProperties class
RTRFacilityManager class
RTRBackendPartitonProperties class
RTRKeySegment class
RTRKeySegmentArray class
RTRPartitionManager class
RTRSignedCounter class
RTRStringCounter class
RTRUnsignedCounter class
The RTR class is a setup class, for RTR system management operations, designed for starting and stopping RTR, and creating and deleting RTR journals.
RTR Class Members
Construction
Method |
Description |
RTR() |
Constructor |
~RTR() |
Destructor |
Operations
Method |
Description |
CreateJournal(bool) |
Create a journal for RTR. |
Delete the journal for RTR. |
|
GetErrorText(rtr_status_t) |
Get the error text associated with the rtr_status_t return value. |
Determine if RTR is running. |
|
Start() |
Start RTR. |
StartWebServer(bool, bool) |
Start RTR on a web server. |
Stop() |
Stop RTR. |
Stop RTR on a web server. |
RTR::CreateJournal();
Prototype
rtr_status_t CreateJournal( bool bSupersede = false);
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_OK |
Normal successful completion. |
RTR_STS_ ILLDEVTYP |
RTR can only create its journal files on directory structured devices. |
Parameters
bSupersede
A boolean attribute that specifies how to handle cases where a journal already exists. Set bSupersede to true to overwrite an existing journal. If set to false, a journal is created only if no journal previously existed.
Description
Call this method to create an RTR journal file. A journal is required for all facility members with a backend role, and any frontends that participate in nested transactions.
For more information on RTR journals, see the RTR Application Design Guide and the RTR System Manager's Manual.
Example
// Declare an RTR object.
RTR *myRTR = new RTR();
rtr_status_t sStatus;
bool bSupersede = false; // false -> no supersede
sStatus = myRTR->CreateJournal(bSupersede);
RTR::DeleteJournal();
Prototype
rtr_status_t DeleteJournal();
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Description/Message |
RTR_STS_OK |
Completed successfully |
Parameters
None
Description
Call this method for deleting a journal.
For more information on RTR journals, see the RTR System Manager's Manual.
Example
// declare an RTR object
RTR *myRTR = new RTR();
rtr_status_t sStatus;
sStatus = myRTR->DeleteJournal();
RTR::GetErrorText();
Prototype
static const char *GetErrorText(rtr_status_t sStatus);
Return Value
Returns a pointer to the error message text associated with a known RTR message.
Parameters
sStatus
The RTR status message return value. RTR_STS_OK is the normal successful completion.
Description
Call this method to retrieve the error message text associated with an RTR status.
Example
// start rtr
RTR myRTR;
sStatus = myRTR.Start();
cout << myRTR.GetErrorText(sStatus) << endl;
// create journal
sStatus = myRTR.CreateJournal(true);
cout << myRTR.GetErrorText(sStatus) << endl;
//An example from the Sample application in the Examples directory
inline void print_status_on_failure(rtr_status_t sStatus)
{
switch (sStatus)
{
case ABCSuccess :
case ABCOrderSucceeded :
case ABCOrderFailed :{
break;
}
default: {
cout << RTR::GetErrorText(sStatus);
break;
};
}
return;
}
RTR::IsRunning();
Prototype
bool IsRunning();
Return Value
Status |
Message |
TRUE |
RTR is running. |
FALSE |
RTR is not running. |
Parameters
None
Description
Call this method to find out if RTR is running on this node. If RTR is running, it will return a true, otherwise an error code.
Example
RTR *myRTR = new RTR();
rtr_status_t sStatus;
sStatus = myRTR->IsRunning();
RTR::RTR();
Prototype
RTR();
Return Value
None
Parameters
None
Description
Call this method to declare an RTR object.
Example
RTR *myRTR = new RTR();
RTR::Start();
Prototype
rtr_status_t Start();
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_ ACPDIED |
The RTR ACP is no longer running, restart RTR. |
RTR_STS_ ACPNOTVIA |
The RTR ACP is no longer a viable entity, restart RTR. |
RTR_STS_ BYTLMNSUFF |
Insufficient process quota bytlm, required 100000. |
RTR_STS_ ERRSTAACP |
Unable to start ACP. |
RTR_STS_ EXWSMAX |
Requested memory quotas exceed the system limit WSMAX. |
RTR_STS_OK |
Normal successful completion. |
Parameters
None
Description
Call this method to start RTR on a node.
Example
// declare RTR object.
RTR *myRTR = new RTR();
rtr_status_t sStatus;
sStatus = myRTR->Start();
RTR::Stop();
Prototype
rtr_status_t Stop();
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Description |
RTR_STS_ ACPDIED |
The RTR ACP is no longer running, restart RTR. |
RTR_STS_OK |
Normal successful completion. |
RTR_STS_ RTRNOTRUN |
RTR not running. |
Parameters
None
Description
Call this method to stop RTR on a node. Calling this method stops all RTR activity on the computer where it is called. Any running applications receive the error indication RTR_STS_NOACP. All facilities, links, and partitions are destroyed.
Example
// declare RTR object
RTR *myRTR = new RTR();
rtr_status_t sStatus;
sStatus = myRTR->Stop();
RTR::StartWebServer();
Prototype
rtr_status_t StartWebServer(bool bAuthentication = true,
bool bReadOnlyAccess = false);
Return Value
rtr_status_t
Interpret value for the success or failure of this call. RTR_STS_OK is the normal successful completion.
Parameters
bAuthentication
A boolean attribute for specifying and controlling the web server user authentication. The default setting is for the server to perform user authentication using the username and password. This may be disabled, allowing anyone with a browser to access the management component.
bReadOnlyAccess
A boolean attribute for specifying read-only access to the web browser RTR management component. A server started with the StartWebServer method servers status and monitor pages but does not permit any changes to be made to the configuration. By specifying read-only access for server operation, no shadowing or journaling is required. The message is still written to the journal but is not played to a shadow and is purged after the transaction is completed on the primary server. The message is still needed in the journal to allow recovery of in-flight transactions.
Description
Call this method to start RTR on a web server. This starts a user's HTTP server component, thus enabling usage of the web browser RTR management component for the calling user.
Example
bool RTR::StartWebServer()
{
bool bOverallResult = true;
RTR MyRTR;
rtr_status_t stsStartWebServer;
stsStartWebServer = MyRTR.StartWebServer();
if (IsFailure(stsStartWebServer == RTR_STS_OK))
{
bOverallResult = false;
OutputStatus(stsStartWebServer);
}
RTR::StopWebServer();
Prototype
rtr_status_t StopWebServer();
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_ NFW |
Operation requires \"SETPRV\" privilege. |
RTR_STS_OK |
Normal successful completion. |
RTR_STS_SRVDISCON |
Server disconnected on node nodename. |
Parameters
None
Description
Call this method to stop RTR on a web server.
Example
rtr_status_t stsStopWebServer;
stsStopWebServer = MyRTR.StopWebServer();
if (IsFailure(stsStopWebServer == RTR_STS_OK || stsStopWebServer == RTR_STS_SRVDISCON))
{ bOverallResult = false;
OutputStatus(stsStopWebServer);
}
This class holds and makes available the properties of its associated RTRPartition object. This allows the RTR application to Get and Set various attributes of an RTR partition. This class may be called by both new C++ API and legacy applications.
RTRBackendPartitionProperties Class Members
Construction
Method |
Description |
RTRBackendPartitionProperties(const char) |
Constructor |
~RTRBackendPartitionProperties(const char) |
Destructor |
Operations
Method |
Description |
GetFacilityName(rtr_facnam_t, const size_t) |
Gets the facility name associated with the RTRPartition object this RTRPartitionProperties object describes. |
GetNumberOfRecoveredTransactions(rtr_uns_32_t) |
Gets the number of recovered transactions associated with the RTRPartition object this RTRPartitionProperties object describes. |
GetPartitionName(rtr_parnam_t, const size_t) |
Gets the partition name associated with the RTRPartition object this RTRPartitionProperties object describes. |
GetRetryCount(rtr_uns_32_t) |
Gets the number of retrys associated with the RTRPartition object this RTRPartitionProperties object describes. |
SetFailoverPolicy(const eRTRFailoverPolicy) |
Defines the policy that RTR should take when a primary partition fails. |
SetPriorityList(const char) |
Sets a relative priority used by RTR when selecting a backend member to make active. |
SetRecoveryRetryCount(rtr_uns_32_t) |
Indicates the maximum number of times that a transaction should be presented for recovery before being written to the journal as an exception. |
RTRBackendPartitionProperties::GetFacilityName();
Prototype
rtr_status_t GetFacilityName(rtr_facnam_t pszFacilityName,
const size_t uiFacilityNameSize);
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_ APPBUFFTOOSMALL |
The application buffer is too small. |
RTR_STS_INVARGPTR |
Invalid parameter address specified on last call. |
RTR_STS_OK |
Normal successful completion. |
Parameters
pszFacilityName
Pointer to a zero-terminated string receiving the facility name for the RTRPartition this RTRPartitionProperties object describes.
uiFacilityNameSize
An unsigned integer for the size of the specified facility name. The maximum string length is RTR_MAX_FACNAM_LEN.
Description
Gets the facility name associated with the RTRPartition object this RTRPartitionProperties object describes.
Example
// declare a partition properties object.
rtr_status_t sStatus;
RTRBackendPartitionProperties *pPartProperties =
PartitionManager.GetBackendPartitionProperties("MyPartition");
char *pszFacilityName = new char[RTR_MAX_FACNAM_LEN+1];
sStatus = pPartProperties->GetFacilityName(pszFacilityName,
RTR_MAX_FACNAM_LEN+1);
GetNumberOfRecoveredTransactions()
RTRBackendPartitionProperties::GetNumberOfRecoveredTransactions();
Prototype
rtr_status_t GetNumberOfRecoveredTransactions(rtr_uns_32_t
&uiNumberRecoveredTxns);
Return Value
rtr_status_t
Interpret value for the success or failure of this call. RTR_STS_OK is the normal successful completion.
Parameters
uiNumberRecoveredTxns
A referenced value of type rtr_uns_32_t which receives the number of recovered transactions.
Description
Gets the number of recovered transactions associated with the RTRPartition object this RTRPartitionProperties object describes.
For more information, see the RTR System Manager's Manual.
Example
// declare a partition properties object.
rtr_status_t sStatus;
RTRBackendPartitionProperties *pPartProperties =
PartitionManager.GetBackendPartitionProperties("MyPartition");
rtr_uns_32_t iNumberRecoveredTxns
sStatus = pPartProperties->
GetNumberOfRecoveredTransactions(iNumberRecoveredTxns);
RTRBackendPartitionProperties::GetPartitionName();
Prototype
rtr_status_t GetPartitionName(rtr_parnam_t pszPartitionName
const size_t uiPartitionNameSize);
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_APPBUFFTOOSMALL |
The application buffer is too small. |
RTR_STS_INVARGPTR |
Invalid parameter address specified on last call. |
RTR_STS_OK |
Normal successful completion. |
Parameters
pszPartitionName
Pointer to a null-terminated string receiving the partition name for the RTRPartition this RTRPartitionProperties object describes.
uiPartitionNameSize
An unsigned integer for the size of the specified partition name.
Description
Gets the partition name associated with the RTRPartition object this RTRPartitionProperties object describes.
Example
// declare a partition properties object.
rtr_status_t sStatus;
RTRBackendPartitionProperties *pPartProperties =
PartitionManager.GetBackendPartitionProperties("MyPartition");
char *pszPartitionName = new char[RTR_MAX_PARNAM_LEN+1];
sStatus = pPartProperties->GetPartitionName(pszPartitionName,
RTR_MAX_PARNAM_LEN+1);
RTRBackendPartitionProperties::GetRetryCount();
Prototype
rtr_status_t GetRetryCount(rtr_uns_32_t &uiRetryCount);
Return Value
rtr_status_t
Interpret value for the success or failure of this call. RTR_STS_OK is the normal successful completion.
Parameters
uiRetryCount
A referenced value of type rtr_uns_32_t which receives the number of retries.
Description
Gets the number of times a transaction has been retried after a failure.
Example
// declare a partition properties object.
rtr_status_t sStatus;
RTRBackendPartitionProperties *pPartProperties = PartitionManager.GetBackendPartitionProperties("MyPartition");
rtr_uns_32_t iRetryCount;
sStatus = pPartProperties->GetRetryCount(iRetryCount);
RTRBackendPartitionProperties()
RTRBackendPartitionProperties::RTRBackendPartitionProperties();
Prototype
RTRBackendPartitionProperties( rtr_const_parnam_t pszPartitionName );
virtual ~RTRBackendPartitionProperties();
Return Value
None
Parameters
pszPartitionName
Pointer to a zero-terminated string containing the partition name for which this RTRPartitionProperties object is being created.
Description
Call this constructor to create an RTRPartitionProperties object for the partition named.
Example
// Create BackendPartitionProperties object
RTRBackendPartitionProperties *pBEPartitionProperties;
pBEPartitionProperties = pPartitionManager->
GetBackendPartitionProperties(GetDefaultPartitionName());
if (IsFailure(pBEPartitionProperties != NULL))
{
bOverallResult = false;
cout << endl << " In Test_GetFacilityName(),
pPartitionManager->GetBackendPartitionProperties()
call failed." << endl;
delete pPartitionManager;
return bOverallResult; }
RTRBackendPartitionProperties::SetFailoverPolicy();
Prototype
rtr_status_t SetFailoverPolicy(const eRTRFailoverPolicy eFailoverPolicy);
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_OK |
Normal successful completion. |
RTR_STS_PRTBADCMD |
Partition command invalid or not implemented in this version of RTR. |
Parameters
eRTRFailoverPolicy
An attribute for specifying an RTR failover policy:
1 = RTRFailOverToShadow
2 = RTRFailOverToStandBy
Description
Determines the action to take when the primary partition fails. The default action is to allow a standby of the primary to become the new primary. Optionally, RTR can be set to change state so that the secondary becomes primary, and a standby of the old primary (if any) becomes the new secondary.
Example
// declare a partition properties object.
rtr_status_t sStatus;
RTRBackendPartitionProperties *pPartProperties =
PartitionManager.GetBackendPartitionProperties("MyPartition");
const RTRFailoverPolicy eFailoverPolicy = RTRFailOverToShadow;
sStatus = pPartProperties->SetFailoverPolicy(eFailoverPolicy);
RTRBackendPartitionProperties::SetPriorityList();
Prototype
rtr_status_t SetPriorityList(const char *pszPriorityList);
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_OK |
Normal successful completion. |
RTR_STS_PRTBADCMD |
Partition command invalid or not implemented in this version of RTR. |
Parameters
pszPriorityList
A null-terminated string pointer to a priority list.
Description
Sets a relative priority used by RTR when selecting a backend member to make active. List backends in your configuration in decreasing order of priority; the order of the list is taken into consideration when RTR decides where to make a partition active.
Suspend partitions before changing the priority list.
Example
// declare a partition properties object.
rtr_status_t sStatus;
RTRBackendPartitionProperties *pPartProperties =
PartitionManager.GetBackendPartitionProperties("MyPartition");
char *pszPriorityList = "depth,length"; // list of BE for prioirty
sStatus = pPartProperties->SetPriorityList(pszPriorityList);
RTRBackendPartitionProperties::SetRecoveryRetryCount();
Prototype
rtr_status_t SetRecoveryRetryCount(rtr_uns_32_t & uiRetryCount);
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_OK |
Normal successful completion. |
RTR_STS_APPBUFFTOOSMALL |
The application buffer is too small. |
Parameters
uiRetryCount
A referenced value of type rtr_uns_32_t that receives the number of retries.
Description
Call this method to set the recovery retry count. The recovery retry count indicates the maximum number of times that a transaction should be presented for recovery before being written to the journal as an exception. Once a transaction has been recorded as an exception, it is no longer considered eligible for recovery and will require manual processing by a qualified individual.
Example
// declare a partition properties object.
rtr_status_t sStatus;
RTRBackendPartitionProperties *pPartProperties =
PartitionManager.GetBackendPartitionProperties("MyPartition");
rtr_uns_32_t iRetryCount=10; // #of times to retry before giveup.
sStatus = pPartProperties->SetRecoveryRetryCount(iRetryCount);
RTRFacilityManager Class Members
Construction
Method |
Description |
Constructor |
|
~RTRFacilityManager() |
Destructor |
Operations
Method |
Description |
AddBackend(rtr_const_facnam_t, rtr_const_nodnam_t) |
Add a backend role to an existing facility. |
AddFrontend(rtr_const_facnam_t, rtr_const_nodnam_t) |
Add a fronted role to an existing facility. |
AddRouter(rtr_const_facnam_t, rtr_const_nodnam_t) |
Add a router role to an existing facility. |
CreateFacility(rtr_const_facnam_t, rtr_const_nodnam_t, rtr_const_nodnam_t, bool) |
Create a facility, designating router and frontend. |
CreateFacility(rtr_const_facnam_t, rtr_const_nodnam_t, rtr_const_nodnam_t, bool, bool) |
Create a facility, designating router and backend. |
CreateFacility(rtr_const_facnam_t, rtr_const_nodnam_t, rtr_const_nodnam_t, rtr_const_nodnam_t, bool, bool) |
Create a facility, designating router, frontend, and backend. |
DeleteFacility(rtr_const_facnam_t) |
Delete a facility. |
GetFacilityProperties(rtr_const_facnam_t, RTRFacilityProperties) |
Retrieve properties for an existing facility. |
RemoveBackend(rtr_const_facnam_t, rtr_const_nodnam_t) |
Remove a backend role from an existing facility. |
RemoveFrontend(rtr_const_facnam_t, rtr_const_nodnam_t) |
Remove a fronted role from an existing facility. |
RemoveRouter(rtr_const_facnam_t, rtr_const_nodnam_t) |
Remove a router role from an existing facility. |
RTRFacilityManager::AddBackend();
Prototype
rtr_status_t AddBackend( rtr_const_facnam_t pszFacilityName,
rtr_const_nodnam_t pszBackend );
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_ENOIPNAM |
Entered node name does not exist. |
RTR_STS_INVBCKENDNAMARG |
The backend name argument is invalid. |
RTR_STS_INVFACNAMEARG |
The facility name argument is invalid. |
RTR_STS_NOSUCHFAC |
No such facility. |
RTR_STS_OK |
Normal successful completion. |
RTR_STS_RTRNOTSTA |
RTR not started. |
Parameters
pszFacilityName
A null-terminated pointer to a facility name.
pszBackend
A pointer to a null-terminated string containing the nodename to add as a backend (BE).
Description
Call this method to extend a backend to a facility. Facility name and backend node names should not be null values. A node does not have to be reachable but must be valid or RTR returns RTR_STS_ENOIPNAM.
The Backend parameter can be a comma-separated list of nodenames.
Example
// Add a Backend
rtr_status_t stsAddBackend;
stsAddBackend = pFacilityManager->AddBackend("AddBackend",
m_psTest_ExtraNodeName);
if ( IsFailure( stsAddBackend == RTR_STS_OK ) )
{
bOverallResult = false;
OutputStatus( stsAddBackend );
}
RTRFacilityManager::AddFrontend();
Prototype
rtr_status_t AddFrontend( rtr_const_facnam_t pszFacilityName,
rtr_const_nodnam_t pszFrontend );
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_ENOIPNAM |
Entered node name does not exist. |
RTR_STS_INVFACNAMEARG |
The facility name argument is invalid. |
RTR_STS_INVFRNTENDNMARG |
The frontend name argument is invalid. |
RTR_STS_NOROUTERS |
No routers. |
RTR_STS_NOSUCHFAC |
No such facility. |
RTR_STS_OK |
Normal successful completion. |
RTR_STS_RTRNOTSTA |
RTR not started. |
Parameters
pszFacilityName
A null-terminated pointer to a facility name.
pszFrontend
A pointer to a null-terminated string containing the nodename to add as a frontend (FE).
Description
Call this method to extend a frontend node for a facility. Facility names and node names should not be null values.
The Frontend parameter can be a comma-separated list of nodenames.
Example
char *pszFacilityName = "Myfacility";
char *pszNodeName = "FENodeNamesSeparatedbyComma";
sStatus = myFac-> AddFrontend (pszFacilityName,l_ pszNodeName);
RTRFacilityManager::AddRouter();
Prototype
rtr_status_t AddRouter( rtr_const_facnam_t pszFacilityName,
rtr_const_nodnam_t pszRouter );
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_FACEXTENDED |
Router added successfully. |
RTR_STS_INVFACNAMEARG |
The facility name argument is invalid. |
RTR_STS_INVROUTRNAMEARG |
The router name argument is invalid. |
RTR_STS_NOSUCHFAC |
No such facility. |
RTR_STS_OK |
Normal successful completion. |
RTR_STS_RTRNOTSTA |
RTR not started. |
Parameters
pszFacilityName
A null-terminated pointer to a facility name.
pszRouter
A null-terminated pointer to a facility member with a router (TR) role.
Description
Call this method to extend a router for a facility. Facility name and node names should not be null values.
Example
char *pszFacilityName = "Myfacility";
char *pszNodeName = "FENodeNamesSeparatedbyComma";
sStatus = myFac-> AddRouter (pszFacilityName,l_ pszNodeName);
RTRFacilityManager::CreateFacility();
Prototype
rtr_status_t CreateFacility( rtr_const_facnam_t pszFacilityName,
rtr_const_nodnam_t pszRouter,
rtr_const_nodnam_t pszFrontend,
bool bEnableRouterCallout);
rtr_status_t CreateFacility( rtr_const_facnam_t pszFacilityName,
rtr_const_nodnam_t pszRouter,
rtr_const_nodnam_t pszBackend,
bool bEnableRouterCallout,
bool bEnableBackendCallout );
rtr_status_t CreateFacility( rtr_const_facnam_t pszFacilityName,
rtr_const_nodnam_t pszRouter,
rtr_const_nodnam_t pszFrontend,
rtr_const_nodnam_t pszBackend,
bool bEnableRouterCallout,
bool bEnableBackendCallout);
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_DUPNODNAM |
Duplicate node names in list |
RTR_STS_INVBCKENDNAMARG |
The backend name argument is invalid. |
RTR_STS_INVFACNAMEARG |
The facility name argument is invalid. |
RTR_STS_INVFRNTENDNMARG |
The frontend name argument is invalid. |
RTR_STS_INVROUTRNAMEARG |
The router name argument is invalid. |
RTR_STS_NOBACKEND |
No backend specified in facility |
RTR_STS_NOFRONTEN |
No frontend specified in facility |
RTR_STS_NOROUTERS |
No routers specified in facility |
RTR_STS_OK |
Normal successful completion |
RTR_STS_OWNNODMIS |
Executing node is not specified as Frontend ,router or backend |
RTR_STS_JOUNOTFOU |
Journal file not found |
Parameters
pszFacilityName
A null-terminated pointer to a facility name.
pszRouter
A null-terminated pointer to a facility member with a router (TR) role.
pszFrontend
A null-terminated pointer to a facility member with a frontend (FE) role.
pszBackend
A null-terminated pointer to a facility member with a backend (BE) role.
bEnableRouterCallout
A boolean attribute for specifying a callout router.
bEnableBackendCallout
A boolean attribute for specifying a callout backend.
Description
Call this method to create a facility. There are three versions of the CreateFacility method. One version designates router, frontend, and backend nodes. One version designates router and frontend nodes. One version designates router and backend nodes. For these last two versions, the CreateFacility method requires the router name to be non-local.
For example, the following two calls would succeed:
stsCreateFacility
pFacilityManager->CreateFacility("FacilityWithoutBackend",
"router_nonlocal_nodename",
"frontend_local_nodename",
true);
stsCreateFacility
pFacilityManager->CreateFacility("FacilityWithoutFrontend",
"router_nonlocal_nodename",
"backend_local_nodename",
true);
These two calls would return the RTR_STS_XXX errors indicated:
stsCreateFacility
pFacilityManager->CreateFacility("FacilityWithoutBackend",
"router_local_nodename",
"frontend_local_nodename",
true);
NOBACKEND
No backends specified
Explanation: No backends were specified on a "CREATE FACILITY" command and the node where the command was executed was specified as being a router. This error message is displayed by the RTR utility.
stsCreateFacility
pFacilityManager->CreateFacility("FacilityWithoutFrontend",
"router_local_nodename",
"backend_local_nodename",
true);
NOFRONTEN
No frontends specified
Explanation: No frontends were specified on a "CREATE FACILITY" command and the node where the command was executed was specified as being a router. This error message is displayed by the RTR utility.
Example
RTRFacilityManager::CreateFacilityWithAllRoles_3()
{
bool bOverallResult = true;
//Create facility manager, abort if fails
RTRFacilityManager * pFacilityManager;
pFacilityManager = new RTRFacilityManager;
if ( IsFailure(pFacilityManager != NULL) )
{
return false;
}
// Create the facility
rtr_status_t stsCreateFacility;
stsCreateFacility =
pFacilityManager->CreateFacility("FacilityWithAllRoles_3",
GetDefaultRouterName(),
GetDefaultFrontendName(),
GetDefaultBackendName(),
true,
false);
// If facility creation is not successful, report it
if ( IsFailure( stsCreateFacility == RTR_STS_OK ) )
{
bOverallResult = false;
OutputStatus( stsCreateFacility );
}
else // Delete a successfully created facility
{
rtr_status_t stsDeleteFacility;
stsDeleteFacility =
pFacilityManager->DeleteFacility("FacilityWithAllRoles_3");
if ( IsFailure( stsDeleteFacility == RTR_STS_OK ) )
{
bOverallResult = false;
OutputStatus( stsDeleteFacility );
}
}
// Cleanup and return
delete pFacilityManager;
return bOverallResult;
}
An example from the Sample application in the Examples directory:
inline rtr_status_t CreateFacility()
{
// Create a Facility
rtr_status_t sStatus;
RTRFacilityManager FacilityManager;
// Get the local node name to create the facility.
char nodename[ABCMAX_STRING_LEN];
gethostname(&nodename[0],ABCMAX_STRING_LEN);
// Create the facility specifying that the local node has all roles.
sStatus = FacilityManager.CreateFacility(ABCFacility,nodename,nodename,
nodename,true,false);
print_status_on_failure(sStatus);
return sStatus;
}
For more information on creating a facility, see the RTR System Manager's Manual.
RTRFacilityManager::DeleteFacility();
Prototype
rtr_status_t DeleteFacility( rtr_const_facnam_t pszFacilityName );
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_FACDELETE |
Facility deleted successfully. |
RTR_STS_INVFACNAMEARG |
The facility name argument is invalid. |
RTR_STS_NOSUCHFAC |
No such facility available. |
RTR_STS_OK |
Normal successful completion. |
RTR_STS_RTRNOTSTA |
RTR not started. |
Parameters
pszFacilityName
A null-terminated pointer to a facility name.
Description
Call this method to delete a facility. This does not clean out the journal; transactions that are to be processed stay in the journal. However, the facility must be recreated before you can process the transactions stored in the journal.
For more information on creating a facility, see the RTR System Manager's Manual.
Example
rtr_status_t sStatus;
char *pszFacilityName = "Myfacility";
sStatus = myFac->DeleteFacility(pszFacilityName);
RTRFacilityManager::GetFacilityProperties();
Prototype
rtr_status_t GetFacilityProperties( rtr_const_facnam_t pszFacilityName,
RTRFacilityProperties *&pFacProp);
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_INVFACNAMEARG |
The facility name argument is invalid. |
RTR_STS_INVFACPROPPTARG |
Invalid facility properties object pointer argument. |
RTR_STS_INVSTRINGPTRARG |
The string pointer argument is invalid - string too long. |
RTR_STS_OK |
Normal successful completion |
Parameters
pszFacilityName
A null-terminated pointer to a facility name.
pFacProp
Pointer to properties for a given facility.
Description
Retrieve properties for an existing facility. Caller must delete pFacProp later.
Example
// Create a FacilityProperties object to get the properties from.
RTRFacilityProperties *pFacilityProperties =
new RTRFacilityProperties("GetFacilityProperties");
if ( IsFailure(pFacilityProperties != NULL) )
{
//Can't continue, so cleanup and return
delete pFacilityManager;
return false;
}
rtr_status_t stsGetFacilityProperties;
stsGetFacilityProperties =
pFacilityManager->GetFacilityProperties("GetFacilityProperties",
pFacilityProperties);
if ( IsFailure( stsGetFacilityProperties == RTR_STS_OK ) )
{
bOverallResult = false;
OutputStatus( stsGetFacilityProperties );
}
RTRFacilityManager::RemoveBackend();
Prototype
rtr_status_t RemoveBackend( rtr_const_facnam_t pszFacilityName,
rtr_const_nodnam_t pszBackend );
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_INVBCKENDNAMARG |
The backend name argument is invalid. |
RTR_STS_INVFACNAMEARG |
The facility name argument is invalid. |
RTR_STS_INVFACPROPPTARG |
Invalid facility properties object pointer argument. |
RTR_STS_NOBACKEND |
No more backends are available in this facility. |
RTR_STS_ NOSUCHFAC |
No such facility available. |
RTR_STS_OK |
Normal successful completion. |
RTR_STS_RTRNOTSTA |
RTR is not started. |
Parameters
pszFacilityName
A null-terminated pointer to a facility name.
pszBackend
A null-terminated pointer to a facility member with a backend (BE) role.
Description
Call this method to remove backend nodes from a facility.
Example
rtr_status_t sStatus;
char *pszFacilityName = "MyFacilityName";
char *pszNodeName = "BENodeNamesSeparatedbyComma";
sStatus = myFac->RemoveBackend(pszFacilityName,pszNodeName);
RTRFacilityManager::RemoveFrontend();
Prototype
rtr_status_t RemoveFrontend( rtr_const_facnam_t pszFacilityName,
rtr_const_nodnam_t pszFrontend );
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_INVFACNAMEARG |
The facility name argument is invalid. |
RTR_STS_INVFRNTENDNMARG |
The frontend name argument is invalid. |
RTR_STS_ NOSUCHFAC |
No such facility available. |
RTR_STS_OK |
Normal successful completion. |
RTR_STS_RTRNOTSTA |
RTR is not started. |
Parameters
pszFacilityName
A null-terminated pointer to a facility name.
pszFrontend
A null-terminated pointer to a facility member with a frontend (FE) role.
Description
Call this method to remove frontend nodes from a facility.
Example
rtr_status_t sStatus;
char *pszFacilityName = "MyFacilityName";
char *pszNodeName = "FENodeNamesSeparatedbyComma";
sStatus = myFac-> RemoveFrontend (pszFacilityName,pszNodeName);
RTRFacilityManager::RemoveRouter();
Prototype
rtr_status_t RemoveRouter( rtr_const_facnam_t pszFacilityName,
rtr_const_nodnam_t pszRouter );
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_INVFACNAMEARG |
The facility name argument is invalid. |
RTR_STS_INVROUTRNAMEARG |
The router name argument is invalid. |
RTR_STS_NOROUTERS |
No more routers are available in this facility. |
RTR_STS_ NOSUCHFAC |
No such facility available. |
RTR_STS_OK |
Normal successful completion. |
RTR_STS_RTRNOTSTA |
RTR is not started. |
Parameters
pszFacilityName
A null-terminated pointer to a facility name.
pszRouter
A null-terminated pointer to a facility member with a router (TR) role.
Description
Call this method to remove router nodes from a facility.
Example
rtr_status_t sStatus;
char *pszFacilityName = "MyFacilityName";
char *pszNodeName = "TRNodeNamesSeparatedbyComma";
sStatus = myFac-> RemoveRouter (pszFacilityName,pszNodeName);
RTRFacilityManager::RTRFacilityManager();
Prototype
RTRFacilityManager();
virtual ~RTRFacilityManager();
Return Value
None
Parameters
None
Description
Use this method to declare a facility manager object. Facility manager object should be declared for accessing any properties of a facility.
Example
RTRFacilityManager *myFac = new RTRFacilityManager();
RTRFacilityMember Class Members
Construction
Method |
Description |
RTRFacilityMember(rtr_const_facnam_t, rtr_const_nodnam_t, const eRTRMemberRoleType) |
Constructor |
~RTRFacilityMember() |
Destructor |
Operations
Method |
Description |
GetName(rtr_facnam_t, const size_t) |
Retrieve the name of the facility member. |
HasBackendRole(bool) |
Determine if this facility member has a backend role. |
HasFrontendRole(bool) |
Determine if this facility member has a frontend role. |
HasRouterRole(bool) |
Determine if this facility member has a router role. |
IsConnectedToLocalNode(bool) |
Determine if this facility member has connectivity to the local node. |
IsLocalNode(bool) |
Determine if this facility is the local node. |
RTRFacilityMember::GetName();
Prototype
rtr_status_t GetName( rtr_facnam_t pszFacilityName, const size_t uiFacilityNameSize);
Return Value
rtr_status_t
Parameters
pszFacilityName
A pointer to a facility name.
uiFacilityNameSize
An unsigned integer for the facility name size.
Description
Retrieve the name of the facility member.
Example
#define MAX_FACNAME 256
char szFacName[MAX_FACNAME];
rtr_status_t stsGetName = FacMember.GetName(szFacName, MAX_FACNAME);
if (IsFailure(stsGetName == RTR_STS_OK))
{
cout << " RTRFacilityMember::GetName failed\n";
OutputStatus(stsGetName);
}
else
{...
RTRFacilityMember::HasBackendRole();
Prototype
rtr_status_t HasBackendRole(bool &bHasRole);
Return Value
rtr_status_t
Interpret value for the success or failure of this call. RTR_STS_OK is the normal successful completion.
Parameters
bHasRole
A boolean that is true or false for HasBackendRole.
Description
Call this method to find out a node is configured as backend.
Example
rtr_status_t stsHasRole;
bool bHasRole;
stsHasRole = FacMember.HasBackendRole(bHasRole);
if ( IsFailure( stsHasRole == RTR_STS_OK ) )
{
bOverallResult = false;
OutputStatus( stsHasRole );
}
bOverallResult = (bHasRole == true);
RTRFacilityMember::HasFrontendRole();
Prototype
rtr_status_t HasFrontendRole(bool &bHasRole);
Return Value
rtr_status_t
Interpret value for the success or failure of this call. RTR_STS_OK is the normal successful completion.
Parameters
bHasRole
A boolean that is true or false for HasFrontendRole.
Description
Call this method to find out if a node is configured as frontend.
Example
rtr_status_t stsHasRole;
bool bHasRole;
stsHasRole = FacMember.HasFrontendRole(bHasRole);
if ( IsFailure( stsHasRole == RTR_STS_OK ) )
{
bOverallResult = false;
OutputStatus( stsHasRole );
}
bOverallResult = (bHasRole == true);
RTRFacilityMember::HasRouterRole();
Prototype
rtr_status_t HasRouterRole(bool &bHasRole);
Return Value
rtr_status_t
Interpret value for the success or failure of this call. RTR_STS_OK is the normal successful completion.
Parameters
bHasRole
A boolean that is true or false for HasRouterRole.
Description
Call this method to find out if a node is configured as router.
Example
rtr_status_t stsHasRole;
bool bHasRole;
stsHasRole = FacMember.HasRouterRole(bHasRole);
if ( IsFailure( stsHasRole == RTR_STS_OK ) )
{
bOverallResult = false;
OutputStatus( stsHasRole );
}
bOverallResult = (bHasRole == true);
RTRFacilityMember::IsConnectedToLocalNode();
Prototype
rtr_status_t IsConnectedToLocalNode(bool &bIsConnected);
Return Value
rtr_status_t
Interpret value for the success or failure of this call. RTR_STS_OK is the normal successful completion.
Parameters
bIsConnected
A boolean that is true if the node is connected to the local node.
Description
Call this method to find out if this node is connected to the local node.
Example
bool bIsConnected;
rtr_status_t stsIsConnected;
stsIsConnected = FacMember.IsConnectedToLocalNode(bIsConnected);
if (IsFailure(stsIsConnected == RTR_STS_OK))
{
OutputStatus(stsIsConnected);
bOverallResult = false;
}
if (IsFailure(bIsConnected == true))
{
cout << " RTRFacilityMember::IsConnectedToLocalNode failed\n";
bOverallResult = false;
}
RTRFacilityMember::IsLocalNode();
Prototype
rtr_status_t IsLocalNode(bool &bIsLocal);
Return Value
rtr_status_t
Interpret value for the success or failure of this call. RTR_STS_OK is the normal successful completion.
Parameters
bIsLocal
A boolean that is true if the node is a local node.
Description
Call this method to find out if the node is a local node.
Example
rtr_status_t stsIsLocal;
bool bIsLocalNode;
stsIsLocal = FacMember.IsLocalNode(bIsLocalNode);
if (IsFailure(stsIsLocal == RTR_STS_OK))
{
OutputStatus(stsIsLocal);
bOverallResult = false;
}
if (IsFailure(bIsLocalNode == true))
{
cout << " RTRFacilityMember::IsLocalNode failed\n";
bOverallResult = false;
}
RTRFacilityMember::RTRFacilityMember();
Prototype
RTRFacilityMember( rtr_const_facnam_t pszFacilityName,
rtr_const_nodnam_t pszMemberName);
virtual ~RTRFacilityMember();
Return Value
None
Parameters
pszFacilityName
A null-terminated pointer to a facility name.
pszMemberName
A null-terminated string pointer to the name of a facility member.
Description
Call this method to declare a facility member object. The member role type can be:
Example
Char *pszFac = "Myfacility";
Char *pszNode ="NodeName";
RTRFacilityMember *FacilityMember =
new RTRFacilityMember(pszFac,pszNode);
An RTRFacilityMemberArray object contains pointers to array elements.
Note
The RTRFacilityMemberArray class requires the holder of the array to clean up the objects pointed to by the elements of the array. The array does not clean up these objects.
RTRFacilityMemberArray
Class MembersConstruction
Method |
Description |
Constructor |
|
~RTRFacilityMemberArray() |
Destructor |
Operations
Method |
Description |
Add(RTRFacilityMember) |
Adds a pointer to an RTRFacility member to the array. |
Clear() |
Clears elements of the array. |
Insert(size_t, RTRFacilityMember) |
Inserts a pointer to an RTRFacility member. |
operator[] (size_t) |
Returns an element of the array which is a pointer to an RTRFacility member. |
Remove(const size_t) |
Removes an element of the array. |
Size(const) |
Returns the number of elements in the array. |
RTRFacilityMemberArray::Add();
Prototype
bool Add(RTRFacilityMember* pFacMember);
Return Value
True or False
Parameters
pFacMember
A pointer to a facility member.
Description
Add a member to a facility member array by adding a pointer to an RTRFacility member. The caller is responsible for creating and destroying the actual object. The array destructor does not destroy the objects pointed to.
Example
bool RTRFacilityMemberArray::Add()
{
bool bArrayAddStatus;
RTRFacilityMemberArray ar;
RTRFacilityMember* pFacMember;
pFacMember = new RTRFacilityMember(GetDefaultFacilityName(),
GetDefaultRouterName());
if (IsFailure(pFacMember != NULL))
{
cout << " new RTRFacilityMember failed.\n";
return false;
}
bArrayAddStatus = ar.Add(pFacMember);
if (IsFailure(bArrayAddStatus))
{
cout << " RTRFaclityMemberArray::Add failed\n";
}
return bArrayAddStatus;
}
RTRFacilityMemberArray::Clear();
Prototype
bool Clear();
Return Value
True or False
Parameters
None
Description
This method clears the elements of the array, resulting in the array having a size of zero. This method does not destroy the objects pointed to; the caller must delete the contents.
Example
bool bArrayClearStatus = ar.Clear();
if (IsFailure(bArrayClearStatus))
{
cout << " RTRFacilityMemberArray::Clear failed\n";
}
return bArrayClearStatus;
RTRFacilityMemberArray::Insert();
Prototype
bool Insert(size_t n, RTRFacilityMember* pFacMember);
Return Value
True or False
Parameters
n
The element in the array (ar[0] is the first element). The element is a pointer to an object.
pFacMember
A pointer to a facility member.
Description
This method inserts a pointer to an RTRFacility member into the Nth position, moving the remainder of the array to make room.
Example
bool bArrayInsertStatus;
bArrayInsertStatus = ar.Insert(1, pFacMember);
if (IsFailure(bArrayInsertStatus))
{
cout << " RTRFacilityMemberArray::Insert failed\n";
}
return bArrayInsertStatus;
RTRFacilityMemberArray::operator();
Prototype
RTRFacilityMember*& operator[] (size_t n);
Return Value
Pointer to the Nth element of the array.
Parameters
n
The element in the array (ar[0] is the first element). The element is a pointer to an object.
Description
This operator returns the Nth element of the array which is a pointer to an RTRFacility member. You can also use this operator to set the Nth element of the array.
The existing element pointed to is not destroyed; the caller must delete the contents.
Example
RTRFacilityMemberArray array;
RTRFacilityMember* pFacMember;
pFacMember = array[1];
if (IsFailure(pFacMember != NULL))
{
cout << " RTRFacilityMemberArray operator[] failed\n";
}
return pFacMember != NULL;
RTRFacilityMemberArray::Remove();
Prototype
bool Remove (const size_t n);
Return Value
True or False
Parameters
n
The element in the array (ar[0] is the first element). The element is a pointer to an object.
Description
This method removes the Nth element of the array. This does not destroy the object pointed to; the caller must delete the contents.
Example
bool bArrayRemoveStatus;
bArrayRemoveStatus = ar.Remove(1);
if (IsFailure(bArrayRemoveStatus))
{
cout << " RTRFacilityMemberArray::Remove failed\n";
}
return bArrayRemoveStatus;
RTRFacilityMemberArray::RTRFacilityMemberArray();
Prototype
RTRFacilityMemberArray();
virtual ~RTRFacilityMemberArray;
Return Value
None
Parameters
None
Description
Construct an RTRFacilityMemberArray object.
Example
RTRFacilityMemberArray::RTRFacilityMemberArray()
{
}
RTRFacilityMemberArray::Size();
Prototype
size_t Size() const;
Return Value
size_t
Parameters
None
Description
The method returns the number of elements in the array.
Example
size_t nArraySize = ar.Size();
if (IsFailure(nArraySize == 1))
{
cout << " RTRFacilityMemberArray::Size failed\n";
}
return nArraySize == 1;
RTRFacilityProperties Class Members
Construction
Method |
Description |
RTRFacilityProperties(rtr_const_facnam_t) |
Constructor |
~RTRFacilityProperties |
Destructor |
Operations
Method |
Description |
GetMemberList(RTRFacilityMemberArray) |
Retrieves a list of nodes and their roles for an existing facility. |
SetBalance(bool) |
Allows intelligent reconnection of frontend to routers according to the number of connections on each active router. |
RTRFacilityProperties::GetMemberList();
Prototype
rtr_status_t GetMemberList(RTRFacilityMemberArray &aFacilityMembers);
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_OK |
Normal successful completion. |
RTR_STS_DATANOTAVAILABL |
Member list data not available. |
Parameters
aFacilityMembers
An array listing a facility's members.
Description
Retrieve a list of nodes and their roles for an existing facility.
Example
rtr_status_t stsGetMemberList;
RTRFacilityMemberArray arFacMembers;
stsGetMemberList = FacProps.GetMemberList(arFacMembers);
if (IsFailure(stsGetMemberList == RTR_STS_OK))
{
bOverallResult = false;
OutputStatus(stsGetMemberList);
}
int nNbrFacMembers = arFacMembers.Size();
for (int i=0; i<nNbrFacMembers; i++)
{
delete arFacMembers[i];
}
CleanupRTR();
return bOverallResult;
RTRFacilityProperties::RTRFacilityProperties();
Prototype
RTRFacilityProperties( rtr_const_facnam_t pszFacilityName);
virtual ~RTRFacilityProperties();
Return Value
None
Parameters
pszFacility
A null-terminated pointer to a facility name.
Description
This method retrieves the properties associated with the facility object.
Example
char *pszFacility = "Myfacilityname";
RTRFacilityProperties *FacilityPropterties = new
RTRFacilityProperties(pszFacility);
RTRFacilityProperties::SetBalance();
Prototype
rtr_status_t SetBalance( bool bBalancingOn );
Return Value
rtr_status_t
Interpret value for the success or failure of this call. RTR_STS_OK is the normal successful completion.
Parameters
bBalancingOn
A boolean attribute for specifying RTR balancing of client requests for server processing.
Description
Specifies whether router balancing is to be performed.
Example
rtr_status_t sStatus;
char *pszFacilityName= "MyfacilityName";
bool bBalanceON = true;
sStatus = MyFacilityProperties->SetBalance(bBalanceOn);
A key segment describes the data that the RTR application is sending. RTR uses this description for routing the data to an appropriate server. Key segments are of no value unless they are associated with a partition. When creating a partition, the caller is allowed to specify one or more key segments.
The RTRKeySegment class defines key segments (ranges) used in defining RTRPartition objects. RTRPartition objects are used to enable the partitioning of data across multiple servers.
Construction
Method |
Description |
RTRKeySegment(rtr_keyseg_type_t, rtr_keylen_t, rtr_keylen_t, rtr_const_pointer_t, rtr_const_pointer_t) |
Constructor |
~ RTRKeySegment() |
Destructor |
Operations
Method |
Description |
Gets the upper bound of the key range for the key segment. |
|
Gets the length of the key segment key. |
|
Gets the lower bound of the key range for the key segment. |
|
Gets the offset of the key segment key. |
|
Gets the type of the key segment. |
|
SetKeySegmentHighValue(rtr_const_pointer_t) |
Sets the upper bound of the key range for the key segment. |
SetKeySegmentLength(const rtr_keylen_t) |
Sets the length of the key segment key. |
SetKeySegmentLowValue(rtr_const_pointer_t) |
Sets the lower bound of the key range for the key segment. |
SetKeySegmentOffset(const rtr_keylen_t) |
Sets the offset of the key segment key. |
SetKeySegmentType(const rtr_keyseg_type_t) |
Sets the type of the key segment. |
RTRKeySegment::GetKeySegmentHighValue();
Prototype
rtr_pointer_t GetKeySegmentHighValue();
Return Value
rtr_pointer_t
Pointer to the returned upper-bound key value.
Parameters
None
Description
This method returns the upper-bound key value of the key segment.
Example
RTRKeySegment CharacterStringSegment.GetKeySegmentHighValue();
RTRKeySegment::GetKeySegmentLength();
Prototype
rtr_keylen_t GetKeySegmentLength();
Return Value
rtr_keylen_t
The returned value is the length of the key segment.
Parameters
None
Description
This method gets the length of the key segment key.
Example
rtr_keylen_t keylength =
CharacterStringSegment.GetKeySegmentLength();
RTRKeySegment::GetKeySegmentLowValue();
Prototype
rtr_pointer_t GetKeySegmentLowValue();
Return Value
rtr_pointer_t
Pointer to the returned lower-bound key value.
Parameters
None
Description
This method returns the lower-bound key value of the key segment.
Example
rtr_keylen_t keylength =
CharacterStringSegment.GetKeySegmentLowValue();
RTRKeySegment::GetKeySegmentOffset();
Prototype
rtr_keylen_t GetKeySegmentOffset();
Return Value
rtr_keylen_t
The returned value is the offset of the key value.
Parameters
None
Description
This method gets the offset of the key segment key within the message stream.
Example
rtr_keylen_t keylength =
CharacterStringSegment.GetKeySegmentOffset();
RTRKeySegment::GetKeySegmentType();
Prototype
rtr_keyseg_type_t GetKeySegmentType();
Return Value
rtr_keyseg_type_t
One of the values of type rtr_keyseg_type_t, that can be:
Parameters
None
Description
This method gets the data type of the key segment.
Example
rtr_keylen_t keylength = CharacterStringSegment.GetKeySegmentType();
RTRKeySegment::RTRKeySegment();
Prototype
RTRKeySegment
(rtr_keyseg_type_t keySegmentType,rtr_keylen_t keySegmentLength,
rtr_keylen_t keySegmentOffset,
rtr_const_pointer_t pKeySegmentLowValue,
rtr_const_pointer_t pKeySegmentHighValue );
virtual ~RTRKeySegment();
Return Value
None
Parameters
keySegmentType
One of the values of type rtr_keyseg_type_t, that can be one of the following:
keySegmentLength
A numerical length value in bytes of type rtr_keylen_t.
Default = 4
keySegmentOffset
A numerical offset value in bytes of type rtr_keylen_t.
Default = 0.
pKeySegmentLowValue
A pointer of type rtr_pointer_t to a lower-bound key value of type rtr_keyseg_type_t.
Default = NULL.
PKeySegmentHighValue
A pointer of type rtr_pointer_t to an upper-bound key value of type rtr_keyseg_type_t.
Default = NULL.
Description
Call this constructor to create an RTRKeySegment object.
Example
void ClassDerivedFromHandler::StartProcessingOrdersAtoL( )
{
// This function defines a key segment and calls StartProcessingOrders to process all orders that have a ticker symbol beginning with the letters A-L.
// Create a KeyRange
m_pkeyRange = new RTRKeySegment( rtr_keyseg_string,
1,
OffsetIntoApplicationProtocol,
"A",
"L" );
StartProcessingOrders(PARTITION_NAMEAToL,m_pkeyRange);
}
RTRKeySegment::SetKeySegmentHighValue();
Prototype
rtr_status_t SetKeySegmentHighValue(rtr_const_pointer_t pKeySegmentHighValue );
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_OK |
Normal successful completion. |
RTR_STS_INVKYSGVLPTARG |
Invalid key segment value pointer argument. |
Parameters
pKeySegmentHighValue
Pointer to the upper bound key value to be set.
Description
This method sets the upper bound of the key range for the key segment.
Example
rtr_keyseg_type_t PKeySegmentHighValue = L;
CharacterStringSegment.SetKeySegmentHighValue(KeySegmentHighValue);
RTRKeySegment::SetKeySegmentLength();
Prototype
rtr_status_t SetKeySegmentLength(const rtr_keylen_t keySegmentLength );
Return Value
rtr_status_t
Interpret value for the success or failure of this call. RTR_STS_OK is the normal successful completion.
Parameters
keySegmentLength
This parameter holds the key length value of type rtr_keylen_t to be set.
Description
This method sets the length of the keysegment key.
Example
rtr_keylen_t keylength = 1;
CharacterStringSegment.SetKeySegmentLength(keylength);
RTRKeySegment::SetKeySegmentLowValue();
Prototype
rtr_status_t SetKeySegmentLowValue(rtr_const_pointer_t pKeySegmentLowValue);
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_OK |
Normal successful completion. |
RTR_STS_INVKYSGVLPTARG |
Invalid key segment value pointer argument. |
Parameters
pKeySegmentLowValue
Pointer to the lower-bound key value to be set.
Description
This method sets lower bound of the key range for the key segment.
Example
rtr_keyseg_type_t PKeySegmentLowValue = A;
CharacterStringSegment.SetKeySegmentLowValue(KeySegmentLowValue);
RTRKeySegment::SetKeySegmentOffset();
Prototype
rtr_status_t SetKeySegmentOffset( const rtr_keylen_t keySegmentOffset );
Return Value
rtr_status_t
Interpret value for the success or failure of this call. RTR_STS_OK is the normal successful completion.
Parameters
keySegmentOffset
This parameter holds the key segment key offset of type rtr_keylen_t.
Description
This method sets the offset of the key segment key within the message stream.
Example
rtr_keylen_type_t PKeySegmentOffset = ;
CharacterStringSegment.SetKeySegmentOffset(KeySegmentOffset);
RTRKeySegment::SetKeySegmentType();
Prototype
rtr_status_t SetKeySegmentType( const rtr_keyseg_type_t keySegmentType);
Return Value
rtr_status_t
Interpret value for the success or failure of this call. RTR_STS_OK is the normal successful completion.
Parameters
keySegmentType
One of the values of type rtr_keyseg_type_t, that can be one of the following:
Description
This method sets the data type of the key segment.
Example
rtr_status_t stsSetKeySegmentType;
rtr_keyseg_type_t NewType = rtr_keyseg_string;
stsSetKeySegmentType = KeySeg.SetKeySegmentType(NewType);
if (IsFailure(stsSetKeySegmentType == RTR_STS_OK))
{
bOverallResult = false;
}
rtr_keyseg_type_t CurrType;
CurrType = KeySeg.GetKeySegmentType();
if (IsFailure(CurrType == NewType))
{
bOverallResult = false;
cout << " RTRKeySegment::Set/GetKeySegmentType failed.\n";
}
return bOverallResult;
An RTRKeySegmentArray object contains pointers to array elements.
Note
The RTRKeySegmentArray class requires the holder of the array to clean up (delete) the objects pointed to by the elements of the array; the array does not clean up these objects (does not delete the contents of the array).
RTRKeySegment Class Members
Construction
Method |
Description |
Constructor |
|
~ RTRKeySegment() |
Destructor |
Operations
Method |
Description |
Add(RTRKeySegment) |
Add a pointer to the array. |
Clear() |
Clear the elements of the array. |
Insert(size_t, RTRKeySegment) |
Insert a pointer to an RTRKeySegment member. |
Remove() |
Remove an element of the array. |
RTRKeySegment operator( size_t) |
Return an element of the array which will be a pointer to an RTRKeySegment member. |
Size() |
Return the number of elements in the array. |
RTRKeySegmentArray::Add();
Prototype
bool Add(RTRKeySegment* pFacMember);
Return Value
True or False
Parameters
pFacMember
Pointer to a facility member.
Description
Add a pointer to an RTRKeySegment member to the array. The caller is responsible for creating and destroying the actual object. The array destructor does not destruct the objects pointed to.
Example
bool RTRKeySegmentArray::Add ()
{
bool bArrayAddStatus;
RTRKeySegmentArray ar;
RTRKeySegment* pKeySeg;
unsigned low=0;
unsigned high=10000;
pKeySeg = new RTRKeySegment(rtr_keyseg_unsigned, sizeof(unsigned),
0, &low, &high);
if (IsFailure(pKeySeg != NULL))
return false;
bool bAddOk = ar.Add(pKeySeg);
if (IsFailure(bAddOk == true))
{
delete pKeySeg;
return false;
}
delete pKeySeg;
return true;
}
RTRKeySegmentArray::Clear();
Prototype
bool Clear();
Return Value
True or False
Parameters
None
Description
This method clears the elements of the array, resulting in the array having a size of zero. The Clear method does not destroy the objects pointed to.
Example
bool RTRKeySegmentArray::Clear ()
{
bool bArrayAddStatus;
RTRKeySegmentArray ar;
RTRKeySegment* pKeySeg0 = NULL;
RTRKeySegment* pKeySeg1 = NULL;
unsigned low0=0;
unsigned high0=10000;
unsigned low1=10001;
unsigned high1=20000;
pKeySeg0 = new RTRKeySegment(rtr_keyseg_unsigned, sizeof(unsigned), 0, &low0, &high0);
if (IsFailure(pKeySeg0 != NULL))
return false;
bool bAddOk = ar.Add(pKeySeg0);
if (IsFailure(bAddOk == true))
{
delete pKeySeg0;
return false;
}
if (ar.Size() != 1)
{
delete pKeySeg0;
return false;
}
pKeySeg1 = new RTRKeySegment(rtr_keyseg_unsigned, sizeof(unsigned), 0, &low1, &high1);
if (IsFailure(pKeySeg1 != NULL))
{
delete pKeySeg0;
return false;
}
bool bInsertOk = ar.Insert(0, pKeySeg1);
if (IsFailure(bInsertOk == true))
{
delete pKeySeg0;
delete pKeySeg1;
return false;
}
bool bClearOk = ar.Clear();
if (IsFailure(bClearOk == true))
{
delete pKeySeg0;
delete pKeySeg1;
return false;
}
if (IsFailure(ar.Size() == 0))
{
delete pKeySeg0;
delete pKeySeg1;
return false;
}
delete pKeySeg0;
delete pKeySeg1;
return true;
}
RTRKeySegmentArray::Insert();
Prototype
bool Insert(size_t n, RTRKeySegment* pFacMember);
Return Value
True or False
Parameters
n
The element in the array (ar[0] is the first element). The element is a pointer to an object.
pFacMember
Pointer to a facility member.
Description
Insert a pointer to an RTRKeySegment member into the Nth position, moving the remainder of the array to make room.
Example
bool RTRKeySegmentArray::Insert ()
{
bool bArrayAddStatus;
RTRKeySegmentArray ar;
RTRKeySegment* pKeySeg0;
RTRKeySegment* pKeySeg1;
unsigned low0=0;
unsigned low1=10001;
unsigned high0=10000;
unsigned high1=20000;
pKeySeg0 = new RTRKeySegment(rtr_keyseg_unsigned, sizeof(unsigned), 0, &low0, &high0);
if (IsFailure(pKeySeg0 != NULL))
return false;
bool bAddOk = ar.Add(pKeySeg0);
if (IsFailure(bAddOk == true))
{
delete pKeySeg0;
return false;
}
if (ar.Size() != 1)
{
delete pKeySeg0;
return false;
}
pKeySeg1 = new RTRKeySegment(rtr_keyseg_unsigned, sizeof(unsigned),
0, &low1, &high1);
if (IsFailure(pKeySeg1 != NULL))
{
delete pKeySeg0;
return false;
}
bool bInsertOk = ar.Insert(0, pKeySeg1);
if (IsFailure(bInsertOk == true))
{
delete pKeySeg0;
delete pKeySeg1;
return false;
}
delete pKeySeg0;
delete pKeySeg1;
return true;
}
RTRKeySegmentArray::Remove(const size_t n);
Prototype
size_t Remove(const size_t n);
Return Value
size_t
The amount of allocated space.
Parameters
n
The element in the array (ar[0] is the first element). The element is a pointer to an object.
Description
This method removes the Nth element of the array. Calling this method does not destroy the object pointed to; the caller needs to delete the contents.
Example
bool RTRKeySegmentArray::Remove ()
{
bool bArrayAddStatus;
RTRKeySegmentArray ar;
RTRKeySegment* pKeySeg;
unsigned low=0;
unsigned high=10000;
pKeySeg = new RTRKeySegment(rtr_keyseg_unsigned, sizeof(unsigned), 0, &low, &high);
if (IsFailure(pKeySeg != NULL))
return false;
bool bAddOk = ar.Add(pKeySeg);
if (IsFailure(bAddOk == true))
{
delete pKeySeg;
return false;
}
bool bRemoveOk = ar.Remove(0);
if (IsFailure(bRemoveOk == true))
{
delete pKeySeg;
return false;
}
delete pKeySeg;
return true;
}
RTRKeySegmentArray::RTRKeySegmentArray();
Prototype
RTRKeySegmentArray();
virtual ~RTRKeySegmentArray();
Return Value
None
Parameters
None
Description
Call this method to construct new RTRKeySegmentArray object.
Example
Test_RTRKeySegmentArray::Test_RTRKeySegmentArray ()
{
}
RTRKeySegmentArray::operator();
Prototype
RTRKeySegment*& operator[ ] (size_t n);
Return Value
Returns the Nth element of the array.
Parameters
n
The element in the array (ar[0] is the first element). The element is a pointer to an object.
Description
This operator returns the Nth element of the array which will be a pointer to an RTRKeySegment member. This operator can also be used to set the Nth element of the array. The existing element pointed to is not destroyed; the caller must delete this.
Example
bool Test_RTRKeySegmentArray::arrayoper()
{
bool bArrayAddStatus;
RTRKeySegmentArray ar;
RTRKeySegment* pKeySeg;
unsigned low=0;
unsigned high=10000;
pKeySeg = new RTRKeySegment(rtr_keyseg_unsigned, sizeof(unsigned),
0, &low, &high);
if (IsFailure(pKeySeg != NULL))
return false;
bool bAddOk = ar.Add(pKeySeg);
if (IsFailure(bAddOk == true))
{
delete pKeySeg;
return false;
}
if (ar.Size() != 1)
{
delete pKeySeg;
return false;
}
RTRKeySegment* pSeg0 = ar[0];
if (IsFailure(pSeg0 != NULL))
{
delete pKeySeg;
return false;
}
delete pKeySeg;
return true;
}
RTRKeySegmentArray::Size();
Prototype
size_t Size() const;
Return Value
size_t
The amount of space to be allocated.
Parameters
None
Description
The method returns the number of elements in the array.
Example
bool RTRKeySegmentArray::Size ()
{
bool bArrayAddStatus;
RTRKeySegmentArray ar;
RTRKeySegment* pKeySeg;
unsigned low=0;
unsigned high=10000;
pKeySeg = new RTRKeySegment(rtr_keyseg_unsigned, sizeof(unsigned), 0, &low, &high);
if (IsFailure(pKeySeg != NULL))
return false;
bool bAddOk = ar.Add(pKeySeg);
if (IsFailure(bAddOk == true))
{
delete pKeySeg;
return false;
}
if (ar.Size() != 1)
{
delete pKeySeg;
return false;
}
delete pKeySeg;
return true;
}
The RTRPartitionManager allows the RTR applictaion to create, delete and obtain properties for a partition.
A partition is composed of one or more key segments. These key segments define the location of data within the applications message, the type of the data and a range of values for the data. RTR uses this information to perform its data routing. One or more partitions can be registered with a server transaction controller.
The key segments are associated with a partition when the partition is created. A partition exists within one facility. A facility can have many partitions.
RTRPartitionManager Class Members
Construction
Method |
Description |
Constructor |
|
~RTRPartitionManager() |
Destructor |
Operations
Method |
Description |
CreateBackendPartition(rtr_const_parnam_t, rtr_const_facnam_t, RTRKeySegment, const bool, const bool, const bool) |
Creates a partition on a backend within an existing facility. |
CreateBackendPartition(rtr_const_parnam_t, rtr_const_facnam_t, RTRKeySegmentArray, const bool, const bool, const bool) |
Creates a partition on a backend within an existing facility.using an RTRKeySegmentArray. |
DeletePartition(rtr_const_parnam_t, rtr_const_facnam_t) |
Deletes a partition. |
GetBackendPartitionProperties(rtr_const_parnam_t) |
Retrieves properties for a partition on a backend. |
RTRPartitionManager::CreateBackendPartition();
Prototype
virtual rtr_status_t CreateBackendPartition( rtr_const_parnam_t pszPartitionName,
rtr_const_facnam_t pszFacilityName,
RTRKeySegment &KeySegment,
const bool bShadow = false,
const bool bConcurrent = true,
const bool bStandby = true);
virtual rtr_status_t CreateBackendPartition( rtr_const_parnam_t pszPartitionName,
rtr_const_facnam_t pszFacilityName,
RTRKeySegment &KeySegmentArray,
const bool bShadow = false,
const bool bConcurrent = true,
const bool bStandby = true);
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_INVFACNAMEARG |
The facility name argument is invalid. |
RTR_STS_INVKEYSEGPTARG |
Invalid key segment object pointer argument. |
RTR_STS_INVPARTNAMEARG |
The partition name argument is invalid. |
RTR_STS_MAXPARTREG |
Maximum partition limit. |
RTR_STS_OK |
Normal successful completion. |
Parameters
pszPartitionName
A null-terminated pointer to a partition name.
pszFacilityName
A null-terminated pointer to a facility name.
KeySegment
A key segment for the specified partition name.
KeySegmentArray
An array of key segments for the specified partition name.
bShadow
A boolean attribute for specifying a shadow server.
bConcurrent
A boolean attribute for specifying a concurrent server.
bStandby
A boolean attribute for specifying a standby server.
Description
CreateBackendPartition method creates an RTR backend partition. The partition characteristics that may be defined include key range or ranges and whether attached server process can be shadows or standbys. The command must be issued before any server application programs using the partition are started.
Example
RTRKeySegment *pCharcterStringSegment = new RTRKeySegment(
rtr_keyseg_string,1,0,"y","z");
RTRPartitionManager PartitionManager;
sStatus = PartitionManager.CreateBackendPartition(
"MyPartition","myfac",&pCharacterStringSegment,false,true,true);
// bool parameters are for specifying shadow, concurrent, standby
From the Sample application in the Examples directory:
RTRPartitionManager PartitionManager;
sStatus = PartitionManager.CreateBackEndPartition( ABCPartition1,
ABCFacility,
KeyZeroTo99,false,true,false);
RTRPartitionManager::DeletePartition();
Prototype
virtual rtr_status_t DeletePartition( rtr_const_parnam_t pszPartitionName,
rtr_const_facnam_t pszFacility );
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_INVFACNAMEARG |
The facility name argument is invalid. |
RTR_STS_INVPARTNAMEARG |
The partition name argument is invalid. |
RTR_STS_OK |
Normal successful completion. |
RTR_STS_PRTNDELETED |
Deletion of partition failed with error. |
Parameters
pszPartitionName
A null-terminated pointer to a partition name.
pszFacility
A null-terminated pointer to a facility name.
Description
Call this method to delete a partition from a facility.
Example
Char *pszFac = "MyFacility";
Char *pszPartition = "MyPartitionName";
sStatus = PartitionManager.DeletePartition(pszFac,pszPartition);
GetBackendPartitionProperties()
RTRPartitionManager::GetBackendPartitionProperties();
Prototype
virtual RTRBackendPartitionProperties*
GetBackendPartitionProperties(rtr_const_parnam_t pszPartitionName);
Return Value
RTRBackendPartitionProperties*
Pointer to the RTRBackendPartitionProperties object associated with this RTRPartitionManager object.
Status |
Message |
RTR_STS_OK |
Normal successful completion. |
RTR_STS_INVPARTNAMEARG |
The partition name argument is invalid. |
Parameters
pszPartitionName
A null-terminated pointer to a partition name.
Description
This method retrieves the properties associated with the RTRPartitionManager object. These properties are contained within an associated RTRBackendPartitionProperties object.
Example
RTRBackendPartitionProperties *pPartProperties = PartitionManager.GetBackendPartitionProperties("MyPartition");
RTRPartitionManager::RTRPartitionManager();
Prototype
RTRPartitionManager();
virtual ~RTRPartitionManager();
Return Value
None
Parameters
None
Description
This method defines an RTRPartitionManager object.
Example
RTRPartitionManager PartitionManager;
To use a counter, perform the following steps:
RTRSignedCounter Class Members
Construction
Method |
Description |
RTRSignedCounter( rtr_const_countername_t, rtr_const_countergroupname_t) |
Constructor |
~RTRSignedCounter() |
Destructor |
Operations
Method |
Description |
Decrement the value managed by the counter class. |
|
GetValue(rtr_sgn_32_t) |
Retrieve the value managed by the counter class. |
Increment the value managed by the counter class. |
|
SetValue(rtr_sgn_32_t) |
Set the value managed by the counter class. |
RTRSignedCounter::Decrement();
Prototype
rtr_status_t Decrement();
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_CTRBADOPER |
The supplied argument specifies an illegal counter operation. |
RTR_STS_CTRBADREF |
The supplied argument does not reference a valid counter. |
RTR_STS_INVOBJFAILCNSTR |
Invalid object due to failure during object construction. |
RTR_STS_OK |
Normal successful completion. |
RTR_STS_PRTBADCMD |
Partition command invalid or not implemented in this version of RTR. |
The more specificcounter class error status descriptions for RTR_STSCTRBADREF and RTR_STS_INVOBJFAILCNSTR are:
The object has not been initialized by the application. All counters must be given a default value by calling SetValue() after object construction.
The object is invalid because the values passed in the constructor were invalid.
Parameters
None
Description
Call this method to decrement a numeric counter. Decrement method can be called only after setting value (RTRSignedCounter::SetValue(CounterVal)).
Example
rtr_const_countername_t kCounter = "test-counter-signed-decrement";
rtr_const_countergroupname_t kGroup = "test-counter-group";
RTRSignedCounter c(kCounter, kGroup);
rtr_sgn_32_t v = 0;
const rtr_sgn_32_t kValue = 669;
bool bOverallResult = true;
rtr_status_t stsSetValue;
stsSetValue = c.SetValue(kValue);
if (IsFailure(stsSetValue == RTR_STS_OK))
{
bOverallResult = false;
OutputStatus(stsSetValue);
}
rtr_status_t stsDecrement;
stsDecrement = c.Decrement();
if (IsFailure(stsDecrement == RTR_STS_OK))
{
bOverallResult = false;
OutputStatus(stsDecrement);
}
RTRSignedCounter::GetValue();
Prototype
rtr_status_t GetValue(rtr_sgn_32_t &CounterVal);
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_CTRBADREF |
The supplied argument does not reference a valid counter. |
RTR_STS_INVOBJFAILCNSTR |
Invalid object due to failure during object construction. |
RTR_STS_OK |
Normal successful completion. |
The more specificcounter class error status descriptions for RTR_STSCTRBADREF and RTR_STS_INVOBJFAILCNSTR are:
The object has not been initialized by the application. All counters must be given a default value by calling SetValue() after object construction.
The object is invalid because the values passed in the constructor were invalid.
Parameters
CounterVal
A counter value for a specified RTR counter.
Description
Call this method to get a counter value. GetValue can be called only after setting value (SetValue).
Example
rtr_status_t stsGetValue;
stsGetValue = c.GetValue(v);
if (IsFailure(stsGetValue == RTR_STS_OK))
{
bOverallResult = false;
OutputStatus(stsGetValue);
}
RTRSignedCounter::Increment();
Prototype
rtr_status_t Increment();
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_CTRBADOPER |
The supplied argument specifies an illegal counter operation. |
RTR_STS_CTRBADREF |
The supplied argument does not reference a valid counter. |
RTR_STS_INVOBJFAILCNSTR |
Invalid object due to failure during object construction. |
RTR_STS_OK |
Normal successful completion. |
The more specificcounter class error status descriptions for RTR_STSCTRBADREF and RTR_STS_INVOBJFAILCNSTR are:
The object has not been initialized by the application. All counters must be given a default value by calling SetValue() after object construction.
The object is invalid because the values passed in the constructor were invalid.
Parameters
None
Description
Call this method to increment a numeric counter. This method can be called only after setting value.
Example
rtr_const_countername_t kCounter = "test-counter-signed-increment";
rtr_const_countergroupname_t kGroup = "test-counter-group";
RTRSignedCounter c(kCounter, kGroup);
rtr_sgn_32_t v = 0;
const rtr_sgn_32_t kValue = 668;
bool bOverallResult = true;
rtr_status_t stsSetValue;
stsSetValue = c.SetValue(kValue);
if (IsFailure(stsSetValue == RTR_STS_OK))
{
bOverallResult = false;
OutputStatus(stsSetValue);
}
rtr_status_t stsIncrement;
stsIncrement = c.Increment();
if (IsFailure(stsIncrement == RTR_STS_OK))
{
bOverallResult = false;
OutputStatus(stsIncrement);
}
RTRSignedCounter::SetValue();
Prototype
rtr_status_t SetValue( rtr_sgn_32_t CounterVal );
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_OK |
Normal successful completion. |
RTR_STS_INVOBJFAILCNSTR |
Invalid object due to failure during object construction. |
The more specificcounter class error status description for RTR_STS_INVOBJFAILCNSTR is:
The object is invalid because the values passed in the constructor were invalid.
Parameters
CounterVal
A counter value for a specified RTR counter.
Description
Call this method to set value for a counter. Object should be declared before setting value.
Example
rtr_status_t sStatus;
int iSetValue = 100;
sStatus = IIntCounter->SetValue(iSetValue);
RTRSignedCounter::RTRSignedCounter();
Prototype
RTRSignedCounter( rtr_const_countername_t pszCounterName ,
rtr_const_countergroupname_t pszCounterGroupName);
Return Value
None
Parameters
pszCounterName
A null-terminated string pointer to the name of an RTR counter.
pszCounterGroupName
A null-terminated string pointer to the name of an RTR counter group.
Description
This method used to declare an RTRSignedCounter object. The constructor creates an instance of the RTRSignedCounter class. The application must call SetValue() to initialize the counter.
All counters are process-specific. All counter names must be unique within the entire process without regard to the group name. For example, it is invalid to have an RTRSignedCounter name "MyCounter" and another RTRStringCounter name "MyCounter."
Example
rtr_counter_data_type eCtrtype = rtr_counter_int;
RTRSignedCounter *iIntCounter = new
RTRSignedCounter("MyCounter3","GroupName",eCtrtype);
To use a counter, perform the following steps:
RTRStringCounter Class Members
Construction
Method |
Description |
RTRStringCounter( const char, const char, rtr_counter_data_type) |
Constructor |
~RTRStringCounter() |
Destructor |
Operations
Method |
Description |
GetValue(char) |
Retrieve the value managed by the counter class. |
SetValue(const char) |
Set the value managed by the counter class. |
RTRStringCounter::GetValue();
Prototype
rtr_status_t GetValue(char * pszCounterVal);
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_CTRBADREF |
The supplied argument does not reference a valid counter. |
RTR_STS_INVOBJFAILCNSTR |
Invalid object due to failure during object construction. |
RTR_STS_OK |
Normal successful completion. |
The more specificcounter class error status descriptions for RTR_STSCTRBADREF and RTR_STS_INVOBJFAILCNSTR are:
The object has not been initialized by the application. All counters must be given a default value by calling SetValue() after object construction.
The object is invalid because the values passed in the constructor were invalid.
Parameters
pszCounterVal
A null-terminated string pointer to the name of an RTR counter.
Description
Call this method to get a counter value. GetValue can be called only after setting a value (SetValue).
Example
int IIntCounter;
rtr_status_t sStatus;
sStatus = cMyCounter.GetValue(IIntCounter);
if (sStatus!= RTR_STS_OK) cerr<<"Error while getting counter value";
RTRStringCounter::SetValue();
Prototype
rtr_status_t SetValue(const char * pszCounterVal);
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_OK |
Normal successful completion. |
RTR_STS_INVOBJFAILCNSTR |
Invalid object due to failure during object construction. |
The more specificcounter class error status description for RTR_STS_INVOBJFAILCNSTR is:
The object is invalid because the values passed in the constructor were invalid.
Parameters
pszCounterVal
A null-terminated string pointer to the value of an RTR counter.
Description
Call this method to set a counter value.
Example
rtr_status_t sStatus;
int iSetValue = 100;
sStatus = IIntCounter->SetValue(iSetValue);
RTRStringCounter::RTRStringCounter();
Prototype
RTRStringCounter(const char *pszCounterName ,
const char *pszCounterGroupName);
Return Value
None
Parameters
pszCounterName
A null-terminated string pointer to the name of an RTR counter.
pszCounterGroupName
A null-terminated string pointer to the name of an RTR counter group.
Description
This method used to declare an RTRStringCounter object. The constructor creates an instance of the RTRStringCounter class. The application must call SetValue() to initialize the counter.
All counters are process-specific. All counter names must be unique within the entire process without regard to the group name. For example, it is invalid to have an RTRStringCounter name "MyCounter" and another RTRSignedCounter name "MyCounter."
Example
rtr_counter_data_type eCtrtype = rtr_counter_int;
RTRStringCounter *iIntCounter = new
RTRStringCounter("MyCounter2","GroupName",eCtrtype);
To use a counter, perform the following steps:
RTRUnsignedCounter Class Members
Construction
Method |
Description |
RTRUnsignedCounter( rtr_const_countername_t, rtr_const_countergroupname_t) |
Constructor |
~RTRUnsignedCounter() |
Destructor |
Operations
Method |
Description |
Decrement the value managed by the counter class. |
|
GetValue(rtr_uns_32_t) |
Retrieve the value managed by the counter class. |
Increment the value managed by the counter class. |
|
SetValue(rtr_uns_32_t) |
Set the value managed by the counter class. |
RTRUnsignedCounter::Decrement();
Prototype
rtr_status_t Decrement();
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_CTRBADOPER |
The supplied argument specifies an illegal counter operation. |
RTR_STS_CTRBADREF |
The supplied argument does not reference a valid counter. |
RTR_STS_INVOBJFAILCNSTR |
Invalid object due to failure during object construction. |
RTR_STS_OK |
Normal successful completion. |
The more specificcounter class error status descriptions for RTR_STSCTRBADREF and RTR_STS_INVOBJFAILCNSTR are:
The object has not been initialized by the application. All counters must be given a default value by calling SetValue() after object construction.
The object is invalid because the values passed in the constructor were invalid.
Parameters
None
Description
Call this method to decrement a numeric counter. Decrement method can be called only after setting value.
Example
RTRUnsignedCounter c(kCounter, kGroup);
rtr_uns_32_t v = 0;
const rtr_uns_32_t kValue = 669;
bool bOverallResult = true;
rtr_status_t stsSetValue;
stsSetValue = c.SetValue(kValue);
if (IsFailure(stsSetValue == RTR_STS_OK))
{
bOverallResult = false;
OutputStatus(stsSetValue);
}
rtr_status_t stsDecrement;
stsDecrement = c.Decrement();
if (IsFailure(stsDecrement == RTR_STS_OK))
{
bOverallResult = false;
OutputStatus(stsDecrement);
}
RTRUnsignedCounter::GetValue();
Prototype
rtr_status_t GetValue(rtr_uns_32_t &CounterVal);
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_CTRBADREF |
The supplied argument does not reference a valid counter. |
RTR_STS_INVOBJFAILCNSTR |
Invalid object due to failure during object construction. |
RTR_STS_OK |
Normal successful completion. |
The more specific counter class error status descriptions for RTR_STSCTRBADREF and RTR_STS_INVOBJFAILCNSTR are:
The object has not been initialized by the application. All counters must be given a default value by calling SetValue() after object construction.
The object is invalid because the values passed in the constructor were invalid.
Parameters
CounterVal
A counter value for a specified RTR counter.
Description
Call this method to get a counter value. GetValue can be called only after setting value (SetValue).
Example
rtr_status_t sStatus;
sStatus = IIntCounter->GetValue(iReturnValue);
RTRCounter::Increment();
Prototype
rtr_status_t Increment();
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_CTRBADOPER |
The supplied argument specifies an illegal counter operation for the counter type. |
RTR_STS_CTRBADREF |
The supplied argument does not reference a valid counter. |
RTR_STS_INVOBJFAILCNSTR |
Invalid object due to failure during object construction. |
RTR_STS_OK |
Normal successful completion. |
The more specificcounter class error status descriptions for RTR_STSCTRBADREF and RTR_STS_INVOBJFAILCNSTR are:
The object has not been initialized by the application. All counters must be given a default value by calling SetValue() after object construction.
The object is invalid because the values passed in the constructor were invalid.
Parameters
None
Description
Call this method to increment a numeric counter. This method can be called only after setting value.
Example
rtr_status_t stsIncrement;
stsIncrement = c.Increment();
if (IsFailure(stsIncrement == RTR_STS_OK))
{
bOverallResult = false;
OutputStatus(stsIncrement);
}
RTRUnsignedCounter::SetValue();
Prototype
rtr_status_t SetValue( rtr_uns_32_t CounterVal );
Return Value
rtr_status_t
Interpret value for the success or failure of this call.
Status |
Message |
RTR_STS_OK |
Normal successful completion. |
RTR_STS_INVOBJFAILCNSTR |
Invalid object due to failure during object construction. |
The more specificcounter class error status description for RTR_STS_INVOBJFAILCNSTR is:
The object is invalid because the values passed in the constructor were invalid.
Parameters
CounterVal
A counter value for a specified RTR counter.
Description
Call this method to set value for a counter. Object should be declared before setting value.
Example
rtr_status_t sStatus;
int iSetValue = 100;
sStatus = IIntCounter->SetValue(iSetValue);
RTRUnsignedCounter::RTRUnsignedCounter();
Prototype
RTRUnsignedCounter( rtr_const_countername_t pszCounterName ,
rtr_const_countergroupname_t pszCounterGroupName);
Return Value
None
Parameters
pszCounterName
A null-terminated string pointer to the name of an RTR counter.
pszCounterGroupName
A null-terminated string pointer to the name of an RTR counter group.
Description
This method used to declare an RTRUnsignedCounter object. The constructor creates an instance of the RTRUnsignedCounter class. The application must call SetValue() to initialize the counter.
All counters are process-specific. All counter names must be unique within the entire process without regard to the group name. For example, it is invalid to have an RTRUnsignedCounter name "MyCounter" and another RTRStringCounter name "MyCounter."
Example
rtr_counter_data_type eCtrtype = rtr_counter_int;
RTRUnsignedCounter *iIntCounter = new
RTRUnsignedCounter("MyCounter1","GroupName",eCtrtype);