pub enum SessionDecision {
UseSticky(Uuid),
AcquireFresh,
AcquireAndBind(Duration),
}Expand description
Outcome of SessionMap::acquire_session.
Describes whether the caller should reuse an existing sticky binding,
acquire a fresh proxy (without binding), or acquire a fresh proxy and
bind it for a TTL. Returned by acquire_session so the caller can
drive the rotation-strategy call itself (the
SessionMap stays pure — no async, no strategy dependency).
§Example
use stygian_proxy::session::SessionDecision;
use std::time::Duration;
use uuid::Uuid;
let id = Uuid::new_v4();
let decision = SessionDecision::UseSticky(id);
assert!(matches!(decision, SessionDecision::UseSticky(_)));
let decision = SessionDecision::AcquireAndBind(Duration::from_mins(30));
assert!(matches!(decision, SessionDecision::AcquireAndBind(_)));Variants§
UseSticky(Uuid)
Reuse the existing sticky binding for proxy_id. No fresh
acquisition is needed.
AcquireFresh
Acquire a fresh proxy via the rotation strategy; do not bind
it. Used for FreshPerRequest (and as the safe fallback for
StickyForRequestCount).
AcquireAndBind(Duration)
Acquire a fresh proxy via the rotation strategy and bind it for
ttl. Used for StickyForTtl and StickyForever when no
binding currently exists.
Trait Implementations§
Source§impl Clone for SessionDecision
impl Clone for SessionDecision
Source§fn clone(&self) -> SessionDecision
fn clone(&self) -> SessionDecision
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SessionDecision
impl Debug for SessionDecision
impl Eq for SessionDecision
Source§impl PartialEq for SessionDecision
impl PartialEq for SessionDecision
Source§fn eq(&self, other: &SessionDecision) -> bool
fn eq(&self, other: &SessionDecision) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for SessionDecision
Auto Trait Implementations§
impl Freeze for SessionDecision
impl RefUnwindSafe for SessionDecision
impl Send for SessionDecision
impl Sync for SessionDecision
impl Unpin for SessionDecision
impl UnsafeUnpin for SessionDecision
impl UnwindSafe for SessionDecision
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.