6 Commits

Author SHA1 Message Date
Sean Quah
98f02f2667 Configure @matrix-org/synapse-core to be the code owner for the repo
Signed-off-by: Sean Quah <seanq@element.io>
2021-10-22 19:43:24 +01:00
Erik Johnston
5272acedd2 Merge pull request #32 2021-10-13 10:19:25 +01:00
Erik Johnston
9d642cfb67 Release v0.1.2 of auto compressor 2021-10-06 10:55:47 +01:00
Erik Johnston
0111079153 Make the auto compressor uploadable to pypi (#75) 2021-09-28 16:57:13 +01:00
Jörg Sommer
2fc2db2848 Update dependencies 2021-05-13 17:25:48 +02:00
Jörg Sommer
4f823fba78 Use saturating arithmetic on calculating row saving
The saturating arithmetic doesn't overflow, but stays at the maximum or
minimum. In this case it doesn't become negative, but zero, which
satisfies the condition below.

Closes #31
2021-05-13 17:25:37 +02:00
4 changed files with 8 additions and 6 deletions

2
.github/CODEOWNERS vendored Normal file
View File

@@ -0,0 +1,2 @@
# Automatically request reviews from the synapse-core team when a pull request comes in.
* @matrix-org/synapse-core

2
Cargo.lock generated
View File

@@ -1104,7 +1104,7 @@ dependencies = [
[[package]]
name = "synapse_auto_compressor"
version = "0.1.1"
version = "0.1.2"
dependencies = [
"anyhow",
"clap",

View File

@@ -27,7 +27,7 @@ use clap::{crate_authors, crate_description, crate_name, crate_version, value_t,
use indicatif::{ProgressBar, ProgressStyle};
use rayon::prelude::*;
use state_map::StateMap;
use std::{collections::BTreeMap, fs::File, io::Write, str::FromStr};
use std::{collections::BTreeMap, convert::TryInto, fs::File, io::Write, str::FromStr};
use string_cache::DefaultAtom as Atom;
mod compressor;
@@ -162,7 +162,7 @@ impl Config {
Arg::with_name("groups_to_compress")
.short("n")
.value_name("GROUPS_TO_COMPRESS")
.help("How many groups to load into memory to compress")
.help("How many groups to load into memory to compress")
.long_help(concat!(
"How many groups to load into memory to compress (starting from",
" the 1st group in the room or the group specified by -s)"))
@@ -362,8 +362,8 @@ pub fn run(mut config: Config) {
}
if let Some(min) = config.min_saved_rows {
let saving = (original_summed_size - compressed_summed_size) as i32;
if saving < min {
let saving = original_summed_size.saturating_sub(compressed_summed_size);
if saving < min.try_into().unwrap_or(0) {
warn!(
"Only {} rows would be saved by this compression. Skipping output.",
saving

View File

@@ -1,7 +1,7 @@
[package]
name = "synapse_auto_compressor"
authors = ["William Ashton"]
version = "0.1.1"
version = "0.1.2"
edition = "2018"
[package.metadata.maturin]