Spear.get_stream_metadata

You're seeing just the function get_stream_metadata, go back to Spear module for more information.
Link to this function

get_stream_metadata(conn, stream, opts \\ [])

View Source (since 0.1.3)

Specs

get_stream_metadata(
  connection :: Spear.Connection.t(),
  stream :: String.t(),
  opts :: Keyword.t()
) :: {:ok, Spear.StreamMetadata.t()} | {:error, any()}

Queries the metadata for a stream

Note that the stream argument is passed through meta_stream/1 before being read. It is not necessary to call that function on the stream name before passing it as stream.

If no metadata has been set on a stream {:error, :unset} is returned.

Options

Under the hood, get_stream_metadata/3 uses read_stream/3 and all options are passed directly to that function. These options are overridden, however, and cannot be changed:

  • :direction
  • :from
  • :max_count
  • :raw?

Examples

iex> Spear.get_stream_metadata(conn, "my_stream")
{:error, :unset}
iex> Spear.get_stream_metadata(conn, "some_stream_with_max_count")
{:ok, %Spear.StreamMetadata{max_count: 50_000, ..}}