pub struct ObjectStore { /* private fields */ }
Expand description

A blob store capable of storing large objects efficiently in streams.

Implementations§

Gets an Object from the ObjectStore.

Object implements tokio::io::AsyncRead that allows to read the data from Object Store.

Examples
use tokio::io::AsyncReadExt;
let client = async_nats::connect("demo.nats.io").await?;
let jetstream = async_nats::jetstream::new(client);

let bucket = jetstream.get_object_store("store").await?;
let mut object = bucket.get("FOO").await?;

// Object implements `tokio::io::AsyncRead`.
let mut bytes = vec![];
object.read_to_end(&mut bytes).await?;

Gets an Object from the ObjectStore.

Object implements tokio::io::AsyncRead that allows to read the data from Object Store.

Examples
let client = async_nats::connect("demo.nats.io").await?;
let jetstream = async_nats::jetstream::new(client);

let bucket = jetstream.get_object_store("store").await?;
bucket.delete("FOO").await?;

Retrieves Object ObjectInfo.

Examples
let client = async_nats::connect("demo.nats.io").await?;
let jetstream = async_nats::jetstream::new(client);

let bucket = jetstream.get_object_store("store").await?;
let info = bucket.info("FOO").await?;

Puts an Object into the ObjectStore. This method implements tokio::io::AsyncRead.

Examples
let client = async_nats::connect("demo.nats.io").await?;
let jetstream = async_nats::jetstream::new(client);

let bucket = jetstream.get_object_store("store").await?;
let mut file = tokio::fs::File::open("foo.txt").await?;
bucket.put("file", &mut file).await.unwrap();

Creates a Watch stream over changes in the ObjectStore.

Examples
use futures::StreamExt;
let client = async_nats::connect("demo.nats.io").await?;
let jetstream = async_nats::jetstream::new(client);

let bucket = jetstream.get_object_store("store").await?;
let mut watcher = bucket.watch().await.unwrap();
while let Some(object) = watcher.next().await {
    println!("detected changes in {:?}", object?);
}

Returns a List stream with all not deleted Objects in the ObjectStore.

Examples
use futures::StreamExt;
let client = async_nats::connect("demo.nats.io").await?;
let jetstream = async_nats::jetstream::new(client);

let bucket = jetstream.get_object_store("store").await?;
let mut list = bucket.list().await.unwrap();
while let Some(object) = list.next().await {
    println!("object {:?}", object?);
}

Seals a ObjectStore, preventing any further changes to it or its Objects.

Examples
use futures::StreamExt;
let client = async_nats::connect("demo.nats.io").await?;
let jetstream = async_nats::jetstream::new(client);

let mut bucket = jetstream.get_object_store("store").await?;
bucket.seal().await.unwrap();

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more