pub struct InMemoryPlanStore { /* private fields */ }Expand description
In-memory store for tests. Tracks status + applied routes per plan_id.
Implementations§
Source§impl InMemoryPlanStore
impl InMemoryPlanStore
Sourcepub fn with_failing_route_write() -> Self
pub fn with_failing_route_write() -> Self
Construct a store whose PlanStore::mark_applied always fails the
route write (and therefore the whole atomic operation). For tests
that assert no audit row is emitted when persistence fails.
Sourcepub fn seed_projected(&self) -> Uuid
pub fn seed_projected(&self) -> Uuid
Seed a row in status='projected'. Returns the id for callers to
pass to apply_plan.
Sourcepub fn status(&self, plan_id: Uuid) -> Option<String>
pub fn status(&self, plan_id: Uuid) -> Option<String>
Read-only status lookup, used by tests to assert state transitions.
Sourcepub fn applied_routes(&self, plan_id: Uuid) -> Option<Vec<ProposedRoute>>
pub fn applied_routes(&self, plan_id: Uuid) -> Option<Vec<ProposedRoute>>
Read-only lookup of the routes persisted by a successful apply. Used by tests to assert the proposed routes actually landed in the store (the heart of the rv-plan-apply-writes-routes fix).
Trait Implementations§
Source§impl Default for InMemoryPlanStore
impl Default for InMemoryPlanStore
Source§fn default() -> InMemoryPlanStore
fn default() -> InMemoryPlanStore
Returns the “default value” for a type. Read more
Source§impl PlanStore for InMemoryPlanStore
impl PlanStore for InMemoryPlanStore
Source§fn mark_applied<'life0, 'life1, 'async_trait>(
&'life0 self,
plan_id: Uuid,
applied_at: DateTime<Utc>,
routes: &'life1 [ProposedRoute],
) -> Pin<Box<dyn Future<Output = Result<Option<String>, ApplyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mark_applied<'life0, 'life1, 'async_trait>(
&'life0 self,
plan_id: Uuid,
applied_at: DateTime<Utc>,
routes: &'life1 [ProposedRoute],
) -> Pin<Box<dyn Future<Output = Result<Option<String>, ApplyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Atomically (1) transition
plan_id from status 'projected' to
'applied' and stamp applied_at, AND (2) persist routes to the
Gateway routing config the live gateway reads. Return the previous
status when the row exists, or None when no such row. Read moreAuto Trait Implementations§
impl Freeze for InMemoryPlanStore
impl RefUnwindSafe for InMemoryPlanStore
impl Send for InMemoryPlanStore
impl Sync for InMemoryPlanStore
impl Unpin for InMemoryPlanStore
impl UnsafeUnpin for InMemoryPlanStore
impl UnwindSafe for InMemoryPlanStore
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