pub struct EdgeState { /* private fields */ }Expand description
Cheap-to-clone application state.
Implementations§
Source§impl EdgeState
impl EdgeState
Sourcepub fn new(config: EdgeConfig) -> Self
pub fn new(config: EdgeConfig) -> Self
The self-host default: bearer passthrough, no metering.
Sourcepub fn with_ports(
config: EdgeConfig,
resolver: Arc<dyn CredentialResolver>,
meter: Arc<dyn MeteringSink>,
) -> Self
pub fn with_ports( config: EdgeConfig, resolver: Arc<dyn CredentialResolver>, meter: Arc<dyn MeteringSink>, ) -> Self
Build state with an injected resolver + metering sink (the hosted gateway path). The gateway passes an API-key resolver and its analytics sink.
Sourcepub async fn resolve(
&self,
headers: &HeaderMap,
) -> Result<ResolvedCredential, ApiError>
pub async fn resolve( &self, headers: &HeaderMap, ) -> Result<ResolvedCredential, ApiError>
Resolve a request to a Brain credential via the injected resolver.
§Errors
Propagates the resolver’s 401/403 when no valid credential is present.
Sourcepub fn record(&self, op: &str, ident: &ResolvedCredential, outcome: Outcome)
pub fn record(&self, op: &str, ident: &ResolvedCredential, outcome: Outcome)
Record one op’s outcome via the injected sink (fire-and-forget).
Sourcepub async fn client_for(
&self,
credential: &str,
) -> Result<Arc<BrainClient>, ApiError>
pub async fn client_for( &self, credential: &str, ) -> Result<Arc<BrainClient>, ApiError>
Sourcepub fn pool(&self) -> &BrainPool
pub fn pool(&self) -> &BrainPool
The shared Brain connection pool (for the background idle sweeper and readiness probing).
Sourcepub fn meter(&self) -> Arc<dyn MeteringSink> ⓘ
pub fn meter(&self) -> Arc<dyn MeteringSink> ⓘ
The injected metering sink, shared. The wire proxy reuses it so wire-path ops meter through the same sink as the HTTP data plane.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for EdgeState
impl !UnwindSafe for EdgeState
impl Freeze for EdgeState
impl Send for EdgeState
impl Sync for EdgeState
impl Unpin for EdgeState
impl UnsafeUnpin for EdgeState
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