Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compression to object store #1217

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions async-nats/src/jetstream/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ use super::is_valid_name;
use super::kv::{Store, MAX_HISTORY};
use super::object_store::{is_valid_bucket_name, ObjectStore};
use super::stream::{
self, Config, ConsumerError, ConsumerErrorKind, DeleteStatus, DiscardPolicy, External, Info,
Stream,
self, Compression, Config, ConsumerError, ConsumerErrorKind, DeleteStatus, DiscardPolicy,
External, Info, Stream,
};

/// A context which can perform jetstream scoped requests.
Expand Down Expand Up @@ -1045,6 +1045,11 @@ impl Context {
discard: DiscardPolicy::New,
allow_rollup: true,
allow_direct: true,
compression: if config.compression {
Some(Compression::S2)
} else {
None
},
..Default::default()
})
.await
Expand Down
2 changes: 2 additions & 0 deletions async-nats/src/jetstream/object_store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ pub struct Config {
pub storage: StorageType,
/// How many replicas to keep for each value in a cluster, maximum 5.
pub num_replicas: usize,
/// Sets compression of the underlying stream.
pub compression: bool,
}

/// A blob store capable of storing large objects efficiently in streams.
Expand Down
Loading