Skip to content

Commit

Permalink
Add compression to object store
Browse files Browse the repository at this point in the history
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
  • Loading branch information
Jarema committed Feb 22, 2024
1 parent 8696d42 commit 999ace3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
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

0 comments on commit 999ace3

Please sign in to comment.