View Source Gnat.Jetstream.API.Object (gnat v1.9.0)

API for interacting with the JetStream Object Store

Learn more about Object Store: https://docs.nats.io/nats-concepts/jetstream/obj_store

Link to this section Summary

Link to this section Types

Specs

bucket_opt() ::
  {:description, String.t()}
  | {:max_bucket_size, integer()}
  | {:max_chunk_size, integer()}
  | {:placement, Gnat.Jetstream.API.Stream.placement()}
  | {:replicas, non_neg_integer()}
  | {:storage, :file | :memory}
  | {:ttl, non_neg_integer()}

Specs

list_option() :: {:show_deleted, boolean()}

Link to this section Functions

Link to this function

create_bucket(conn, bucket_name, params \\ [])

View Source

Specs

create_bucket(Gnat.t(), String.t(), [bucket_opt()]) ::
  {:ok, Gnat.Jetstream.API.Stream.info()} | {:error, any()}
Link to this function

delete(conn, bucket_name, object_name)

View Source

Specs

delete(Gnat.t(), String.t(), String.t()) :: :ok | {:error, any()}
Link to this function

delete_bucket(conn, bucket_name)

View Source

Specs

delete_bucket(Gnat.t(), String.t()) :: :ok | {:error, any()}
Link to this function

get(conn, bucket_name, object_name, chunk_fun)

View Source

Specs

get(Gnat.t(), String.t(), String.t(), (binary() -> any())) ::
  :ok | {:error, any()}
Link to this function

info(conn, bucket_name, object_name)

View Source

Specs

info(Gnat.t(), String.t(), String.t()) ::
  {:ok, Gnat.Jetstream.API.Object.Meta.t()} | {:error, any()}
Link to this function

is_object_bucket_stream?(stream_name)

View Source

Specs

is_object_bucket_stream?(stream_name :: binary()) :: boolean()

Returns true if the provided stream is an Object bucket, false otherwise

Parameters

  • stream_name - the stream name to test
Link to this function

list(conn, bucket_name, options \\ [])

View Source

Specs

list(Gnat.t(), String.t(), [list_option()]) ::
  {:error, any()} | {:ok, [Gnat.Jetstream.API.Object.Meta.t()]}

Specs

list_buckets(conn :: Gnat.t()) :: {:error, term()} | {:ok, [String.t()]}

Returns a list of all Object buckets

Link to this function

put(conn, bucket_name, object_name, io)

View Source

Specs

put(Gnat.t(), String.t(), String.t(), File.io_device()) ::
  {:ok, Gnat.Jetstream.API.Object.Meta.t()} | {:error, any()}