Browse Source

various cleanups

Michael Ekstrand 1 year ago
parent
commit
3be00dcf53
6 changed files with 7 additions and 18 deletions
  1. 0
    11
      Cargo.lock
  2. 1
    2
      Cargo.toml
  3. 1
    2
      src/bin/import-ntriples.rs
  4. 2
    2
      src/bin/make-uuid.rs
  5. 1
    0
      src/cleaning/pg.rs
  6. 2
    1
      src/db.rs

+ 0
- 11
Cargo.lock

@@ -97,7 +97,6 @@ dependencies = [
  "os_pipe 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "postgres 0.15.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "quick-xml 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "snap 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "stderrlog 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "uuid 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -901,15 +900,6 @@ dependencies = [
  "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
-[[package]]
-name = "snap"
-version = "0.2.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
 [[package]]
 name = "socket2"
 version = "0.3.8"
@@ -1279,7 +1269,6 @@ dependencies = [
 "checksum sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9eb6be24e4c23a84d7184280d2722f7f2731fcdd4a9d886efbfe4413e4847ea0"
 "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac"
 "checksum smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "88aea073965ab29f6edb5493faf96ad662fb18aa9eeb186a3b7057951605ed15"
-"checksum snap 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "95d697d63d44ad8b78b8d235bf85b34022a78af292c8918527c5f0cffdde7f43"
 "checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7"
 "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
 "checksum stderrlog 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "61dc66b7ae72b65636dbf36326f9638fb3ba27871bb737a62e2c309b87d91b70"

+ 1
- 2
Cargo.toml

@@ -13,8 +13,7 @@ zip = "0.5.0"
 log = "^0.4.0"
 stderrlog = "^0.4.0"
 derive_more = "0.9"
-snap = "0.2.5"
-uuid = { version = "0.5", features = ["v4", "v5"] }
+uuid = { version = "0.5", features = ["v1", "v4", "v5"] }
 os_pipe = "0.8.1"
 postgres = { version="0.15.2", features=["with-uuid"] }
 crossbeam-channel = "0.3"

+ 1
- 2
src/bin/import-ntriples.rs

@@ -17,10 +17,9 @@ use std::thread;
 
 use structopt::StructOpt;
 use std::fs;
-use std::path::{Path, PathBuf};
+use std::path::{PathBuf};
 use zip::read::ZipArchive;
 use indicatif::{ProgressBar, ProgressStyle};
-use postgres::Connection;
 use uuid::Uuid;
 
 use ntriple::parser::triple_line;

+ 2
- 2
src/bin/make-uuid.rs

@@ -17,13 +17,13 @@ fn main() {
   let opt = Opt::from_args();
 
   let ns = match opt.namespace {
-    None => uuid::Uuid::nil(),
+    None => Uuid::nil(),
     Some(ref s) if s == "url" => uuid::NAMESPACE_URL,
     Some(ref s) => uuid::Uuid::new_v5(&uuid::Uuid::nil(), s)
   };
 
   for s in opt.string {
-    let u = uuid::Uuid::new_v5(&ns, &s);
+    let u = Uuid::new_v5(&ns, &s);
     println!("{}\t{}", u, s);
   }
 }

+ 1
- 0
src/cleaning/pg.rs

@@ -1,3 +1,4 @@
+#[cfg(test)]
 use std::str;
 use std::io::{self, Write};
 

+ 2
- 1
src/db.rs

@@ -21,7 +21,7 @@ pub fn db_open(url: &Option<String>) -> Result<Connection> {
 }
 
 pub struct CopyTarget {
-  writer: Option<os_pipe::PipeWriter>,
+  writer: Option<PipeWriter>,
   thread: Option<thread::JoinHandle<u64>>
 }
 
@@ -57,6 +57,7 @@ pub fn copy_target(url: &Option<String>, query: &str, name: &str) -> Result<Copy
   let jh = tb.spawn(move || {
     let query = query;
     let db = db_open(&url).unwrap();
+    info!("preparing {}", query);
     let stmt = db.prepare(&query).unwrap();
     stmt.copy_in(&[], &mut reader).unwrap()
   })?;