Skip to main content

PlacementAt

Struct PlacementAt 

Source
pub struct PlacementAt {
    pub placement: Placement,
    pub epoch: Epoch,
    pub phase: MigrationPhase,
    pub endpoint: Option<String>,
}
Expand description

A Placement together with the placement-table epoch it was read at and the partition’s migration phase.

The epoch flows into the routing decision and onto the write so migration cutover can detect a write resolved against a superseded placement (docs/06 §2); the phase is shape-only context for observability.

§Examples

use osproxy_spi::{Placement, PlacementAt, MigrationPhase};
use osproxy_spi::core::{ClusterId, Epoch};

let at = PlacementAt::new(
    Placement::DedicatedCluster { cluster: ClusterId::from("eu-1") },
    Epoch::new(7),
)
.with_phase(MigrationPhase::Draining);
assert_eq!(at.epoch, Epoch::new(7));
assert_eq!(at.phase, MigrationPhase::Draining);

Fields§

§placement: Placement

The resolved placement.

§epoch: Epoch

The epoch the placement table was at when this was read.

§phase: MigrationPhase

The partition’s migration phase at read time.

§endpoint: Option<String>

The base URL of the placement’s cluster. The tenancy is the source of truth for where each cluster lives; the sink builds a pool for this URL the first time it routes to the cluster. Required to reach a live cluster (an in-memory sink ignores it).

Implementations§

Source§

impl PlacementAt

Source

pub fn new(placement: Placement, epoch: Epoch) -> Self

Pairs a placement with the epoch it was read at (settled, not migrating, no endpoint).

Source

pub fn with_phase(self, phase: MigrationPhase) -> Self

Sets the migration phase (builder style).

Source

pub fn with_endpoint(self, endpoint: impl Into<String>) -> Self

Sets the cluster’s base URL (builder style). This is how the tenancy tells the proxy where the placement’s cluster lives, e.g. .with_endpoint("https://eu-1.internal:9200").

Trait Implementations§

Source§

impl Clone for PlacementAt

Source§

fn clone(&self) -> PlacementAt

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for PlacementAt

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for PlacementAt

Source§

impl PartialEq for PlacementAt

Source§

fn eq(&self, other: &PlacementAt) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for PlacementAt

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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,

Source§

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>,

Source§

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>,

Source§

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.