Struct azure_core::Pipeline

source ·
pub struct Pipeline { /* private fields */ }
Expand description

Execution pipeline.

A pipeline follows a precise flow:

  1. Client library-specified per-call policies are executed. Per-call policies can fail and bail out of the pipeline immediately.
  2. User-specified per-call policies are executed.
  3. Telemetry policy.
  4. Retry policy. It allows to re-execute the following policies.
  5. Client library-specified per-retry policies. Per-retry polices are always executed at least once but are re-executed in case of retries.
  6. User-specified per-retry policies are executed.
  7. Authorization policy. Authorization can depend on the HTTP headers and/or the request body so it must be executed right before sending the request to the transport. Also, the authorization can depend on the current time so it must be executed at every retry.
  8. Transport policy. Transport policy is always the last policy and is the policy that actually constructs the Response to be passed up the pipeline.

A pipeline is immutable. In other words a policy can either succeed and call the following policy of fail and return to the calling policy. Arbitrary policy “skip” must be avoided (but cannot be enforced by code). All policies except Transport policy can assume there is another following policy (so self.pipeline[0] is always valid).

The C generic contains the pipeline-specific context. Different crates can pass different contexts using this generic. This way each crate can have its own specific pipeline context. For example, in CosmosDB, the generic carries the operation-specific information used by the authorization policy.

Implementations§

source§

impl Pipeline

source

pub fn new( crate_name: Option<&'static str>, crate_version: Option<&'static str>, options: ClientOptions, per_call_policies: Vec<Arc<dyn Policy>>, per_retry_policies: Vec<Arc<dyn Policy>> ) -> Self

Creates a new pipeline given the client library crate name and version, alone with user-specified and client library-specified policies.

Crates can simply pass option_env!("CARGO_PKG_NAME") and option_env!("CARGO_PKG_VERSION") for the crate_name and crate_version arguments respectively.

source

pub fn replace_policy( &mut self, policy: Arc<dyn Policy>, position: usize ) -> Arc<dyn Policy>

source

pub fn policies(&self) -> &[Arc<dyn Policy>]

source

pub async fn send( &self, ctx: &Context, request: &mut Request ) -> Result<Response>

Trait Implementations§

source§

impl Clone for Pipeline

source§

fn clone(&self) -> Pipeline

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Pipeline

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more