主权项 |
1. A method for sorting and merging data from at least two sources comprising:
timestamping the data from the at least two sources; entering the timestamped data into at least one of a first input queue, a second input queue, a third input queue, and a fourth input queue; providing a multi-state merge of queues from the first input queue and the second input queue to a merged output, wherein each of the first input queue and the second input queue has a state from a group including empty waiting, active, and ignore, wherein the empty waiting state has a wait duration time; initializing each of the first input queue and the second input queue to active; responsive to detecting an empty first input queue to be merged with a non-empty second input queue and the state of the first input queue is active, setting the state of the first input queue to empty waiting with a time out; responsive to receiving an entry describing the state of the first input queue when the state of the first input queue is empty waiting, and prior to the time out, setting the state of the first input queue to active; responsive to detecting the time out and state of the first input queue equal to empty waiting, setting the state of the first input queue to ignore; preventing merging of the first input queue with the non-empty second input queue while the state of the first input queue is empty waiting; merging the first input queue with the non-empty second input queue responsive to the state of the first input queue being active; merging the first input queue with the non-empty second input queue responsive to the state of the first input queue being ignore; merging the first input queue with the non-empty second input queue responsive to the wait duration time being exceeded; and merging the first input queue with the non-empty second input queue responsive to a startup command; beginning a sorting of data combined from the first input queue, the second input queue, the third input queue, and the fourth input queue, wherein the sorting of the data combined from the first input queue, the second input queue, the third input queue, and the fourth input queue is executed after casting the combined data to a common data type; receiving a notice that the fourth input queue is newly empty; pausing the sorting of the combined data until after a waiting period for the newly empty fourth input queue has passed; determining whether to sort the first input queue together with the second input queue or the third input queue based on first input queue timestamp data, second input queue timestamp data, and third input queue timestamp data; responsive to a timestamp of datum from at least one of the first input queue, the second input queue, the third input queue, and the fourth input queue being dated after the beginning of the sorting of the combined data, removing the respective datum to an output queue, restarting and completing the sorting of the combined data of the first input queue, the second input queue, and the third input queue based on the determining of whether to sort the first input queue together with the second input queue or the third input queue, wherein the restarting of the sorting proceeds without the removed datum, and wherein the multi-stage merge is for a streaming application. |