pub struct RepEnvInfo { /* private fields */ }Expand description
Per-node information held by RepTestBase.
Mirrors JE’s RepTestUtils.RepEnvInfo — owns one node’s
configuration and (optionally) its ReplicatedEnvironment
once open_env has been called.
Cloning a RepEnvInfo shares the underlying Arc<ReplicatedEnvironment>
so the harness can hand out cheap references without giving up ownership.
Implementations§
Source§impl RepEnvInfo
impl RepEnvInfo
Sourcepub fn new(config: RepConfig, node_id: u32) -> Self
pub fn new(config: RepConfig, node_id: u32) -> Self
Construct a RepEnvInfo with a configuration but no open environment.
Mirrors new RepEnvInfo(envHome, repConfig, envConfig) in JE.
Sourcepub fn open_env(&mut self) -> Result<Arc<ReplicatedEnvironment>>
pub fn open_env(&mut self) -> Result<Arc<ReplicatedEnvironment>>
Open the ReplicatedEnvironment for this node. After open_env
the node is in NodeState::Detached (as just-opened) until a
become_master / become_replica call drives a transition.
Mirrors JE’s RepEnvInfo.openEnv.
Sourcepub fn close_env(&mut self) -> Result<()>
pub fn close_env(&mut self) -> Result<()>
Close the environment and drop our handle. After close_env,
open_env may be called again to simulate a node restart.
Mirrors JE’s RepEnvInfo.closeEnv.
Sourcepub fn abnormal_close_env(&mut self)
pub fn abnormal_close_env(&mut self)
Drop the env handle without calling close() — simulates a crash.
Subsequent open_env will create a fresh node.
Mirrors JE’s RepEnvInfo.abnormalCloseEnv.
Sourcepub fn get_env(&self) -> Arc<ReplicatedEnvironment> ⓘ
pub fn get_env(&self) -> Arc<ReplicatedEnvironment> ⓘ
Returns the open env handle, panicking if open_env has not been
called. Use RepEnvInfo::env for a fallible accessor.
Sourcepub fn env(&self) -> Option<&Arc<ReplicatedEnvironment>>
pub fn env(&self) -> Option<&Arc<ReplicatedEnvironment>>
Returns the open env handle, or None if not yet opened.
Sourcepub fn rep_config(&self) -> &RepConfig
pub fn rep_config(&self) -> &RepConfig
Returns the RepConfig for this node.
Sourcepub fn is_master(&self) -> bool
pub fn is_master(&self) -> bool
Returns true iff the node is currently in NodeState::Master.
Sourcepub fn is_replica(&self) -> bool
pub fn is_replica(&self) -> bool
Returns true iff the node is currently in NodeState::Replica.
Sourcepub fn is_unknown(&self) -> bool
pub fn is_unknown(&self) -> bool
Returns true iff the node is currently in NodeState::Unknown.
Sourcepub fn state(&self) -> Option<NodeState>
pub fn state(&self) -> Option<NodeState>
Returns the current node state, or None if the env is not open.
Sourcepub fn current_vlsn(&self) -> u64
pub fn current_vlsn(&self) -> u64
Returns the current VLSN, or 0 if the env is not open.
Auto Trait Implementations§
impl !RefUnwindSafe for RepEnvInfo
impl !UnwindSafe for RepEnvInfo
impl Freeze for RepEnvInfo
impl Send for RepEnvInfo
impl Sync for RepEnvInfo
impl Unpin for RepEnvInfo
impl UnsafeUnpin for RepEnvInfo
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
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>
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>
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