3.1.4.1 Algorithm for Querying Sync Knowledge for a Participant
The inputs for this algorithm are:
ReplicaList: The ReplicaList for the Participant.
ClockVectorList: The ClockVectorList for the Participant.
RangeList: The RangeList for the Participant.
OutputBufferSize: The maximum number of bytes to return in OutputBuffer.
On completion, the Participant store MUST return:
OutputBuffer: An array of bytes that returns a SYNC_KNOWLEDGE structure as specified in section 2.3.
The algorithm uses the following local variables:
SyncKnowledge structure
Integer value (initialized to 0) CurrentReplicaIndex, CurrentClockVectorIndex, CurrentElementIndex, CurrentRangeIndex.
Pseudocode for the operation is as follows:
Set SyncKnowledge.Version to 5.
Set SyncKnowledge.Reserved1 to 0.
Set SyncKnowledge.Reserved2 to 1.
Set SyncKnowledge.Reserved3 to 0.
Set SyncKnowledge.Version to 5.
Set SyncKnowledge.ReplicaKeyMap.Signature to 5.
Set SyncKnowledge.ReplicaKeyMap.AreReplicaGidsVariableLength to 0.
Set SyncKnowledge.ReplicaKeyMap.ReplicaGidLength to 16.
Set SyncKnowledge.ReplicaKeyMap.ReplicaKeys.NumEntries to ReplicaList.Count.
For each ReplicaEntry in ReplicaTable:
Set SyncKnowledge.ReplicaKeyMap.ReplicaKeys.ReplicaGids[CurrentReplicaIndex] to ReplicaEntry.ReplicaGid.
Set CurrentReplicaIndex to CurrentReplicaIndex + 1.
EndFor
Set SyncKnowledge.SectionSignature to 24.
Set SyncKnowledge.AreReplicaGidsVariableLength to 0.
Set SyncKnowledge.ReplicaGidLength to 16.
Set SyncKnowledge.AreSyncGidsVariableLength to 0.
Set SyncKnowledge.SyncGidLength to 24.
Set SyncKnowledge.Reserved4 to 0.
Set SyncKnowledge.Reserved5 to 1.
Set SyncKnowledge.ClockVectorTableSignature to 21.
Set SyncKnowledge.ClockVectorTable.NumEntries to ClockVectorList.Count.
For each ClockVector in ClockVectorList
Set SyncKnowledge.ClockVectorTable.ClockVectorEntries[CurrentClockVectorIndex].Signature to 1.
Set SyncKnowledge.ClockVectorTable.ClockVectorEntries[CurrentClockVectorIndex].ClockVectorElementEntries.NumElements to ClockVectorList[CurrentIndex].ClockVectorElementList.Count.
For each ClockVectorElement in ClockVectorList[CurrentClockVectorIndex].ClockVectorElementList
Set SyncKnowledge.ClockVectorTable.ClockVectorEntries[CurrentClockVectorIndex].ClockVectorElementEntries.ClockVectorElement[CurrentElementIndex].ReplicaKey to ClockVectorList[CurrentIndex].ClockVectorElementList[CurrentElementIndex].ReplicaKey.
Set SyncKnowledge.ClockVectorTable.ClockVectorEntries[CurrentClockVectorIndex].ClockVectorElementEntries.ClockVectorElement[CurrentElementIndex].TickCount to ClockVectorList[CurrentClockVectorIndex].ClockVectorElementList[CurrentElementIndex].TickCount.
Set CurrentElementIndex to CurrentElementIndex + 1.
EndFor
Set CurrentClockVectorIndex to CurrentClockVectorIndex + 1.
EndFor
Set SyncKnowledge.RangeSetTableSignature to 23.
Set SyncKnowledge.RangeSetTable.NumEntries to 1.
Set SyncKnowledge.RangeSetTable.RangeSets[0].RangeSetSignature to 22.
For each RangeEntry in RangeList:
Set SyncKnowledge.RangeSetTable.RangeSets[0].Ranges[CurrentRangeIndex].SyncGid to RangeEntry.SyncGid.
Set SyncKnowledge.RangeSetTable.RangeSets[0].Ranges[CurrentRangeIndex].ClockTableVectorIndex to RangeEntry.ClockVectorKey.
Set CurrentRangeIndex to CurrentRangeIndex + 1.
EndFor
Set SyncKnowledge.Reserved6 to 0.
Set SyncKnowledge.Reserved7 to 25.
Set SyncKnowledge.Reserved8 to 1.
Set SyncKnowledge.Reserved9 to 0.