Skip to content

Commit

Permalink
migrate to actix-service crate
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 committed Dec 9, 2018
1 parent a60bf69 commit 43e1481
Show file tree
Hide file tree
Showing 17 changed files with 17 additions and 24 deletions.
4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ cell = []

[dependencies]
actix = "0.7.6"
# actix-service = "0.1"
actix-service = { path="./actix-service" }
actix-service = "0.1.1"

log = "0.4"
num_cpus = "1.0"
Expand All @@ -66,7 +65,6 @@ tokio-tcp = "0.1"
tokio-timer = "0.2"
tokio-reactor = "0.1"
tokio-current-thread = "0.1"
tower-service = { git = "https://github.com/tower-rs/tower.git" }
trust-dns-proto = "^0.5.0"
trust-dns-resolver = "^0.10.0"

Expand Down
2 changes: 1 addition & 1 deletion actix-service/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "actix-service"
version = "0.1.0"
version = "0.1.1"
authors = ["Nikolay Kim <[email protected]>"]
description = "Actix Service"
keywords = ["network", "framework", "async", "futures"]
Expand Down
2 changes: 1 addition & 1 deletion src/cloneable.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::marker::PhantomData;
use std::rc::Rc;

use actix_service::Service;
use futures::Poll;

use super::cell::Cell;
use super::service::Service;

/// Service that allows to turn non-clone service to a service with `Clone` impl
pub struct CloneableService<T: 'static> {
Expand Down
3 changes: 1 addition & 2 deletions src/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ use std::net::{IpAddr, SocketAddr};
use std::time::Duration;
use std::{fmt, io};

use actix_service::{NewService, Service};
use futures::future::{ok, Either, FutureResult};
use futures::{try_ready, Async, Future, Poll};

use tokio_tcp::{ConnectFuture, TcpStream};
use trust_dns_resolver::config::{ResolverConfig, ResolverOpts};
use trust_dns_resolver::system_conf::read_system_conf;

use super::resolver::{RequestHost, ResolveError, Resolver, ResolverFuture};
use super::service::{NewService, Service};

/// Port of the request
pub trait RequestPort {
Expand Down
3 changes: 1 addition & 2 deletions src/either.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
//! Contains `Either` service and related types and functions.
use actix_service::{NewService, Service};
use futures::{future, try_ready, Async, Future, Poll};

use super::service::{NewService, Service};

/// Combine two different service types into a single type.
///
/// Both services must be of the same request, response, and error types.
Expand Down
2 changes: 1 addition & 1 deletion src/framed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ use std::marker::PhantomData;
use std::mem;

use actix;
use actix_service::{IntoNewService, IntoService, NewService, Service};
use futures::future::{ok, FutureResult};
use futures::unsync::mpsc;
use futures::{Async, AsyncSink, Future, Poll, Sink, Stream};
use tokio_codec::{Decoder, Encoder};
use tokio_io::{AsyncRead, AsyncWrite};

use crate::codec::Framed;
use crate::service::{IntoNewService, IntoService, NewService, Service};

type Request<U> = <U as Decoder>::Item;
type Response<U> = <U as Encoder>::Item;
Expand Down
2 changes: 1 addition & 1 deletion src/inflight.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use actix_service::{IntoNewService, IntoService, NewService, Service};
use futures::{try_ready, Async, Future, Poll};

use super::counter::{Counter, CounterGuard};
use super::service::{IntoNewService, IntoService, NewService, Service};

/// InFlight - new service for service that can limit number of in-flight
/// async requests.
Expand Down
2 changes: 1 addition & 1 deletion src/keepalive.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use std::marker::PhantomData;
use std::time::{Duration, Instant};

use actix_service::{NewService, Service};
use futures::future::{ok, FutureResult};
use futures::{Async, Future, Poll};
use tokio_timer::Delay;

use super::service::{NewService, Service};
use super::time::{LowResTime, LowResTimeService};
use super::Never;

Expand Down
3 changes: 1 addition & 2 deletions src/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ use std::net::IpAddr;

use futures::{Async, Future, Poll};

use actix_service::Service;
use tokio_current_thread::spawn;
use trust_dns_resolver::config::{ResolverConfig, ResolverOpts};
pub use trust_dns_resolver::error::ResolveError;
use trust_dns_resolver::lookup_ip::LookupIpFuture;
use trust_dns_resolver::system_conf::read_system_conf;
use trust_dns_resolver::{AsyncResolver, Background};

use super::service::Service;

/// Host name of the request
pub trait RequestHost {
fn host(&self) -> &str;
Expand Down
2 changes: 1 addition & 1 deletion src/server/config.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use std::collections::HashMap;
use std::{fmt, io, net};

use actix_service::{IntoNewService, NewService};
use futures::future::{join_all, Future};
use log::error;
use tokio_tcp::TcpStream;

use crate::counter::CounterGuard;
use crate::service::{IntoNewService, NewService};

use super::server::bind_addr;
use super::services::{
Expand Down
2 changes: 1 addition & 1 deletion src/server/services.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::net;
use std::time::Duration;

use actix_service::{NewService, Service};
use futures::future::{err, ok, FutureResult};
use futures::{Future, Poll};
use log::error;
Expand All @@ -10,7 +11,6 @@ use tokio_tcp::TcpStream;

use super::Token;
use crate::counter::CounterGuard;
use crate::service::{NewService, Service};

/// Server message
pub enum ServerMessage {
Expand Down
2 changes: 1 addition & 1 deletion src/ssl/nativetls.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use std::io;
use std::marker::PhantomData;

use actix_service::{NewService, Service};
use futures::{future::ok, future::FutureResult, Async, Future, Poll};
use native_tls::{self, Error, HandshakeError, TlsAcceptor};
use tokio_io::{AsyncRead, AsyncWrite};

use super::MAX_CONN_COUNTER;
use crate::counter::{Counter, CounterGuard};
use crate::service::{NewService, Service};

/// Support `SSL` connections via native-tls package
///
Expand Down
2 changes: 1 addition & 1 deletion src/ssl/openssl.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::marker::PhantomData;

use actix_service::{NewService, Service};
use futures::{future::ok, future::FutureResult, Async, Future, Poll};
use openssl::ssl::{Error, SslAcceptor, SslConnector};
use tokio_io::{AsyncRead, AsyncWrite};
Expand All @@ -8,7 +9,6 @@ use tokio_openssl::{AcceptAsync, ConnectAsync, SslAcceptorExt, SslConnectorExt,
use super::MAX_CONN_COUNTER;
use crate::counter::{Counter, CounterGuard};
use crate::resolver::RequestHost;
use crate::service::{NewService, Service};

/// Support `SSL` connections via openssl package
///
Expand Down
2 changes: 1 addition & 1 deletion src/ssl/rustls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ use std::io;
use std::marker::PhantomData;
use std::sync::Arc;

use actix_service::{NewService, Service};
use futures::{future::ok, future::FutureResult, Async, Future, Poll};
use rustls::{ServerConfig, ServerSession};
use tokio_io::{AsyncRead, AsyncWrite};
use tokio_rustls::{Accept, TlsAcceptor, TlsStream};

use super::MAX_CONN_COUNTER;
use crate::counter::{Counter, CounterGuard};
use crate::service::{NewService, Service};

/// Support `SSL` connections via rustls package
///
Expand Down
3 changes: 1 addition & 2 deletions src/stream.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use std::marker::PhantomData;

use actix_service::{IntoService, NewService, Service};
use futures::unsync::mpsc;
use futures::{future, Async, Future, Poll, Stream};
use tokio_current_thread::spawn;

use super::service::{IntoService, NewService, Service};

pub struct StreamDispatcher<S: Stream, T> {
stream: S,
service: T,
Expand Down
2 changes: 1 addition & 1 deletion src/time.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use std::time::{Duration, Instant};

use actix_service::{NewService, Service};
use futures::future::{ok, FutureResult};
use futures::{Async, Future, Poll};
use tokio_current_thread::spawn;
use tokio_timer::sleep;

use super::cell::Cell;
use super::service::{NewService, Service};
use super::Never;

#[derive(Clone, Debug)]
Expand Down
3 changes: 1 addition & 2 deletions src/timeout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
use std::fmt;
use std::time::Duration;

use actix_service::{NewService, Service};
use futures::try_ready;
use futures::{Async, Future, Poll};
use tokio_timer::{clock, Delay};

use crate::service::{NewService, Service};

/// Applies a timeout to requests.
#[derive(Debug)]
pub struct Timeout<T> {
Expand Down

0 comments on commit 43e1481

Please sign in to comment.