First pass at a protocol is
The goal is to make this more generic (not just specific to merge). Initial thought is:
defprotocol Connectable do
def connect(source, target)
def disconnect(connection)
end
I think that connect should return some sort of connection. disconnect will accept that as an input. This will contain the protocol so implementations can do whatever they want.
Potential uses:
Stream.Merge would connect each of the substreams to the target, allowing us to collapse nested merges.
GenEvent.Streams could be merged without an intermediate process.
Stream.Interval could call :timer.send_interval rather than spawn a new process. disconnect would cancel the timer.
and more...
First pass at a protocol is
streamz/lib/streamz/merge.ex
Line 93 in 6c416d0
The goal is to make this more generic (not just specific to merge). Initial thought is:
I think that
connectshould return some sort of connection.disconnectwill accept that as an input. This will contain the protocol so implementations can do whatever they want.Potential uses:
Stream.Merge would connect each of the substreams to the target, allowing us to collapse nested merges.
GenEvent.Streams could be merged without an intermediate process.
Stream.Interval could call
:timer.send_intervalrather than spawn a new process.disconnectwould cancel the timer.and more...