Skip to content

Commit 677ed6d

Browse files
author
tac0turtle
committed
move compression to types
1 parent c5be508 commit 677ed6d

File tree

7 files changed

+25
-19
lines changed

7 files changed

+25
-19
lines changed

Cargo.lock

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/crates/client/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ thiserror = "1.0"
2020
tracing = "0.1"
2121
futures = "0.3"
2222
async-trait = "0.1"
23-
zstd = "0.13"
24-
bytes = "1.5"
2523

2624
[dev-dependencies]
2725
tokio-test = "0.4"

client/crates/client/src/lib.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@
1111
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
1212
//! // Connect to a Evolve node
1313
//! let client = Client::connect("http://localhost:50051").await?;
14-
//!
14+
//!
1515
//! // Check health
1616
//! let health = HealthClient::new(&client);
1717
//! let is_healthy = health.is_healthy().await?;
1818
//! println!("Node healthy: {}", is_healthy);
19-
//!
19+
//!
2020
//! // Get namespace configuration
2121
//! let config = ConfigClient::new(&client);
2222
//! let namespace = config.get_namespace().await?;
2323
//! println!("Header namespace: {}", namespace.header_namespace);
2424
//! println!("Data namespace: {}", namespace.data_namespace);
25-
//!
25+
//!
2626
//! Ok(())
2727
//! }
2828
//! ```
@@ -42,7 +42,7 @@
4242
//! .connect_timeout(Duration::from_secs(10))
4343
//! .build()
4444
//! .await?;
45-
//!
45+
//!
4646
//! Ok(())
4747
//! }
4848
//! ```
@@ -61,23 +61,22 @@
6161
//! .tls() // Enable TLS with default configuration
6262
//! .build()
6363
//! .await?;
64-
//!
64+
//!
6565
//! // Or with custom TLS configuration
6666
//! let tls_config = ClientTlsConfig::new()
6767
//! .domain_name("secure-node.ev.xyz");
68-
//!
68+
//!
6969
//! let client = Client::builder()
7070
//! .endpoint("https://secure-node.ev.xyz")
7171
//! .tls_config(tls_config)
7272
//! .build()
7373
//! .await?;
74-
//!
74+
//!
7575
//! Ok(())
7676
//! }
7777
//! ```
7878
7979
pub mod client;
80-
pub mod compression;
8180
pub mod config;
8281
pub mod error;
8382
pub mod health;
@@ -87,9 +86,6 @@ pub mod store;
8786

8887
// Re-export main types for convenience
8988
pub use client::{Client, ClientBuilder};
90-
pub use compression::{
91-
compress_blob, decompress_blob, get_compression_info, BlobCompressor, CompressionInfo,
92-
};
9389
pub use config::ConfigClient;
9490
pub use error::{ClientError, Result};
9591
pub use health::HealthClient;

client/crates/types/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ walkdir = { workspace = true }
2525
prost = { workspace = true }
2626
prost-types = { workspace = true }
2727
tonic = { workspace = true, optional = true, features = ["transport"] }
28+
bytes = "1.5"
29+
thiserror = "1.0"
30+
zstd = "0.13"

client/crates/client/src/compression.rs renamed to client/crates/types/src/compression.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,4 +369,4 @@ mod tests {
369369
assert!(info.compression_ratio < 1.0);
370370
assert!(info.compression_ratio > 0.0);
371371
}
372-
}
372+
}

client/crates/types/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
pub mod compression;
2+
13
pub mod v1 {
24
// Always include the pure message types (no tonic dependencies)
35
#[cfg(not(feature = "grpc"))]
@@ -7,3 +9,9 @@ pub mod v1 {
79
#[cfg(feature = "grpc")]
810
include!("proto/evnode.v1.services.rs");
911
}
12+
13+
// Re-export compression types for convenience
14+
pub use compression::{
15+
compress_blob, decompress_blob, get_compression_info, BlobCompressor, CompressionError,
16+
CompressionInfo,
17+
};

client/crates/client/tests/compression_test.rs renamed to client/crates/types/tests/compression_test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//! Comprehensive tests for blob compression/decompression
22
//! These tests match the behavior of the Go implementation
33
4-
use ev_client::compression::*;
5-
use ev_client::{compress_blob, decompress_blob, get_compression_info};
4+
use ev_types::compression::*;
5+
use ev_types::{compress_blob, decompress_blob, get_compression_info};
66

77
#[test]
88
fn test_zstd_compression() {
@@ -227,4 +227,4 @@ fn test_compression_with_different_levels() {
227227
for (level, size) in sizes {
228228
println!(" Level {level}: {size} bytes");
229229
}
230-
}
230+
}

0 commit comments

Comments
 (0)