pub struct Upstream {
pub name: Arc<str>,
pub key: String,
/* private fields */
}Expand description
Represents a group of backend servers and their configuration for load balancing and connection management
Fields§
§name: Arc<str>Unique identifier for this upstream group
key: StringHash key used to detect configuration changes
Implementations§
Source§impl Upstream
impl Upstream
Sourcepub fn new(
name: &str,
conf: &UpstreamConf,
sender: Option<Arc<NotificationSender>>,
) -> Result<Self, Error>
pub fn new( name: &str, conf: &UpstreamConf, sender: Option<Arc<NotificationSender>>, ) -> Result<Self, Error>
Sourcepub fn new_http_peer(
&self,
session: &Session,
client_ip: &Option<String>,
) -> Option<HttpPeer>
pub fn new_http_peer( &self, session: &Session, client_ip: &Option<String>, ) -> Option<HttpPeer>
Creates and configures a new HTTP peer for handling requests
§Arguments
session- Current HTTP session containing request detailsctx- Request context state
§Returns
Option<HttpPeer>- Configured HTTP peer if a healthy backend is available, None otherwise
This method:
- Selects an appropriate backend using the configured load balancing strategy
- Increments the processing counter
- Creates and configures an HttpPeer with the connection settings
Sourcepub fn get_backends(&self) -> Option<&Backends>
pub fn get_backends(&self) -> Option<&Backends>
Returns the backends of the upstream
§Returns
Option<&Backends>- The backends of the upstream if available, None otherwise
pub async fn run_health_check(&self) -> Result<(), Error>
pub fn is_transparent(&self) -> bool
pub fn connected(&self) -> Option<i32>
pub fn stats(&self) -> UpstreamStats
Trait Implementations§
Source§impl UpstreamInstance for Upstream
impl UpstreamInstance for Upstream
Source§fn completed(&self) -> i32
fn completed(&self) -> i32
Decrements and returns the number of requests being processed
§Returns
i32- Previous count of requests being processed
fn on_transport_failure(&self, address: &str)
fn on_response(&self, address: &str, status: StatusCode)
Auto Trait Implementations§
impl !Freeze for Upstream
impl !RefUnwindSafe for Upstream
impl Send for Upstream
impl Sync for Upstream
impl Unpin for Upstream
impl UnsafeUnpin for Upstream
impl !UnwindSafe for Upstream
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request