Skip to content

Commit

Permalink
Changes made after review with Christoph plus added compression of jo…
Browse files Browse the repository at this point in the history
…urnals
  • Loading branch information
john-sharratt committed Nov 27, 2023
1 parent 69bcc61 commit d494348
Show file tree
Hide file tree
Showing 69 changed files with 1,530 additions and 1,466 deletions.
20 changes: 20 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion lib/cli/src/commands/journal/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,13 @@ pub struct CmdJournalFilter {
/// Path to the journal that will be the output of the filter
#[clap(index = 2)]
target_path: PathBuf,
/// Filters to be applied to the output journal
/// Filters to be applied to the output journal, filter options are
/// - 'mem' | 'memory' -> removes all WASM memory related events
/// - 'thread' | 'threads' -> removes all events related to the state of the threads
/// - 'fs' | 'file' -> removes file system mutation events
/// - 'core' -> removes core operating system operations such as TTY
/// - 'snap' | 'snapshot' -> removes the snapshots from the journal
/// - 'net' | 'network' -> removes network socket and interface events
#[clap(short, long = "filter")]
filters: Vec<FilterOut>,
}
Expand Down
1 change: 1 addition & 0 deletions lib/wasix/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ bytecheck = "0.6.8"
shared-buffer = "0.1"
petgraph = "0.6.3"
base64 = "0.21"
lz4_flex = { version = "0.11" }
rayon = { version = "1.7.0", optional = true }
wasm-bindgen = { version = "0.2.87", optional = true }
js-sys = { version = "0.3.64", optional = true }
Expand Down
13 changes: 9 additions & 4 deletions lib/wasix/src/journal/base64.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
use std::borrow::Cow;

use lz4_flex::block::{compress_prepend_size, decompress_size_prepended};

use serde::{Deserialize, Serialize};
use serde::{Deserializer, Serializer};

pub fn serialize<S: Serializer>(v: &[u8], s: S) -> Result<S::Ok, S::Error> {
#[allow(deprecated)]
let base64 = base64::encode(v);
let base64 = base64::encode(compress_prepend_size(v));
String::serialize(&base64, s)
}

pub fn deserialize<'de, D: Deserializer<'de>>(d: D) -> Result<Cow<'static, [u8]>, D::Error> {
let base64 = String::deserialize(d)?;
#[allow(deprecated)]
base64::decode(base64.as_bytes())
.map_err(serde::de::Error::custom)
.map(|d| d.into())
base64::decode(
decompress_size_prepended(base64.as_bytes())
.map_err(|err| serde::de::Error::custom(err))?,
)
.map_err(serde::de::Error::custom)
.map(|d| d.into())
}
654 changes: 333 additions & 321 deletions lib/wasix/src/journal/concrete/archived.rs

Large diffs are not rendered by default.

Loading

0 comments on commit d494348

Please sign in to comment.