Skip to content
Snippets Groups Projects
Verified Commit 151dd191 authored by Yaroslav Dynnikov's avatar Yaroslav Dynnikov
Browse files

Fix merge conflicts

parent 10b6eb1c
No related branches found
No related tags found
1 merge request!71Fair raft join
use crate::traft::row::Peer;
use std::{
borrow::Cow,
error::Error,
......@@ -72,13 +71,12 @@ pub struct Run {
#[structopt(
long = "peer",
value_name = "host[:port]",
parse(from_str = parse_peer),
require_delimiter = true,
required = true,
env = "PICODATA_PEER",
env = "PICODATA_PEER"
)]
/// Address of other instance(s)
pub peers: Vec<Peer>,
pub peers: Vec<String>,
#[structopt(hidden = true, env = "PICODATA_RAFT_ID")]
pub raft_id: Option<u64>,
......@@ -163,20 +161,6 @@ fn current_exe() -> Result<CString, String> {
.map_err(|e| format!("Current executable path contains nul bytes: {e}"))
}
fn parse_peer(text: &str) -> Peer {
static mut CURRENT_RAFT_ID: u64 = 0;
unsafe { CURRENT_RAFT_ID += 1 }
let address = try_parse_address(text)
.unwrap_or_else(|e| panic!("could not parse peer \"{}\" as an address: {}", text, e));
Peer {
raft_id: unsafe { CURRENT_RAFT_ID },
uri: address,
}
}
fn parse_flag(text: &str) -> bool {
let text = text.to_lowercase();
matches!(text.as_str(), "on" | "true" | "yes") || text.parse::<i64>().unwrap_or(0) != 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment