Skip to main content

RepEnvInfo

Struct RepEnvInfo 

Source
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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn env(&self) -> Option<&Arc<ReplicatedEnvironment>>

Returns the open env handle, or None if not yet opened.

Source

pub fn rep_config(&self) -> &RepConfig

Returns the RepConfig for this node.

Source

pub fn node_name(&self) -> &str

Returns the node name (config.node_name).

Source

pub fn node_id(&self) -> u32

Returns the 1-based node id.

Source

pub fn is_master(&self) -> bool

Returns true iff the node is currently in NodeState::Master.

Source

pub fn is_replica(&self) -> bool

Returns true iff the node is currently in NodeState::Replica.

Source

pub fn is_unknown(&self) -> bool

Returns true iff the node is currently in NodeState::Unknown.

Source

pub fn state(&self) -> Option<NodeState>

Returns the current node state, or None if the env is not open.

Source

pub fn current_vlsn(&self) -> u64

Returns the current VLSN, or 0 if the env is not open.

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> 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V