pub struct ReplicatedEngine { /* private fields */ }Expand description
Wraps Engine + HttpReplicationServer (primary) or Engine + AntiEntropyLoop (replica).
Background threads are owned by this struct. When dropped, threads continue
running until the process exits — same behavior as calling start() manually.
Implementations§
Source§impl ReplicatedEngine
impl ReplicatedEngine
Sourcepub fn open_primary(
config: EdgestoreConfig,
bind_addr: &str,
) -> Result<ReplicatedEngine, EdgestoreError>
pub fn open_primary( config: EdgestoreConfig, bind_addr: &str, ) -> Result<ReplicatedEngine, EdgestoreError>
Open a primary replication node.
Starts HttpReplicationServer on bind_addr in a background thread.
The engine is writable. Other nodes point their AntiEntropyLoop at this address.
Sourcepub fn open_replica(
config: EdgestoreConfig,
primary_url: &str,
) -> Result<ReplicatedEngine, EdgestoreError>
pub fn open_replica( config: EdgestoreConfig, primary_url: &str, ) -> Result<ReplicatedEngine, EdgestoreError>
Open a replica node.
Opens the engine in read-only mode (Engine::open_readonly) and starts an
AntiEntropyLoop that pulls from primary_url. The engine rejects all write
calls with Err(EdgestoreError::ReadOnly).
primary_url must be the base URL of the primary’s HttpReplicationServer
(e.g. "http://host:8900").
Sourcepub fn engine(&self) -> &Arc<Mutex<Engine>>
pub fn engine(&self) -> &Arc<Mutex<Engine>>
Access the underlying Arc<Mutex<Engine>> for reads (replica) or reads+writes (primary).
Sourcepub fn bound_port(&self) -> Option<u16>
pub fn bound_port(&self) -> Option<u16>
Port the HttpReplicationServer is listening on, or None for a replica.