1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! When the hyper server receives an HTTP request it is assigned to a
//! single worker thread and the HTTP request is stored in a:
//! [`CoreHttpRequest`](crate::core::server::core_http_request::CoreHttpRequest)
//! object for the single hyper worker thread to serve the request.
//! To do this, the ``CoreHttpRequest`` must store everything the
//! worker thread will need to serve the HTTP request including:
//! - the static server configuration in the member field::
//! [`config: CoreConfig`](crate::core::core_config::CoreConfig)
//! - the postgres bb8 db threadpool in the member field:
//! [`db_pool: Pool<PostgresConnectionManager<MakeTlsConnector>>`](bb8::Pool)
//! - the kafka threadpool's
//! [`KafkaPublisher`](kafka_threadpool::KafkaPublisher)
//! in the member field:
//! [`kafka_pool: KafkaPublisher`](kafka_threadpool::KafkaPublisher)
//! - the HTTP request in the member field:
//! [`request: Request<Body>`](hyper::Request)
//! - the HTTP response in the member field:
//! [`response: Response`](hyper::Response)
//!
use MakeTlsConnector;
use Pool;
use PostgresConnectionManager;
use Body;
use Request;
use Response;
use KafkaPublisher;
use crateCoreConfig;
use crateTlsInfo;
/// CoreHttpRequest
///
/// Wrapper for building an internal object that owns both
/// a hyper [`Request`](hyper::Request) and a
/// [`Response`](hyper::Response). It also owns all cloned
/// statics (config is a
/// [`CoreConfig`](crate::core::core_config::CoreConfig)
/// ),
/// tls information (tls_info is a
/// [`TlsInfo`](crate::tls::tls_info::TlsInfo)
/// ), and db_pool is a [`Pool`](bb8::Pool) reference to the
/// postgres client db threadpool.
///
/// If the environment variable ``KAFKA_ENABLED=1`` then
/// the ``kafka_pool`` allows for each HTTP request to
/// publish messages to the configured kafka cluster.
/// Please see the
/// [kafka_threadpool docs](https://docs.rs/kafka-threadpool/latest/kafka_threadpool/)
/// for more information on how to configure the
/// kafka publisher threadpool.
///
/// Everything a growing request needs!
///