|
Algorithm 2 Dataflow gate. |
Require: Data consumer threads, ;
Map of data buffers, ;
Buffer size threshold, T;
Ensure: final result set,;
-
1:
while Consumer.listening do
-
2:
if
.hasNewElement then
-
3:
=consumer.newElement;
-
4:
=getKeyPrefix();
-
5:
=.get(key);
-
6:
if
.contains() then
-
7:
continue;
-
8:
else
-
9:
+=;
-
10:
end if
-
11:
if
.length=T
then
-
12:
res=buffer;
-
13:
post(res);
-
14:
buffer=null;
-
15:
end if
-
16:
end if
-
17:
end while
|