Strom.Mixer (strom v0.9.1)

View Source

Mix several streams into one. Use Strom.GenMix under the hood

## Example
iex> alias Strom.Mixer
iex> mixer = [:s1, :s2] |> Mixer.new(:stream) |> Mixer.start()
iex> flow = %{s1: [1, 2, 3], s2: [4, 5, 6]}
iex> %{stream: stream} = Mixer.call(flow, mixer)
iex> stream |> Enum.to_list() |> Enum.sort()
[1, 2, 3, 4, 5, 6]

Summary

Types

event()

@type event() :: any()

t()

@type t() :: %Strom.Mixer{
  composite: term(),
  inputs: term(),
  opts: term(),
  outputs: term(),
  pid: term()
}

Functions

call(flow, mixer)

@spec call(Strom.flow(), t()) :: Strom.flow()

new(inputs, output, opts \\ [])

@spec new(
  [Strom.stream_name()]
  | %{required(Strom.stream_name()) => (event() -> as_boolean(any()))},
  Strom.stream_name(),
  list()
) :: t()

process_chunk(input_stream_name, chunk, outputs, atom)

start(mixer)

@spec start(t()) :: t()

stop(mixer)

@spec stop(t()) :: :ok