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

API for interacting with the JetStream Object Store

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

Summary

Types

bucket_opt()

@type 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()}

list_option()

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

Functions

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

@spec create_bucket(Gnat.t(), String.t(), [bucket_opt()]) ::
  {:ok, Gnat.Jetstream.API.Stream.info()} | {:error, any()}

delete(conn, bucket_name, object_name)

@spec delete(Gnat.t(), String.t(), String.t()) :: :ok | {:error, any()}

delete_bucket(conn, bucket_name)

@spec delete_bucket(Gnat.t(), String.t()) :: :ok | {:error, any()}

get(conn, bucket_name, object_name, chunk_fun)

@spec get(Gnat.t(), String.t(), String.t(), (binary() -> any())) ::
  :ok | {:error, any()}

info(conn, bucket_name, object_name)

@spec info(Gnat.t(), String.t(), String.t()) ::
  {:ok, Gnat.Jetstream.API.Object.Meta.t()} | {:error, any()}

is_object_bucket_stream?(stream_name)

@spec 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

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

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

list_buckets(conn)

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

Returns a list of all Object buckets

put(conn, bucket_name, object_name, io)

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