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: PlacementThe resolved placement.
epoch: EpochThe epoch the placement table was at when this was read.
phase: MigrationPhaseThe 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
impl PlacementAt
Sourcepub fn new(placement: Placement, epoch: Epoch) -> Self
pub fn new(placement: Placement, epoch: Epoch) -> Self
Pairs a placement with the epoch it was read at (settled, not migrating, no endpoint).
Sourcepub fn with_phase(self, phase: MigrationPhase) -> Self
pub fn with_phase(self, phase: MigrationPhase) -> Self
Sets the migration phase (builder style).
Sourcepub fn with_endpoint(self, endpoint: impl Into<String>) -> Self
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
impl Clone for PlacementAt
Source§fn clone(&self) -> PlacementAt
fn clone(&self) -> PlacementAt
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PlacementAt
impl Debug for PlacementAt
impl Eq for PlacementAt
Source§impl PartialEq for PlacementAt
impl PartialEq for PlacementAt
Source§fn eq(&self, other: &PlacementAt) -> bool
fn eq(&self, other: &PlacementAt) -> bool
self and other values to be equal, and is used by ==.