Previous | Contents | Index |
rtr_status_t GetMemberList(RTRFacilityMemberArray &aFacilityMembers);
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. |
aFacilityMembers
An array listing a facility's members.
Retrieve a list of nodes and their roles for an existing facility.
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( rtr_const_facnam_t pszFacilityName); virtual ~RTRFacilityProperties();
None
pszFacility
A null-terminated pointer to a facility name.
This method retrieves the properties associated with the facility object.
char *pszFacility = "Myfacilityname"; RTRFacilityProperties *FacilityPropterties = new RTRFacilityProperties(pszFacility);
rtr_status_t SetBalance( bool bBalancingOn );
rtr_status_t Interpret value for the success or failure of this call. RTR_STS_OK is the normal successful completion.
bBalancingOn
A boolean attribute for specifying RTR balancing of client requests for server processing.
Specifies whether router balancing is to be performed.
rtr_status_t sStatus; char *pszFacilityName= "MyfacilityName"; bool bBalanceON = true; sStatus = MyFacilityProperties->SetBalance(bBalanceOn);
4.7 RTRKeySegment
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 |
Method | Description |
---|---|
GetKeySegmentHighValue() | Gets the upper bound of the key range for the key segment. |
GetKeySegmentLength() | Gets the length of the key segment key. |
GetKeySegmentLowValue() | Gets the lower bound of the key range for the key segment. |
GetKeySegmentOffset() | Gets the offset of the key segment key. |
GetKeySegmentType() | 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. |
rtr_pointer_t GetKeySegmentHighValue();
rtr_pointer_t Pointer to the returned upper-bound key value.
None
This method returns the upper-bound key value of the key segment.
RTRKeySegment CharacterStringSegment.GetKeySegmentHighValue();
rtr_keylen_t GetKeySegmentLength();
rtr_keylen_t The returned value is the length of the key segment.
None
This method gets the length of the key segment key.
rtr_keylen_t keylength = CharacterStringSegment.GetKeySegmentLength();
rtr_pointer_t GetKeySegmentLowValue();
rtr_pointer_t Pointer to the returned lower-bound key value.
None
This method returns the lower-bound key value of the key segment.
rtr_keylen_t keylength = CharacterStringSegment.GetKeySegmentLowValue();
rtr_keylen_t GetKeySegmentOffset();
rtr_keylen_t The returned value is the offset of the key value.
None
This method gets the offset of the key segment key within the message stream.
rtr_keylen_t keylength = CharacterStringSegment.GetKeySegmentOffset();
rtr_keyseg_type_t GetKeySegmentType();
rtr_keyseg_type_t
One of the values of type rtr_keyseg_type_t, that can be:
None
This method gets the data type of the key segment.
rtr_keylen_t keylength = CharacterStringSegment.GetKeySegmentType();
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();
None
keySegmentType
One of the values of type rtr_keyseg_type_t, that can be one of the following:
- rtr_keyseg_signed
- rtr_keyseg_unsigned
- rtr_keyseg_string
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.
Call this constructor to create an RTRKeySegment object.
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); }
rtr_status_t SetKeySegmentHighValue(rtr_const_pointer_t pKeySegmentHighValue );
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. |
pKeySegmentHighValue
Pointer to the upper-bound key value to be set.
This method sets the upper bound of the key range for the key segment.
rtr_keyseg_type_t PKeySegmentHighValue = L; CharacterStringSegment.SetKeySegmentHighValue(KeySegmentHighValue);
rtr_status_t SetKeySegmentLength(const rtr_keylen_t keySegmentLength );
rtr_status_t Interpret value for the success or failure of this call. RTR_STS_OK is the normal successful completion.
keySegmentLength
This parameter holds the key length value of type rtr_keylen_t to be set.
This method sets the length of the key segment key.
rtr_keylen_t keylength = 1; CharacterStringSegment.SetLength(keylength);
rtr_status_t SetKeySegmentLowValue(rtr_const_pointer_t pKeySegmentLowValue);
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. |
pKeySegmentLowValue
Pointer to the lower-bound key value to be set.
This method sets lower bound of the key range for the key segment.
rtr_keyseg_type_t PKeySegmentLowValue = A; CharacterStringSegment.SetKeySegmentLowValue(KeySegmentLowValue);
rtr_status_t SetKeySegmentOffset( const rtr_keylen_t keySegmentOffset );
rtr_status_t Interpret value for the success or failure of this call. RTR_STS_OK is the normal successful completion.
keySegmentOffset
This parameter holds the key segment key offset of type rtr_keylen_t.
This method sets the offset of the key segment key within the message stream.
rtr_keylen_type_t PKeySegmentOffset = ; CharacterStringSegment.SetKeySegmentOffset(KeySegmentOffset);
rtr_status_t SetKeySegmentType( const rtr_keyseg_type_t keySegmentType);
rtr_status_t Interpret value for the success or failure of this call. RTR_STS_OK is the normal successful completion.
keySegmentType
One of the values of type rtr_keyseg_type_t, that can be one of the following:
- rtr_keyseg_signed
- rtr_keyseg_unsigned
- rtr_keyseg_string
This method sets the data type of the key segment.
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;
4.8 RTRKeySegmentArray
An RTRKeySegmentArray object contains pointers to array elements.
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). |
Construction
Method | Description |
---|---|
RTRKeySegmentArray() | 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. |
bool Add(RTRKeySegment* pFacMember);
True or False
pFacMember
Pointer to a facility member.
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.
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; }
bool Clear();
True or False
None
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.
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; }
Previous | Next | Contents | Index |