Skip to content

Commit ecd0eb8

Browse files
committed
feat: added compression at session_log side
1 parent 88c5f1c commit ecd0eb8

13 files changed

Lines changed: 488 additions & 92 deletions

File tree

crates/Cargo.lock

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

crates/cojson-core-napi/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ struct PrivateTransactionResult {
5656
encrypted_changes: String,
5757
#[serde(skip_serializing_if = "Option::is_none")]
5858
meta: Option<String>,
59+
#[serde(skip_serializing_if = "Option::is_none")]
60+
encoding: Option<String>,
5961
}
6062

6163
#[napi]
@@ -132,6 +134,7 @@ impl SessionLog {
132134
signature: signature.0,
133135
encrypted_changes: private_tx.encrypted_changes.value,
134136
meta: private_tx.meta.map(|meta| meta.value),
137+
encoding: private_tx.encoding.map(|encoding| encoding.into()),
135138
},
136139
_ => {
137140
return napi::Result::Err(napi::Error::new(
12.3 KB
Binary file not shown.

crates/cojson-core-wasm/public/cojson_core_wasm.wasm.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/cojson-core-wasm/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ struct PrivateTransactionResult {
5858
encrypted_changes: String,
5959
#[serde(skip_serializing_if = "Option::is_none")]
6060
meta: Option<String>,
61+
#[serde(skip_serializing_if = "Option::is_none")]
62+
encoding: Option<String>
6163
}
6264

6365
#[wasm_bindgen]
@@ -135,6 +137,7 @@ impl SessionLog {
135137
signature: signature.0,
136138
encrypted_changes: private_tx.encrypted_changes.value,
137139
meta: private_tx.meta.map(|meta| meta.value),
140+
encoding: private_tx.encoding.map(|encoding| encoding.into()),
138141
},
139142
_ => {
140143
return Err(CojsonCoreWasmError::Js(JsValue::from_str(

crates/cojson-core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ salsa20 = "0.10.2"
1717
rand = "0.8"
1818
x25519-dalek = { version = "2.0", features = ["getrandom", "static_secrets"] }
1919
lru = "0.16.1"
20+
lz4_flex = { version = "0.11" }
2021

2122
[dev-dependencies]
2223
rand_core = { version = "0.6", features = ["getrandom"] }

crates/cojson-core/src/core/error.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,7 @@ pub enum CoJsonCoreError {
2828

2929
#[error("Invalid base58")]
3030
InvalidBase58(#[from] bs58::decode::Error),
31+
32+
#[error("Invalid encoding")]
33+
InvalidEncoding,
3134
}

0 commit comments

Comments
 (0)