-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace resolver rocksdb with sqlite
- Loading branch information
Showing
55 changed files
with
1,580 additions
and
793 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
13 changes: 13 additions & 0 deletions
13
dataload/06_prepare_db_import/grebi_make_compressed_blob/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[package] | ||
name = "grebi_make_compressed_blob" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
clap = { version = "4.4.11", features = ["derive"] } | ||
grebi_shared = { path = "../../grebi_shared" } | ||
flate2 = {version="1.0.28", features=["zlib-ng"]} | ||
serde_json = { version = "1.0.108", features=["preserve_order"] } | ||
jemallocator = "0.5.4" | ||
|
||
|
52 changes: 52 additions & 0 deletions
52
dataload/06_prepare_db_import/grebi_make_compressed_blob/src/main.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
|
||
use flate2::write::ZlibEncoder; | ||
use flate2::Compression; | ||
use grebi_shared::get_id; | ||
use std::io::BufReader; | ||
use std::io::BufRead; | ||
use std::io::BufWriter; | ||
use std::io; | ||
use std::io::Write; | ||
|
||
#[global_allocator] | ||
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; | ||
|
||
fn main() { | ||
|
||
let stdin = io::stdin().lock(); | ||
let mut reader = BufReader::new(stdin); | ||
|
||
let stdout = io::stdout().lock(); | ||
let mut writer = BufWriter::new(stdout); | ||
|
||
let mut n:i64 = 0; | ||
|
||
let mut line:Vec<u8> = Vec::new(); | ||
|
||
loop { | ||
|
||
line.clear(); | ||
reader.read_until(b'\n', &mut line).unwrap(); | ||
|
||
if line.len() == 0 { | ||
eprintln!("saw {} lines", n); | ||
break; | ||
} | ||
|
||
n = n + 1; | ||
|
||
let id = get_id(&line); | ||
|
||
writer.write_all(&(id.len() as u32).to_le_bytes()).unwrap(); | ||
writer.write_all(id).unwrap(); | ||
|
||
let mut enc = ZlibEncoder::new(Vec::new(), Compression::new(9)); | ||
|
||
enc.write_all(&line).unwrap(); | ||
let compressed = enc.finish().unwrap(); | ||
|
||
writer.write_all(&(compressed.len() as u32).to_le_bytes()).unwrap(); | ||
writer.write_all(&compressed).unwrap(); | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
80 changes: 0 additions & 80 deletions
80
dataload/07_create_db/rocksdb/grebi_make_rocks/src/main.rs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.