Export data to CBOR
This commit is contained in:
parent
499642cda9
commit
1ea09a9be9
4 changed files with 43 additions and 0 deletions
34
brood/Cargo.lock
generated
34
brood/Cargo.lock
generated
|
|
@ -40,6 +40,7 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
|||
name = "brood"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"ciborium",
|
||||
"clap",
|
||||
"rustc-hash",
|
||||
"serde",
|
||||
|
|
@ -53,6 +54,33 @@ version = "1.0.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "ciborium"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b0c137568cc60b904a7724001b35ce2630fd00d5d84805fbb608ab89509d788f"
|
||||
dependencies = [
|
||||
"ciborium-io",
|
||||
"ciborium-ll",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ciborium-io"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "346de753af073cc87b52b2083a506b38ac176a44cfb05497b622e27be899b369"
|
||||
|
||||
[[package]]
|
||||
name = "ciborium-ll"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "213030a2b5a4e0c0892b6652260cf6ccac84827b83a85a534e178e3906c4cf1b"
|
||||
dependencies = [
|
||||
"ciborium-io",
|
||||
"half",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.0.5"
|
||||
|
|
@ -110,6 +138,12 @@ dependencies = [
|
|||
"wasi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "half"
|
||||
version = "1.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7"
|
||||
|
||||
[[package]]
|
||||
name = "halfbrown"
|
||||
version = "0.1.15"
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ version = "0.1.0"
|
|||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
ciborium = "0.2.0"
|
||||
clap = { version = "4.0.5", features = ["derive"] }
|
||||
rustc-hash = "1.1.0"
|
||||
serde = { version = "1.0.145", features = ["derive"] }
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Page {
|
||||
pub link_idx: u32,
|
||||
pub ns: u16,
|
||||
|
|
@ -6,12 +9,14 @@ pub struct Page {
|
|||
pub redirect: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Link {
|
||||
pub to: u32,
|
||||
pub start: u32,
|
||||
pub end: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct AdjacencyList {
|
||||
pub pages: Vec<Page>,
|
||||
pub links: Vec<Link>,
|
||||
|
|
|
|||
|
|
@ -178,5 +178,8 @@ pub fn ingest() -> io::Result<()> {
|
|||
}
|
||||
}
|
||||
|
||||
eprintln!("EXPORT");
|
||||
ciborium::ser::into_writer(&second_stage, io::stdout()).unwrap();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue