Skip to content

Conversation

@rekmarks
Copy link
Member

@rekmarks rekmarks commented Apr 28, 2025

We removed stream multiplexing in #349 because we no longer had a use for it. With some of the plans we have for our logger, we once again find ourselves in a position where we'd like to differentiate traffic over a single stream. Multiplexing was pretty complex, so we'd prefer not to go back to it if possible. With these requirements in mind, this PR introduces "stream splitting" via the function split() exported from @ocap/streams.

The idea is simple: pass split() a duplex stream and a number of type predicates, and receive an array of streams in return. Each stream represents the subset of the parent stream's traffic satisfying the corresponding predicate. Not very efficient for large numbers of channels or complex predicates, but our usage should be simple enough.

@rekmarks rekmarks requested a review from a team as a code owner April 28, 2025 23:48
@rekmarks rekmarks requested a review from grypez April 28, 2025 23:48
@rekmarks rekmarks force-pushed the rekm/stream-splicing branch from 3a21204 to d19e1be Compare April 28, 2025 23:57
@rekmarks rekmarks enabled auto-merge (squash) April 29, 2025 04:09
Copy link
Contributor

@sirtimid sirtimid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I have some minor TS comments and a more important one with that harden

@rekmarks rekmarks requested a review from sirtimid April 29, 2025 17:46
Copy link
Contributor

@sirtimid sirtimid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@rekmarks rekmarks merged commit 659a47d into main Apr 29, 2025
21 checks passed
@rekmarks rekmarks deleted the rekm/stream-splicing branch April 29, 2025 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants