Replace ordermap dependency with indexmap. (#55)
indexmap is the new ordermap. Signed-off-by: Brian Smith <brian@briansmith.org>
This commit is contained in:
parent
59679934c9
commit
1efa622b6e
|
@ -10,7 +10,7 @@ log = "0.4.1"
|
|||
rand = "0.4"
|
||||
tower = { version = "0.1", path = "../" }
|
||||
tower-discover = { version = "0.1", path = "../tower-discover" }
|
||||
ordermap = "0.2"
|
||||
indexmap = "0.4.1"
|
||||
|
||||
[dev-dependencies]
|
||||
log = "0.4.1"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use ordermap::OrderMap;
|
||||
use indexmap::IndexMap;
|
||||
|
||||
mod p2c;
|
||||
mod round_robin;
|
||||
|
@ -18,7 +18,7 @@ pub trait Choose<K, N> {
|
|||
|
||||
/// Creates a `Replicas` if there are two or more services.
|
||||
///
|
||||
pub(crate) fn replicas<K, S>(inner: &OrderMap<K, S>) -> Result<Replicas<K, S>, TooFew> {
|
||||
pub(crate) fn replicas<K, S>(inner: &IndexMap<K, S>) -> Result<Replicas<K, S>, TooFew> {
|
||||
if inner.len() < 2 {
|
||||
return Err(TooFew);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ pub struct TooFew;
|
|||
|
||||
/// Holds two or more services.
|
||||
// TODO hide `K`
|
||||
pub struct Replicas<'a, K: 'a, S: 'a>(&'a OrderMap<K, S>);
|
||||
pub struct Replicas<'a, K: 'a, S: 'a>(&'a IndexMap<K, S>);
|
||||
|
||||
impl<'a, K: 'a, S: 'a> Replicas<'a, K, S> {
|
||||
pub fn len(&self) -> usize {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
extern crate futures;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
extern crate ordermap;
|
||||
extern crate indexmap;
|
||||
#[cfg(test)]
|
||||
extern crate quickcheck;
|
||||
extern crate rand;
|
||||
|
@ -10,7 +10,7 @@ extern crate tower;
|
|||
extern crate tower_discover;
|
||||
|
||||
use futures::{Future, Poll, Async};
|
||||
use ordermap::OrderMap;
|
||||
use indexmap::IndexMap;
|
||||
use rand::Rng;
|
||||
use std::{fmt, error};
|
||||
use std::marker::PhantomData;
|
||||
|
@ -72,10 +72,10 @@ pub struct Balance<D: Discover, C> {
|
|||
dispatched_ready_index: Option<usize>,
|
||||
|
||||
/// Holds all possibly-available endpoints (i.e. from `discover`).
|
||||
ready: OrderMap<D::Key, D::Service>,
|
||||
ready: IndexMap<D::Key, D::Service>,
|
||||
|
||||
/// Newly-added endpoints that have not yet become ready.
|
||||
not_ready: OrderMap<D::Key, D::Service>,
|
||||
not_ready: IndexMap<D::Key, D::Service>,
|
||||
}
|
||||
|
||||
/// Error produced by `Balance`
|
||||
|
@ -102,8 +102,8 @@ where
|
|||
choose,
|
||||
chosen_ready_index: None,
|
||||
dispatched_ready_index: None,
|
||||
ready: OrderMap::default(),
|
||||
not_ready: OrderMap::default(),
|
||||
ready: IndexMap::default(),
|
||||
not_ready: IndexMap::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue