1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-24 01:11:07 +01:00

migrate to actix-service crate

This commit is contained in:
Nikolay Kim 2018-12-09 10:15:49 -08:00
parent a60bf691d5
commit 43e14818c4
17 changed files with 17 additions and 24 deletions

View File

@ -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"
@ -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"

View File

@ -1,6 +1,6 @@
[package]
name = "actix-service"
version = "0.1.0"
version = "0.1.1"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Actix Service"
keywords = ["network", "framework", "async", "futures"]

View File

@ -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> {

View File

@ -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 {

View File

@ -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.

View File

@ -3,6 +3,7 @@ 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};
@ -10,7 +11,6 @@ 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;

View File

@ -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.

View File

@ -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;

View File

@ -4,6 +4,7 @@ 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;
@ -11,8 +12,6 @@ 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;

View File

@ -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::{

View File

@ -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;
@ -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 {

View File

@ -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
///

View File

@ -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};
@ -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
///

View File

@ -2,6 +2,7 @@ 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};
@ -9,7 +10,6 @@ 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
///

View File

@ -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,

View File

@ -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)]

View File

@ -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> {