Proxy: Upgrade from ordermap 0.2 crate to indexmap 0.4. (#466)

Currently we have to download and build two different versions of
the ordermap crate.

I will submit similar PRs for the dependent crates so that we will
eventually all be using the same version of indexmap.

Signed-off-by: Brian Smith <brian@briansmith.org>
This commit is contained in:
Brian Smith 2018-02-26 19:29:22 -10:00 committed by GitHub
parent d993820cb3
commit 0d14c196f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 28 additions and 22 deletions

10
Cargo.lock generated
View File

@ -148,11 +148,11 @@ dependencies = [
"http 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"httparse 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "httparse 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.11.19 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.11.19 (registry+https://github.com/rust-lang/crates.io-index)",
"indexmap 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ipnet 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "ipnet 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ns-dns-tokio 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "ns-dns-tokio 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ordermap 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
"prost 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "prost 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"prost-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "prost-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"quickcheck 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "quickcheck 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -194,7 +194,7 @@ name = "conduit-proxy-router"
version = "0.3.0" version = "0.3.0"
dependencies = [ dependencies = [
"futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
"ordermap 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tower 0.1.0 (git+https://github.com/tower-rs/tower)", "tower 0.1.0 (git+https://github.com/tower-rs/tower)",
] ]
@ -411,6 +411,11 @@ dependencies = [
"unicase 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicase 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "indexmap"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "iovec" name = "iovec"
version = "0.1.2" version = "0.1.2"
@ -1262,6 +1267,7 @@ dependencies = [
"checksum http 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf8217d8829cc05dedadc08b4bc0684e5e3fbba1126c5edc680af49053fa230c" "checksum http 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf8217d8829cc05dedadc08b4bc0684e5e3fbba1126c5edc680af49053fa230c"
"checksum httparse 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2f407128745b78abc95c0ffbe4e5d37427fdc0d45470710cfef8c44522a2e37" "checksum httparse 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2f407128745b78abc95c0ffbe4e5d37427fdc0d45470710cfef8c44522a2e37"
"checksum hyper 0.11.19 (registry+https://github.com/rust-lang/crates.io-index)" = "47659bb1cb7ef3cd7b4f9bd2a11349b8d92097d34f9597a3c09e9bcefaf92b61" "checksum hyper 0.11.19 (registry+https://github.com/rust-lang/crates.io-index)" = "47659bb1cb7ef3cd7b4f9bd2a11349b8d92097d34f9597a3c09e9bcefaf92b61"
"checksum indexmap 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7164c96d6e18ccc3ce43f3dedac996c21a220670a106c275b96ad92110401362"
"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08"
"checksum ipnet 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "51268c3a27ad46afd1cca0bbf423a5be2e9fd3e6a7534736c195f0f834b763ef" "checksum ipnet 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "51268c3a27ad46afd1cca0bbf423a5be2e9fd3e6a7534736c195f0f834b763ef"
"checksum itertools 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b07332223953b5051bceb67e8c4700aa65291535568e1f12408c43c4a42c0394" "checksum itertools 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b07332223953b5051bceb67e8c4700aa65291535568e1f12408c43c4a42c0394"

View File

@ -25,7 +25,7 @@ httparse = "1.2"
hyper = { version = "0.11.19", default-features = false, features = ["compat"] } hyper = { version = "0.11.19", default-features = false, features = ["compat"] }
ipnet = "1.0" ipnet = "1.0"
log = "0.4.1" log = "0.4.1"
ordermap = "0.2" indexmap = "0.4.1"
rand = "0.4" rand = "0.4"
tokio-core = "0.1" tokio-core = "0.1"

View File

@ -6,5 +6,5 @@ publish = false
[dependencies] [dependencies]
futures = "0.1" futures = "0.1"
ordermap = "0.2" indexmap = "0.4.1"
tower = { git = "https://github.com/tower-rs/tower" } tower = { git = "https://github.com/tower-rs/tower" }

View File

@ -1,9 +1,9 @@
extern crate futures; extern crate futures;
extern crate ordermap; extern crate indexmap;
extern crate tower; extern crate tower;
use futures::{Future, Poll}; use futures::{Future, Poll};
use ordermap::OrderMap; use indexmap::IndexMap;
use tower::Service; use tower::Service;
use std::hash::Hash; use std::hash::Hash;
@ -67,7 +67,7 @@ where T: Recognize,
struct Inner<T> struct Inner<T>
where T: Recognize, where T: Recognize,
{ {
routes: OrderMap<T::Key, T::Service>, routes: IndexMap<T::Key, T::Service>,
recognize: T, recognize: T,
} }

View File

@ -2,7 +2,7 @@ use std::sync::{Arc, Mutex};
use futures::{future, Poll, Stream}; use futures::{future, Poll, Stream};
use futures_mpsc_lossy; use futures_mpsc_lossy;
use ordermap::OrderMap; use indexmap::IndexMap;
use tower_grpc::{self as grpc, Response}; use tower_grpc::{self as grpc, Response};
use conduit_proxy_controller_grpc::common::TapEvent; use conduit_proxy_controller_grpc::common::TapEvent;
@ -22,7 +22,7 @@ pub struct Observe {
pub struct TapEvents { pub struct TapEvents {
rx: futures_mpsc_lossy::Receiver<Event>, rx: futures_mpsc_lossy::Receiver<Event>,
remaining: usize, remaining: usize,
current: OrderMap<Arc<ctx::http::Request>, ()>, current: IndexMap<Arc<ctx::http::Request>, ()>,
tap_id: usize, tap_id: usize,
taps: Arc<Mutex<Taps>>, taps: Arc<Mutex<Taps>>,
} }
@ -77,7 +77,7 @@ impl server::Tap for Observe {
let events = TapEvents { let events = TapEvents {
rx, rx,
tap_id, tap_id,
current: OrderMap::default(), current: IndexMap::default(),
remaining: req.limit as usize, remaining: req.limit as usize,
taps: self.taps.clone(), taps: self.taps.clone(),
}; };

View File

@ -21,7 +21,7 @@ extern crate libc;
#[macro_use] #[macro_use]
extern crate log; extern crate log;
extern crate ns_dns_tokio; extern crate ns_dns_tokio;
extern crate ordermap; extern crate indexmap;
extern crate prost; extern crate prost;
extern crate prost_types; extern crate prost_types;
#[cfg(test)] #[cfg(test)]

View File

@ -4,7 +4,7 @@ use std::time::Duration;
use std::{u32, u64}; use std::{u32, u64};
use http; use http;
use ordermap::OrderMap; use indexmap::IndexMap;
use conduit_proxy_controller_grpc::common::{ use conduit_proxy_controller_grpc::common::{
TcpAddress, TcpAddress,
@ -30,9 +30,9 @@ mod latency;
#[derive(Debug)] #[derive(Debug)]
pub struct Metrics { pub struct Metrics {
sources: OrderMap<net::IpAddr, TransportStats>, sources: IndexMap<net::IpAddr, TransportStats>,
destinations: OrderMap<net::SocketAddr, TransportStats>, destinations: IndexMap<net::SocketAddr, TransportStats>,
requests: OrderMap<RequestKey, RequestStats>, requests: IndexMap<RequestKey, RequestStats>,
process_ctx: Arc<ctx::Process>, process_ctx: Arc<ctx::Process>,
} }
@ -47,12 +47,12 @@ struct RequestKey {
#[derive(Debug, Default)] #[derive(Debug, Default)]
struct RequestStats { struct RequestStats {
count: u32, count: u32,
responses: OrderMap<Option<http::StatusCode>, ResponseStats>, responses: IndexMap<Option<http::StatusCode>, ResponseStats>,
} }
#[derive(Debug, Default)] #[derive(Debug, Default)]
struct ResponseStats { struct ResponseStats {
ends: OrderMap<End, u32>, ends: IndexMap<End, u32>,
/// Response latencies in tenths of a millisecond. /// Response latencies in tenths of a millisecond.
/// ///
/// Observed latencies are mapped to a count of the times that /// Observed latencies are mapped to a count of the times that
@ -88,9 +88,9 @@ impl RequestKey {
impl Metrics { impl Metrics {
pub fn new(process_ctx: Arc<ctx::Process>) -> Self { pub fn new(process_ctx: Arc<ctx::Process>) -> Self {
Metrics { Metrics {
sources: OrderMap::new(), sources: IndexMap::new(),
destinations: OrderMap::new(), destinations: IndexMap::new(),
requests: OrderMap::new(), requests: IndexMap::new(),
process_ctx, process_ctx,
} }
} }

View File

@ -1,5 +1,5 @@
use futures_mpsc_lossy; use futures_mpsc_lossy;
use ordermap::OrderMap; use indexmap::IndexMap;
use conduit_proxy_controller_grpc::tap::observe_request; use conduit_proxy_controller_grpc::tap::observe_request;
@ -12,7 +12,7 @@ pub use self::match_::InvalidMatch;
#[derive(Default, Debug)] #[derive(Default, Debug)]
pub struct Taps { pub struct Taps {
by_id: OrderMap<usize, Tap>, by_id: IndexMap<usize, Tap>,
} }
#[derive(Debug)] #[derive(Debug)]