Skip to content

Commit

Permalink
move various modules to core (#48011)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkarneges authored Jun 11, 2024
1 parent 9f5ae0f commit fd205c0
Show file tree
Hide file tree
Showing 40 changed files with 124 additions and 120 deletions.
6 changes: 3 additions & 3 deletions benches/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

use criterion::{criterion_group, criterion_main, Criterion};
use mio::net::TcpListener;
use pushpin::channel;
use pushpin::client::TestClient;
use pushpin::executor::Executor;
use pushpin::core::channel;
use pushpin::core::executor::Executor;
use pushpin::core::reactor::Reactor;
use pushpin::future::{AsyncReadExt, AsyncSender, AsyncTcpListener, AsyncTcpStream, AsyncWriteExt};
use pushpin::reactor::Reactor;
use std::net::SocketAddr;
use std::rc::Rc;
use std::str;
Expand Down
4 changes: 2 additions & 2 deletions benches/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ use pushpin::connection::testutil::{
BenchServerReqConnection, BenchServerReqHandler, BenchServerStreamConnection,
BenchServerStreamHandler,
};
use pushpin::executor::Executor;
use pushpin::core::executor::Executor;
use pushpin::core::reactor::Reactor;
use pushpin::future::{AsyncReadExt, AsyncTcpStream, AsyncWriteExt};
use pushpin::reactor::Reactor;
use pushpin::server::TestServer;
use pushpin::websocket::testutil::{BenchRecvMessage, BenchSendMessage};
use std::io::{self, Write};
Expand Down
2 changes: 1 addition & 1 deletion src/bin/pushpin-connmgr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use clap::{Arg, ArgAction, Command};
use log::{error, LevelFilter};
use pushpin::connmgr::{run, App, Config};
use pushpin::log::{get_simple_logger, local_offset_check};
use pushpin::core::log::{get_simple_logger, local_offset_check};
use pushpin::version;
use pushpin::{ListenConfig, ListenSpec};
use std::error::Error;
Expand Down
2 changes: 1 addition & 1 deletion src/bin/pushpin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

use clap::Parser;
use log::{error, info, LevelFilter};
use pushpin::log::{ensure_init_simple_logger, get_simple_logger, local_offset_check};
use pushpin::core::log::{ensure_init_simple_logger, get_simple_logger, local_offset_check};
use pushpin::runner::{open_log_file, ArgsData, CliArgs, Settings};
use pushpin::service::start_services;
use std::env;
Expand Down
20 changes: 10 additions & 10 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,28 @@
* limitations under the License.
*/

use crate::arena;
use crate::buffer::TmpBuffer;
use crate::can_move_mio_sockets_between_threads;
use crate::channel;
use crate::connection::{
client_req_connection, client_stream_connection, ConnectionPool, StreamSharedData,
};
use crate::core::arena;
use crate::core::buffer::TmpBuffer;
use crate::core::channel;
use crate::core::event;
use crate::core::executor::{Executor, Spawner};
use crate::core::list;
use crate::core::reactor::Reactor;
use crate::core::tnetstring;
use crate::core::zmq::{MultipartHeader, SpecInfo};
use crate::counter::Counter;
use crate::event;
use crate::executor::{Executor, Spawner};
use crate::future::{
event_wait, select_2, select_5, select_6, select_option, yield_to_local_events,
AsyncLocalReceiver, AsyncLocalSender, AsyncReceiver, CancellationSender, CancellationToken,
Select2, Select5, Select6, Timeout,
};
use crate::list;
use crate::pin;
use crate::reactor::Reactor;
use crate::resolver::Resolver;
use crate::tnetstring;
use crate::zhttppacket;
use crate::zhttpsocket::{self, SessionKey, FROM_MAX, REQ_ID_MAX};
use crate::zmq::{MultipartHeader, SpecInfo};
use arrayvec::ArrayVec;
use ipnet::IpNet;
use log::{debug, error, info, warn};
Expand All @@ -49,6 +48,7 @@ use std::collections::{HashMap, VecDeque};
use std::convert::TryFrom;
use std::io::{self, Write};
use std::mem;
use std::pin::pin;
use std::rc::Rc;
use std::str;
use std::sync::{mpsc, Arc};
Expand Down
27 changes: 14 additions & 13 deletions src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,33 +34,33 @@
#![allow(clippy::collapsible_if)]
#![allow(clippy::collapsible_else_if)]

use crate::arena;
use crate::buffer::{
use crate::core::arena;
use crate::core::buffer::{
Buffer, ContiguousBuffer, LimitBufsMut, TmpBuffer, VecRingBuffer, VECTORED_MAX,
};
use crate::core::http1::Error as CoreHttpError;
use crate::core::http1::{self, client, server, RecvStatus, SendStatus};
use crate::core::net::SocketAddr;
use crate::core::reactor::Reactor;
use crate::core::shuffle::random;
use crate::core::waker::RefWakerData;
use crate::core::zmq::MultipartHeader;
use crate::counter::{Counter, CounterDec};
use crate::future::{
io_split, poll_async, select_2, select_3, select_4, select_option, AsyncLocalReceiver,
AsyncLocalSender, AsyncRead, AsyncReadExt, AsyncResolver, AsyncTcpStream, AsyncTlsStream,
AsyncWrite, AsyncWriteExt, CancellationToken, ReadHalf, Select2, Select3, Select4,
StdWriteWrapper, Timeout, TlsWaker, WriteHalf,
};
use crate::net::SocketAddr;
use crate::pool::Pool;
use crate::reactor::Reactor;
use crate::resolver;
use crate::shuffle::random;
use crate::tls::{TlsStream, VerifyMode};
use crate::track::{
self, track_future, Track, TrackFlag, TrackedAsyncLocalReceiver, ValueActiveError,
};
use crate::waker::RefWakerData;
use crate::websocket;
use crate::zhttppacket;
use crate::zmq::MultipartHeader;
use crate::{pin, Defer};
use crate::Defer;
use arrayvec::{ArrayString, ArrayVec};
use ipnet::IpNet;
use log::{debug, log, warn, Level};
Expand All @@ -73,6 +73,7 @@ use std::future::Future;
use std::io::{self, Read, Write};
use std::mem;
use std::net::IpAddr;
use std::pin::pin;
use std::pin::Pin;
use std::rc::Rc;
use std::str;
Expand Down Expand Up @@ -5873,9 +5874,9 @@ pub async fn client_stream_connection<E>(

pub mod testutil {
use super::*;
use crate::buffer::TmpBuffer;
use crate::channel;
use crate::waker;
use crate::core::buffer::TmpBuffer;
use crate::core::channel;
use crate::core::waker;
use std::fmt;
use std::future::Future;
use std::io::Read;
Expand Down Expand Up @@ -6784,8 +6785,8 @@ pub mod testutil {
mod tests {
use super::testutil::*;
use super::*;
use crate::buffer::TmpBuffer;
use crate::channel;
use crate::core::buffer::TmpBuffer;
use crate::core::channel;
use crate::websocket::Decoder;
use std::rc::Rc;
use std::sync::Arc;
Expand Down
2 changes: 1 addition & 1 deletion src/connmgr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
*/

use crate::client::Client;
use crate::core::zmq::SpecInfo;
use crate::server::{Server, MSG_RETAINED_PER_CONNECTION_MAX, MSG_RETAINED_PER_WORKER_MAX};
use crate::websocket;
use crate::zhttpsocket;
use crate::zmq::SpecInfo;
use crate::ListenConfig;
use ipnet::IpNet;
use log::info;
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/channel.rs → src/core/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

use crate::arena;
use crate::event;
use crate::list;
use crate::core::arena;
use crate::core::event;
use crate::core::list;
use slab::Slab;
use std::cell::RefCell;
use std::collections::VecDeque;
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/event.rs → src/core/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

use crate::arena;
use crate::list;
use crate::core::arena;
use crate::core::list;
use mio::event::Source;
use mio::{Events, Interest, Poll, Token, Waker};
use slab::Slab;
Expand Down
4 changes: 2 additions & 2 deletions src/executor.rs → src/core/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

use crate::list;
use crate::waker;
use crate::core::list;
use crate::core::waker;
use log::debug;
use slab::Slab;
use std::cell::RefCell;
Expand Down
4 changes: 2 additions & 2 deletions src/core/http1/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
* limitations under the License.
*/

use crate::buffer::{Buffer, VecRingBuffer, VECTORED_MAX};
use crate::core::buffer::{Buffer, VecRingBuffer, VECTORED_MAX};
use crate::core::http1::error::Error;
use crate::core::http1::protocol::{self, BodySize, Header, ParseScratch, ParseStatus};
use crate::core::http1::util::*;
use crate::future::{
select_2, AsyncRead, AsyncWrite, AsyncWriteExt, ReadHalf, Select2, StdWriteWrapper, WriteHalf,
};
use crate::pin;
use std::cell::RefCell;
use std::io::{self, Write};
use std::mem;
use std::pin::pin;
use std::pin::Pin;
use std::str;

Expand Down
2 changes: 1 addition & 1 deletion src/core/http1/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#![allow(clippy::collapsible_if)]
#![allow(clippy::collapsible_else_if)]

use crate::buffer::{write_vectored_offset, FilledBuf, LimitBufs, VECTORED_MAX};
use crate::core::buffer::{write_vectored_offset, FilledBuf, LimitBufs, VECTORED_MAX};
use arrayvec::ArrayVec;
use std::cmp;
use std::convert::TryFrom;
Expand Down
6 changes: 3 additions & 3 deletions src/core/http1/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
* limitations under the License.
*/

use crate::buffer::{Buffer, ContiguousBuffer, VecRingBuffer, VECTORED_MAX};
use crate::core::buffer::{Buffer, ContiguousBuffer, VecRingBuffer, VECTORED_MAX};
use crate::core::http1::error::Error;
use crate::core::http1::protocol::{self, BodySize, Header, ParseScratch, ParseStatus};
use crate::core::http1::util::*;
use crate::future::{
select_2, AsyncRead, AsyncWrite, AsyncWriteExt, ReadHalf, Select2, StdWriteWrapper, WriteHalf,
};
use crate::pin;
use std::cell::{Cell, RefCell};
use std::io::{self, Write};
use std::pin::pin;
use std::pin::Pin;
use std::str;

Expand Down Expand Up @@ -788,7 +788,7 @@ impl Finished {
#[cfg(test)]
mod tests {
use super::*;
use crate::buffer::TmpBuffer;
use crate::core::buffer::TmpBuffer;
use crate::future::io_split;
use std::cmp;
use std::future::Future;
Expand Down
2 changes: 1 addition & 1 deletion src/core/http1/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

use crate::buffer::{Buffer, VecRingBuffer};
use crate::core::buffer::{Buffer, VecRingBuffer};
use crate::future::{AsyncRead, AsyncReadExt};
use std::cmp;
use std::future::Future;
Expand Down
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,19 @@
* limitations under the License.
*/

pub mod arena;
pub mod buffer;
pub mod channel;
pub mod config;
pub mod event;
pub mod executor;
pub mod http1;
pub mod list;
pub mod log;
pub mod net;
pub mod reactor;
pub mod shuffle;
pub mod timer;
pub mod tnetstring;
pub mod waker;
pub mod zmq;
File renamed without changes.
10 changes: 5 additions & 5 deletions src/reactor.rs → src/core/reactor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
*/

use crate::arena;
use crate::event;
use crate::event::ReadinessExt;
use crate::timer::TimerWheel;
use crate::core::arena;
use crate::core::event;
use crate::core::event::ReadinessExt;
use crate::core::timer::TimerWheel;
use slab::Slab;
use std::cell::{Cell, RefCell};
use std::cmp;
Expand Down Expand Up @@ -1012,7 +1012,7 @@ impl TimerEvented {
#[cfg(test)]
mod tests {
use super::*;
use crate::waker;
use crate::core::waker;
use std::cell::Cell;
use std::mem;
use std::os::unix::io::AsRawFd;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/timer.rs → src/core/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

// adapted from http://25thandclement.com/~william/projects/timeout.c.html (MIT licensed)

use crate::list;
use crate::core::list;
use slab::Slab;
use std::cmp;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
* $FANOUT_END_LICENSE$
*/

use crate::core::timer::TimerWheel;
use crate::jwt;
use crate::timer::TimerWheel;
use crate::version;
use libc;
use std::collections::HashSet;
Expand Down
22 changes: 12 additions & 10 deletions src/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@
* limitations under the License.
*/

use crate::arena;
use crate::channel;
use crate::event::{self, ReadinessExt};
use crate::net::{NetListener, NetStream, SocketAddr};
use crate::reactor::{CustomEvented, FdEvented, IoEvented, Reactor, Registration, TimerEvented};
use crate::core::arena;
use crate::core::channel;
use crate::core::event::{self, ReadinessExt};
use crate::core::net::{NetListener, NetStream, SocketAddr};
use crate::core::reactor::{
CustomEvented, FdEvented, IoEvented, Reactor, Registration, TimerEvented,
};
use crate::core::shuffle::shuffle;
use crate::core::waker::{RefWake, RefWaker, RefWakerData};
use crate::core::zmq::{MultipartHeader, ZmqSocket};
use crate::resolver;
use crate::shuffle::shuffle;
use crate::tls::{TlsStream, TlsStreamError, VerifyMode};
use crate::waker::{RefWake, RefWaker, RefWakerData};
use crate::zmq::{MultipartHeader, ZmqSocket};
use mio::net::{TcpListener, TcpStream, UnixListener, UnixStream};
use openssl::ssl;
use paste::paste;
Expand Down Expand Up @@ -2804,9 +2806,9 @@ pub fn yield_to_local_events() -> YieldToLocalEvents {
#[cfg(test)]
mod tests {
use super::*;
use crate::executor::Executor;
use crate::core::executor::Executor;
use crate::core::zmq::SpecInfo;
use crate::tls::TlsAcceptor;
use crate::zmq::SpecInfo;
use std::cmp;
use std::fs;
use std::mem;
Expand Down
Loading

0 comments on commit fd205c0

Please sign in to comment.