Switch to Rust 2018
This commit is contained in:
@@ -3,6 +3,7 @@ authors = ["Erik Johnston"]
|
||||
description = "A tool to compress some state in a Synapse instance's database"
|
||||
name = "synapse-compress-state"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
clap = "2.32.0"
|
||||
|
||||
@@ -33,8 +33,7 @@ use state_map::StateMap;
|
||||
use std::collections::BTreeMap;
|
||||
use string_cache::DefaultAtom as Atom;
|
||||
|
||||
use collapse_state_maps;
|
||||
use StateGroupEntry;
|
||||
use super::{collapse_state_maps, StateGroupEntry};
|
||||
|
||||
/// Holds information about a particular level.
|
||||
struct Level {
|
||||
|
||||
@@ -18,7 +18,7 @@ use postgres::{Connection, TlsMode};
|
||||
use rand::{distributions::Alphanumeric, thread_rng, Rng};
|
||||
use std::{borrow::Cow, collections::BTreeMap, fmt};
|
||||
|
||||
use StateGroupEntry;
|
||||
use super::StateGroupEntry;
|
||||
|
||||
/// Fetch the entries in state_groups_state (and their prev groups) for the
|
||||
/// given `room_id` by connecting to the postgres database at `db_url`.
|
||||
@@ -174,7 +174,7 @@ fn get_missing_from_db(conn: &Connection, missing_sgs: &[i64]) -> BTreeMap<i64,
|
||||
pub struct PGEscapse<'a>(pub &'a str);
|
||||
|
||||
impl<'a> fmt::Display for PGEscapse<'a> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let mut delim = Cow::from("$$");
|
||||
while self.0.contains(&delim as &str) {
|
||||
let s: String = thread_rng().sample_iter(&Alphanumeric).take(10).collect();
|
||||
|
||||
15
src/main.rs
15
src/main.rs
@@ -16,17 +16,6 @@
|
||||
//! Synapse instance's database. Specifically, it aims to reduce the number of
|
||||
//! rows that a given room takes up in the `state_groups_state` table.
|
||||
|
||||
#[macro_use]
|
||||
extern crate clap;
|
||||
extern crate fallible_iterator;
|
||||
extern crate indicatif;
|
||||
extern crate jemallocator;
|
||||
extern crate postgres;
|
||||
extern crate rand;
|
||||
extern crate rayon;
|
||||
extern crate state_map;
|
||||
extern crate string_cache;
|
||||
|
||||
mod compressor;
|
||||
mod database;
|
||||
|
||||
@@ -36,7 +25,9 @@ static GLOBAL: jemallocator::Jemalloc = jemallocator::Jemalloc;
|
||||
use compressor::Compressor;
|
||||
use database::PGEscapse;
|
||||
|
||||
use clap::{App, Arg};
|
||||
use clap::{
|
||||
crate_authors, crate_description, crate_name, crate_version, value_t_or_exit, App, Arg,
|
||||
};
|
||||
use indicatif::{ProgressBar, ProgressStyle};
|
||||
use rayon::prelude::*;
|
||||
use state_map::StateMap;
|
||||
|
||||
Reference in New Issue
Block a user