mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-11 06:46:53 +00:00
Cargo fmt
This commit is contained in:
+1
-2
@@ -4,9 +4,8 @@ extern crate log;
|
||||
pub mod consul;
|
||||
pub(crate) mod tls_util;
|
||||
|
||||
pub mod ring;
|
||||
pub mod membership;
|
||||
pub mod ring;
|
||||
|
||||
pub mod rpc_client;
|
||||
pub mod rpc_server;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::collections::HashMap;
|
||||
use std::io::{Read, Write};
|
||||
use std::fmt::Write as FmtWrite;
|
||||
use std::io::{Read, Write};
|
||||
use std::net::{IpAddr, SocketAddr};
|
||||
use std::path::PathBuf;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
@@ -20,9 +20,9 @@ use garage_util::data::*;
|
||||
use garage_util::error::Error;
|
||||
|
||||
use crate::consul::get_consul_nodes;
|
||||
use crate::ring::*;
|
||||
use crate::rpc_client::*;
|
||||
use crate::rpc_server::*;
|
||||
use crate::ring::*;
|
||||
|
||||
const PING_INTERVAL: Duration = Duration::from_secs(10);
|
||||
const CONSUL_INTERVAL: Duration = Duration::from_secs(60);
|
||||
|
||||
+7
-4
@@ -4,7 +4,6 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
use garage_util::data::*;
|
||||
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct NetworkConfig {
|
||||
pub members: HashMap<UUID, NetworkConfigEntry>,
|
||||
@@ -13,7 +12,7 @@ pub struct NetworkConfig {
|
||||
|
||||
impl NetworkConfig {
|
||||
pub(crate) fn new() -> Self {
|
||||
Self{
|
||||
Self {
|
||||
members: HashMap::new(),
|
||||
version: 0,
|
||||
}
|
||||
@@ -27,7 +26,6 @@ pub struct NetworkConfigEntry {
|
||||
pub tag: String,
|
||||
}
|
||||
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Ring {
|
||||
pub config: NetworkConfig,
|
||||
@@ -53,7 +51,12 @@ impl Ring {
|
||||
if !datacenters.contains(datacenter) {
|
||||
datacenters.push(datacenter.to_string());
|
||||
}
|
||||
let datacenter_idx = datacenters.iter().enumerate().find(|(_, dc)| *dc == datacenter).unwrap().0;
|
||||
let datacenter_idx = datacenters
|
||||
.iter()
|
||||
.enumerate()
|
||||
.find(|(_, dc)| *dc == datacenter)
|
||||
.unwrap()
|
||||
.0;
|
||||
|
||||
for i in 0..config.n_tokens {
|
||||
let location = sha256sum(format!("{} {}", hex::encode(&id), i).as_bytes());
|
||||
|
||||
Reference in New Issue
Block a user