View Source Kvasir.Source behaviour (kvasir v0.0.18)

Link to this section Summary

Link to this section Callbacks

@callback child_spec(name :: atom(), opts :: Keyword.t()) :: false | map()
@callback commit(name :: atom(), Kvasir.Topic.t(), Kvasir.Event.t()) ::
  {:ok, Kvasir.Event.t()} | {:error, atom()}
Link to this callback

contains?(name, topic, t)

View Source
@callback contains?(name :: atom(), Kvasir.topic(), Kvasir.Offset.t()) ::
  :maybe | true | false
Link to this callback

generate_dedicated_publisher(name, target, t, opts)

View Source
@callback generate_dedicated_publisher(
  name :: atom(),
  target :: module(),
  Kvasir.Topic.t(),
  opts :: Keyword.t()
) :: :ok | {:error, atom()}
Link to this callback

listen(name, topic, callback, opts)

View Source
@callback listen(
  name :: atom(),
  Kvasir.topic(),
  callback :: (Kvasir.Event.t() -> :ok | {:error, reason :: atom()}),
  opts :: Kvasir.EventSource.stream_opts()
) :: :ok | {:error, atom()}
Link to this callback

stream(name, topic, opts)

View Source
@callback stream(name :: atom(), Kvasir.topic(), opts :: Kvasir.EventSource.stream_opts()) ::
  {:ok, Stream.t()} | {:error, atom()}
Link to this callback

subscribe(name, topic, opts)

View Source
@callback subscribe(
  name :: atom(),
  Kvasir.topic(),
  opts :: Kvasir.EventSource.stream_opts()
) ::
  {:ok, pid()} | {:error, atom()}