Gnat.Jetstream.API.Object (gnat v1.18.1)
View SourceAPI for interacting with the JetStream Object Store
Learn more about Object Store: https://docs.nats.io/nats-concepts/jetstream/obj_store
Summary
Functions
Streams an object's chunks through chunk_fun and verifies its size and SHA-256 digest.
Returns true if the provided stream is an Object bucket, false otherwise
Lists object metadata in a bucket.
Returns a list of all Object buckets
Types
@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()}
@type list_option() :: {:show_deleted, boolean()} | {:timeout, non_neg_integer()} | {:total_timeout, non_neg_integer() | :infinity}
Functions
@spec create_bucket(Gnat.t(), String.t(), [bucket_opt()]) :: {:ok, Gnat.Jetstream.API.Stream.info()} | {:error, any()}
@spec get(Gnat.t(), String.t(), String.t(), (binary() -> any()), keyword()) :: :ok | {:error, any()}
Streams an object's chunks through chunk_fun and verifies its size and SHA-256 digest.
Chunks reach the callback before the final integrity check. Treat the result as
unverified until this function returns :ok. Callback exceptions propagate after
subscription and consumer cleanup is attempted.
Options
:timeout- (non-negative integer) the maximum wait for each object chunk, in milliseconds. The wait restarts after each data callback returns. Heartbeats and flow-control messages don't restart it. Defaults to10_000.:total_timeout- (non-negative integer or:infinity) the total receive deadline, in milliseconds, starting after consumer creation. Each wait is limited by both this deadline and:timeout. Callback time counts toward the deadline, but callbacks aren't interrupted. Defaults to:infinity.
@spec info(Gnat.t(), String.t(), String.t()) :: {:ok, Gnat.Jetstream.API.Object.Meta.t()} | {:error, any()}
Returns true if the provided stream is an Object bucket, false otherwise
Parameters
stream_name- the stream name to test
@spec list(Gnat.t(), String.t(), [list_option()]) :: {:error, any()} | {:ok, [Gnat.Jetstream.API.Object.Meta.t()]}
Lists object metadata in a bucket.
Options
:show_deleted- (boolean) whether to include deleted objects in the result. Defaults tofalse.:timeout- (non-negative integer) the maximum wait for each object's metadata, in milliseconds. The wait restarts after each metadata message. Heartbeats and flow-control messages don't restart it. Defaults to10_000.:total_timeout- (non-negative integer or:infinity) the total receive deadline, in milliseconds, starting after consumer creation. Each wait is limited by both this deadline and:timeout. Defaults to:infinity.
Returns a list of all Object buckets
@spec put(Gnat.t(), String.t(), String.t(), File.io_device()) :: {:ok, Gnat.Jetstream.API.Object.Meta.t()} | {:error, any()}