@@ -12,8 +12,8 @@ use super::request::HttpRequest;
12
12
/// Response type for use in the `Service` implementation of HTTP stream sinks.
13
13
pub struct HttpResponse {
14
14
pub ( super ) http_response : Response < Bytes > ,
15
- events_byte_size : GroupedCountByteSize ,
16
- raw_byte_size : usize ,
15
+ pub ( super ) events_byte_size : GroupedCountByteSize ,
16
+ pub ( super ) raw_byte_size : usize ,
17
17
}
18
18
19
19
impl DriverResponse for HttpResponse {
@@ -34,14 +34,18 @@ impl DriverResponse for HttpResponse {
34
34
}
35
35
}
36
36
37
+ /// Build HTTP requests for the `HttpService`.
37
38
///
39
+ /// This trait exists to allow HTTP based stream sinks to utilize the common `HttpService`
40
+ /// while being able to define sink-specific HTTP requests.
38
41
pub trait HttpServiceRequestBuilder {
39
- /// B
40
42
fn build ( & self , body : BytesMut ) -> Request < Bytes > ;
41
43
}
42
44
43
45
/// `Service` implementation of HTTP stream sinks.
44
46
///
47
+ /// `http_request_builder` <R> must implement the `HttpServiceRequestBuilder` trait, which is
48
+ /// used in the `Service::call()` function to handle sink-specific HTTP request building.
45
49
#[ derive( Debug , Clone ) ]
46
50
pub struct HttpService < R > {
47
51
http_request_builder : R ,
@@ -50,6 +54,7 @@ pub struct HttpService<R> {
50
54
}
51
55
52
56
impl < R > HttpService < R > {
57
+ /// Creates a new `HttpService`.
53
58
pub const fn new ( http_request_builder : R , client : HttpClient , protocol : String ) -> Self {
54
59
Self {
55
60
http_request_builder,
0 commit comments