aboutsummaryrefslogtreecommitdiff
path: root/src/server.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-04-07 18:10:20 +0200
committerAlex Auvolat <alex@adnab.me>2020-04-07 18:10:20 +0200
commit90cdffb425c6222f4234db54a16c079d8c058724 (patch)
tree2a836af28b5bce3969560fa4f45973b8392629c2 /src/server.rs
parent82b7fcd280d416aabc4f94a99a17c8d9e99888be (diff)
downloadgarage-90cdffb425c6222f4234db54a16c079d8c058724.tar.gz
garage-90cdffb425c6222f4234db54a16c079d8c058724.zip
custom data type for hashes and identifiers
Diffstat (limited to 'src/server.rs')
-rw-r--r--src/server.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/server.rs b/src/server.rs
index 1450911b..5cac1c70 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -47,13 +47,13 @@ fn gen_node_id(metadata_dir: &PathBuf) -> Result<UUID, Error> {
let mut id = [0u8; 32];
id.copy_from_slice(&d[..]);
- Ok(id)
+ Ok(id.into())
} else {
- let id = rand::thread_rng().gen::<UUID>();
+ let id = rand::thread_rng().gen::<[u8; 32]>();
let mut f = std::fs::File::create(id_file.as_path())?;
f.write_all(&id[..])?;
- Ok(id)
+ Ok(id.into())
}
}
@@ -78,7 +78,7 @@ pub async fn run_server(config_file: PathBuf) -> Result<(), Error> {
let id = gen_node_id(&config.metadata_dir)
.expect("Unable to read or generate node ID");
- println!("Node ID: {}", hex::encode(id));
+ println!("Node ID: {}", hex::encode(&id));
let sys = Arc::new(System::new(config, id));