オブジェクトが混在する多くのファイルを読み込んでいます。root
次のようなオブジェクトをストリーミングするストリームが 1 つあります。
// root stream
{"action": "action_type_a", "id": "1234"}
{"action": "action_type_b", id: "24566"}
{"action": "action_type_b", id: "0808098"}
{"action": "action_type_b", id: "8098098"}
{"action": "action_type_a", "id": "098098"}
{"action": "action_type_b", id: "08098"}
root
ストリームを 2 つの別々のgrep
フィルター処理されたストリームにパイプして、 1 つのフィルター処理action_type_a
を呼び出すA
と、次のようになります。
// stream A
{"action": "action_type_a", "id": "1234"}
{"action": "action_type_a", "id": "098098"}
そのためのフィルタリングはaction_type_b
B
次のようになります。
// stream B
{"action": "action_type_b", id: "24566"}
{"action": "action_type_b", id: "0808098"}
{"action": "action_type_b", id: "8098098"}
{"action": "action_type_b", id: "08098"}
私も別map
のIDを持っています
// id map
{
"1234" : "098098",
""098098" : "8098098"
}
オブジェクトのID がオブジェクトA
の ID と一致するようにB
ストリームを処理A
して、各オブジェクト ID をマップと比較し、処理B
してストリームに対応するオブジェクトがあるかどうかを確認したいB
B
のすべてのオブジェクトを処理する前にストリームを排出せずにこれを処理する方法がわかりませんA
。
B
私が最初に考えたのは、 の各エントリのクローンを作成することでしたA
。それは可能ですか?
私の現在の試みはevent-streams
es.map
、ストリーム上A
およびマップ関数内で使用して、B
それを読み取って比較しようとしていることです。しかし、これは私に与えています:A
B
B
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
B
のマップ内でリスナーを再定義しているため、エラーが発生しましたA