pub struct SimulationEnvironment {
pub id: Uuid,
pub label: String,
pub branch: Branch,
pub parent_branch_id: Uuid,
pub started_at: DateTime<Utc>,
pub scenario: SimulationScenario,
pub status: SandboxStatus,
}Expand description
Fields§
§id: UuidA unique identifier for this simulation run.
label: StringA human-readable label for the sandbox branch.
branch: BranchThe isolated branch backing this environment.
parent_branch_id: UuidThe parent branch from which this sandbox was forked.
started_at: DateTime<Utc>The timestamp the environment was initialized.
scenario: SimulationScenarioThe scenario definition that governs this run.
status: SandboxStatusThe current lifecycle status of the sandbox.
Implementations§
Source§impl SimulationEnvironment
impl SimulationEnvironment
Sourcepub async fn setup(
parent: &Branch,
scenario: SimulationScenario,
_config: Arc<BranchConfig>,
lifecycle: Arc<BranchLifecycle>,
) -> BranchResult<Self>
pub async fn setup( parent: &Branch, scenario: SimulationScenario, _config: Arc<BranchConfig>, lifecycle: Arc<BranchLifecycle>, ) -> BranchResult<Self>
Forks parent into a new sandbox branch and returns an initialized environment.
The branch name follows the pattern sandbox/{scenario.name}/{id_short}.
Sourcepub async fn teardown(
&mut self,
lifecycle: Arc<BranchLifecycle>,
) -> BranchResult<()>
pub async fn teardown( &mut self, lifecycle: Arc<BranchLifecycle>, ) -> BranchResult<()>
Discards the sandbox branch, freeing any on-disk state.
After calling teardown, the branch database is marked as Discarded and
will be removed on the next GC pass.
Sourcepub async fn branch_pool(&self) -> BranchResult<SqlitePool>
pub async fn branch_pool(&self) -> BranchResult<SqlitePool>
Opens a read-write SQLite pool connected to the sandbox branch database.
Trait Implementations§
Source§impl Clone for SimulationEnvironment
impl Clone for SimulationEnvironment
Source§fn clone(&self) -> SimulationEnvironment
fn clone(&self) -> SimulationEnvironment
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SimulationEnvironment
impl RefUnwindSafe for SimulationEnvironment
impl Send for SimulationEnvironment
impl Sync for SimulationEnvironment
impl Unpin for SimulationEnvironment
impl UnsafeUnpin for SimulationEnvironment
impl UnwindSafe for SimulationEnvironment
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more