Skip to content

Commit

Permalink
move more modules into core or program-specific dirs (#48012)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkarneges authored Jun 11, 2024
1 parent fd205c0 commit 83cf430
Show file tree
Hide file tree
Showing 25 changed files with 57 additions and 56 deletions.
2 changes: 1 addition & 1 deletion benches/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

use criterion::{criterion_group, criterion_main, Criterion};
use mio::net::TcpListener;
use pushpin::client::TestClient;
use pushpin::connmgr::client::TestClient;
use pushpin::core::channel;
use pushpin::core::executor::Executor;
use pushpin::core::reactor::Reactor;
Expand Down
6 changes: 3 additions & 3 deletions benches/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
*/

use criterion::{criterion_group, criterion_main, Criterion};
use pushpin::connection::testutil::{
use pushpin::connmgr::connection::testutil::{
BenchServerReqConnection, BenchServerReqHandler, BenchServerStreamConnection,
BenchServerStreamHandler,
};
use pushpin::connmgr::server::TestServer;
use pushpin::connmgr::websocket::testutil::{BenchRecvMessage, BenchSendMessage};
use pushpin::core::executor::Executor;
use pushpin::core::reactor::Reactor;
use pushpin::future::{AsyncReadExt, AsyncTcpStream, AsyncWriteExt};
use pushpin::server::TestServer;
use pushpin::websocket::testutil::{BenchRecvMessage, BenchSendMessage};
use std::io::{self, Write};
use std::net::SocketAddr;
use std::str;
Expand Down
2 changes: 1 addition & 1 deletion src/bin/pushpin-publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/

use clap::{Arg, ArgAction, Command};
use pushpin::publish_cli::{run, Action, Config, Content, Message};
use pushpin::publish::{run, Action, Config, Content, Message};
use pushpin::version;
use std::env;
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 @@ -17,8 +17,8 @@
use clap::Parser;
use log::{error, info, LevelFilter};
use pushpin::core::log::{ensure_init_simple_logger, get_simple_logger, local_offset_check};
use pushpin::runner::service::start_services;
use pushpin::runner::{open_log_file, ArgsData, CliArgs, Settings};
use pushpin::service::start_services;
use std::env;
use std::error::Error;
use std::process;
Expand Down
14 changes: 7 additions & 7 deletions src/client.rs → src/connmgr/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@
*/

use crate::can_move_mio_sockets_between_threads;
use crate::connection::{
use crate::connmgr::connection::{
client_req_connection, client_stream_connection, ConnectionPool, StreamSharedData,
};
use crate::connmgr::counter::Counter;
use crate::connmgr::resolver::Resolver;
use crate::connmgr::zhttppacket;
use crate::connmgr::zhttpsocket::{self, SessionKey, FROM_MAX, REQ_ID_MAX};
use crate::core::arena;
use crate::core::buffer::TmpBuffer;
use crate::core::channel;
Expand All @@ -28,15 +32,11 @@ 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::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::resolver::Resolver;
use crate::zhttppacket;
use crate::zhttpsocket::{self, SessionKey, FROM_MAX, REQ_ID_MAX};
use arrayvec::ArrayVec;
use ipnet::IpNet;
use log::{debug, error, info, warn};
Expand Down Expand Up @@ -2574,8 +2574,8 @@ impl Drop for TestClient {
#[cfg(test)]
pub mod tests {
use super::*;
use crate::connection::calculate_ws_accept;
use crate::websocket;
use crate::connmgr::connection::calculate_ws_accept;
use crate::connmgr::websocket;
use std::io::Read;
use test_log::test;

Expand Down
20 changes: 10 additions & 10 deletions src/connection.rs → src/connmgr/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@
#![allow(clippy::collapsible_if)]
#![allow(clippy::collapsible_else_if)]

use crate::connmgr::counter::{Counter, CounterDec};
use crate::connmgr::pool::Pool;
use crate::connmgr::resolver;
use crate::connmgr::tls::{TlsStream, VerifyMode};
use crate::connmgr::track::{
self, track_future, Track, TrackFlag, TrackedAsyncLocalReceiver, ValueActiveError,
};
use crate::connmgr::websocket;
use crate::connmgr::zhttppacket;
use crate::core::arena;
use crate::core::buffer::{
Buffer, ContiguousBuffer, LimitBufsMut, TmpBuffer, VecRingBuffer, VECTORED_MAX,
Expand All @@ -45,21 +54,12 @@ 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::pool::Pool;
use crate::resolver;
use crate::tls::{TlsStream, VerifyMode};
use crate::track::{
self, track_future, Track, TrackFlag, TrackedAsyncLocalReceiver, ValueActiveError,
};
use crate::websocket;
use crate::zhttppacket;
use crate::Defer;
use arrayvec::{ArrayString, ArrayVec};
use ipnet::IpNet;
Expand Down Expand Up @@ -6785,9 +6785,9 @@ pub mod testutil {
mod tests {
use super::testutil::*;
use super::*;
use crate::connmgr::websocket::Decoder;
use crate::core::buffer::TmpBuffer;
use crate::core::channel;
use crate::websocket::Decoder;
use std::rc::Rc;
use std::sync::Arc;
use std::task::Poll;
Expand Down
File renamed without changes.
File renamed without changes.
20 changes: 16 additions & 4 deletions src/connmgr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,23 @@
* limitations under the License.
*/

use crate::client::Client;
mod counter;
mod listener;
mod pool;
mod track;
mod zhttppacket;
mod zhttpsocket;

pub mod client;
pub mod connection;
pub mod resolver;
pub mod server;
pub mod tls;
pub mod websocket;

use self::client::Client;
use self::server::{Server, MSG_RETAINED_PER_CONNECTION_MAX, MSG_RETAINED_PER_WORKER_MAX};
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::ListenConfig;
use ipnet::IpNet;
use log::info;
Expand Down
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions src/server.rs → src/connmgr/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@
* limitations under the License.
*/

use crate::connection::{
use crate::connmgr::connection::{
server_req_connection, server_stream_connection, CidProvider, Identify, StreamSharedData,
};
use crate::connmgr::counter::Counter;
use crate::connmgr::listener::Listener;
use crate::connmgr::tls::{IdentityCache, TlsAcceptor, TlsStream};
use crate::connmgr::zhttppacket;
use crate::connmgr::zhttpsocket;
use crate::core::arena;
use crate::core::buffer::TmpBuffer;
use crate::core::channel;
Expand All @@ -29,17 +34,12 @@ use crate::core::reactor::Reactor;
use crate::core::tnetstring;
use crate::core::waker::RefWakerData;
use crate::core::zmq::SpecInfo;
use crate::counter::Counter;
use crate::future::{
event_wait, select_2, select_3, select_6, select_8, select_option, yield_to_local_events,
AsyncLocalReceiver, AsyncLocalSender, AsyncReceiver, AsyncTcpStream, AsyncTlsStream,
AsyncUnixStream, CancellationSender, CancellationToken, Select2, Select3, Select6, Select8,
Timeout, TlsWaker,
};
use crate::listener::Listener;
use crate::tls::{IdentityCache, TlsAcceptor, TlsStream};
use crate::zhttppacket;
use crate::zhttpsocket;
use crate::{set_group, set_user};
use crate::{ListenConfig, ListenSpec};
use arrayvec::{ArrayString, ArrayVec};
Expand Down Expand Up @@ -2941,7 +2941,7 @@ impl Drop for TestServer {
#[cfg(test)]
pub mod tests {
use super::*;
use crate::websocket;
use crate::connmgr::websocket;
use std::io::Read;
use test_log::test;

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/zhttpsocket.rs → src/connmgr/zhttpsocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

use crate::connmgr::zhttppacket::{parse_ids, Id, ParseScratch};
use crate::core::arena;
use crate::core::buffer::trim_for_display;
use crate::core::channel;
Expand All @@ -28,7 +29,6 @@ use crate::future::{
RecvFuture, Select10, Select9, WaitWritableFuture, ZmqSendFuture, ZmqSendToFuture,
REGISTRATIONS_PER_CHANNEL, REGISTRATIONS_PER_ZMQSOCKET,
};
use crate::zhttppacket::{parse_ids, Id, ParseScratch};
use arrayvec::{ArrayString, ArrayVec};
use log::{debug, error, log_enabled, trace, warn};
use slab::Slab;
Expand Down Expand Up @@ -2736,10 +2736,10 @@ impl AsyncServerStreamHandle {
#[cfg(test)]
mod tests {
use super::*;
use crate::core::event;
use crate::zhttppacket::{
use crate::connmgr::zhttppacket::{
PacketParse, Request, RequestData, RequestPacket, Response, ResponsePacket,
};
use crate::core::event;
use test_log::test;

fn wait_readable(poller: &mut event::Poller, token: mio::Token) {
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub mod config;
pub mod event;
pub mod executor;
pub mod http1;
pub mod jwt;
pub mod list;
pub mod log;
pub mod net;
Expand Down
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::jwt;
use crate::core::timer::TimerWheel;
use crate::jwt;
use crate::version;
use libc;
use std::collections::HashSet;
Expand Down
6 changes: 3 additions & 3 deletions src/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* limitations under the License.
*/

use crate::connmgr::resolver;
use crate::connmgr::tls::{TlsStream, TlsStreamError, VerifyMode};
use crate::core::arena;
use crate::core::channel;
use crate::core::event::{self, ReadinessExt};
Expand All @@ -24,8 +26,6 @@ use crate::core::reactor::{
use crate::core::shuffle::shuffle;
use crate::core::waker::{RefWake, RefWaker, RefWakerData};
use crate::core::zmq::{MultipartHeader, ZmqSocket};
use crate::resolver;
use crate::tls::{TlsStream, TlsStreamError, VerifyMode};
use mio::net::{TcpListener, TcpStream, UnixListener, UnixStream};
use openssl::ssl;
use paste::paste;
Expand Down Expand Up @@ -2806,9 +2806,9 @@ pub fn yield_to_local_events() -> YieldToLocalEvents {
#[cfg(test)]
mod tests {
use super::*;
use crate::connmgr::tls::TlsAcceptor;
use crate::core::executor::Executor;
use crate::core::zmq::SpecInfo;
use crate::tls::TlsAcceptor;
use std::cmp;
use std::fs;
use std::mem;
Expand Down
16 changes: 1 addition & 15 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,12 @@
* $FANOUT_END_LICENSE$
*/

pub mod client;
pub mod connection;
pub mod connmgr;
pub mod core;
pub mod counter;
pub mod ffi;
pub mod future;
pub mod jwt;
pub mod listener;
pub mod pool;
pub mod publish_cli;
pub mod resolver;
pub mod publish;
pub mod runner;
pub mod server;
pub mod service;
pub mod tls;
pub mod track;
pub mod websocket;
pub mod zhttppacket;
pub mod zhttpsocket;

pub use std::pin::pin;

Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions src/runner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* limitations under the License.
*/

pub mod service;

use clap::{ArgAction, Parser};
use log::{error, warn};
use serde::Deserialize;
Expand Down
File renamed without changes.

0 comments on commit 83cf430

Please sign in to comment.