Skip to content

Commit

Permalink
Add compression option to kv
Browse files Browse the repository at this point in the history
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
  • Loading branch information
Jarema committed Oct 29, 2023
1 parent 360e7c8 commit 09afb0e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions async-nats/src/jetstream/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,8 @@ impl Context {
num_replicas,
discard: stream::DiscardPolicy::New,
mirror_direct: config.mirror_direct,
#[cfg(feature = "server_2_10")]
compression: config.compression,
..Default::default()
})
.await
Expand Down
7 changes: 5 additions & 2 deletions async-nats/src/jetstream/kv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ use super::{
consumer::{push::OrderedError, DeliverPolicy, StreamError, StreamErrorKind},
context::{PublishError, PublishErrorKind},
stream::{
ConsumerError, ConsumerErrorKind, DirectGetError, DirectGetErrorKind, RawMessage,
Republish, Source, StorageType, Stream,
Compression, ConsumerError, ConsumerErrorKind, DirectGetError, DirectGetErrorKind,
RawMessage, Republish, Source, StorageType, Stream,
},
};

Expand Down Expand Up @@ -120,6 +120,9 @@ pub struct Config {
pub sources: Option<Vec<Source>>,
/// Allow mirrors using direct API.
pub mirror_direct: bool,
/// Compression
#[cfg(feature = "server_2_10")]
pub compression: Option<Compression>,
}

/// Describes what kind of operation and entry represents
Expand Down
1 change: 0 additions & 1 deletion async-nats/src/jetstream/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,6 @@ pub struct Config {
/// to [Compression::None], which is different from not overriding global config with anything.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub compression: Option<Compression>,

#[cfg(feature = "server_2_10")]
/// Set limits on consumers that are created on this stream.
#[serde(default, deserialize_with = "default_consumer_limits_as_none")]
Expand Down

0 comments on commit 09afb0e

Please sign in to comment.