fmt
This commit is contained in:
@ -21,6 +21,7 @@ use rayon::prelude::*;
|
|||||||
use result::{Error, Result};
|
use result::{Error, Result};
|
||||||
use ring::rand::{SecureRandom, SystemRandom};
|
use ring::rand::{SecureRandom, SystemRandom};
|
||||||
use signature::{PublicKey, Signature};
|
use signature::{PublicKey, Signature};
|
||||||
|
use std;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
use std::net::{SocketAddr, UdpSocket};
|
use std::net::{SocketAddr, UdpSocket};
|
||||||
@ -28,7 +29,6 @@ use std::sync::atomic::{AtomicBool, Ordering};
|
|||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
use std::thread::{sleep, spawn, JoinHandle};
|
use std::thread::{sleep, spawn, JoinHandle};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use std;
|
|
||||||
|
|
||||||
/// Structure to be replicated by the network
|
/// Structure to be replicated by the network
|
||||||
#[derive(Serialize, Deserialize, Clone)]
|
#[derive(Serialize, Deserialize, Clone)]
|
||||||
@ -298,7 +298,9 @@ impl Crdt {
|
|||||||
|
|
||||||
// max number of nodes that we could be converged to
|
// max number of nodes that we could be converged to
|
||||||
pub fn convergence(&self) -> u64 {
|
pub fn convergence(&self) -> u64 {
|
||||||
let min = self.remote.values().fold(std::u64::MAX, |a,b| std::cmp::min(a, *b));
|
let min = self.remote
|
||||||
|
.values()
|
||||||
|
.fold(std::u64::MAX, |a, b| std::cmp::min(a, *b));
|
||||||
std::cmp::min(min, self.remote.values().len() as u64 + 1)
|
std::cmp::min(min, self.remote.values().len() as u64 + 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user