Expand description
Internal component of the
noxudatabase.This crate is published only so the
noxuumbrella crate can depend on it. Usenoxu(noxu = "7") in applications; depend on this crate directly only if you are extending the engine internals. Its API may change without a major version bump.
Replication and high availability for Noxu DB.
master-replica replication with automatic elections, VLSN tracking, network restore, and subscription.
§Architecture
The replication layer consists of:
- ReplicatedEnvironment – Entry point that wraps a standard Environment and adds replication capabilities. Rep.ReplicatedEnvironment`.
- Elections – Automatic master election using majority voting. Rep.elections`.
- VLSN Index – Maps version sequence numbers to log file positions.
- Feeder/Replica Stream – Master-to-replica log entry streaming. Port
- Network Transport – Pluggable channel-based communication. Rep.net`.
- Group Service – Replication group membership management.
- Consistency Policies – Configurable replica consistency guarantees.
- Master Transfer – Controlled transfer of master role.
- Network Restore – Full node restore from another replica.
- Subscription – External subscription to the replication stream.
§Node States
A replication node transitions through the following states:
- Detached – Not associated with the group (handle closed).
- Unknown – Not in contact with the master, actively trying to establish contact or decide upon a master.
- Master – The unique master of the group; can read and write.
- Replica – Being updated by the master; read-only.
The state transitions visible to the application follow:
[ MASTER | REPLICA | UNKNOWN ]+ DETACHED§Example
ⓘ
use noxu_rep::{ReplicatedEnvironment, RepConfig, NodeType};
let config = RepConfig::builder("my_group", "node1", "localhost")
.node_port(14_001)
.node_type(NodeType::Electable)
.build();
let rep_env = ReplicatedEnvironment::new(config).unwrap();Re-exports§
pub use auth::PeerAllowlist;pub use commit_durability::CommitDurability;pub use commit_durability::ReplicaAckPolicy;pub use commit_token::CommitToken;pub use consistency::ConsistencyPolicy;pub use consistency::ConsistencyTracker;pub use elections::phi_detector::PhiAccrualDetector;pub use error::RepError;pub use error::Result;pub use master_transfer::MasterTransfer;pub use master_transfer::MasterTransferConfig;pub use master_transfer::TransferState;pub use net::InMemoryEndpoint;pub use net::InMemoryGroup;pub use net::InMemoryTransport;pub use network_restore::NetworkRestore;pub use network_restore::NetworkRestoreConfig;pub use network_restore::RestoreState;pub use network_restore_server::NetworkRestoreServer;pub use network_restore_server::RESTORE_SERVICE_NAME;pub use node_state::NodeState;pub use node_state::NodeStateMachine;pub use node_type::NodeType;pub use quorum_policy::QuorumPolicy;pub use rep_config::RepConfig;pub use rep_config::RepTransportKind;pub use rep_group::RepGroup;pub use rep_node::RepNode;pub use rep_stats::RepStats;pub use replicated_environment::ReplicatedEnvironment;pub use replicated_environment::SyncupAction;pub use state_change_listener::StateChangeEvent;pub use state_change_listener::StateChangeListener;pub use stream::reconnect::ReconnectConfig;pub use stream::reconnect::ReconnectOutcome;pub use stream::reconnect::catch_up_with_retry;pub use subscription::Subscription;pub use subscription::SubscriptionCallback;pub use subscription::SubscriptionConfig;pub use subscription::SubscriptionState;pub use tls::TlsConfig;pub use tls::TlsIdentity;pub use tls::TrustedCerts;
Modules§
- ack_
tracker - Acknowledgment tracking for replication commits.
- auth
- Peer authentication and authorisation for replication.
- commit_
durability - Commit durability settings for replication.
- commit_
token - Commit tokens for commit-point read consistency.
- consistency
- Consistency policies for replica reads.
- elections
- Election subsystem for Noxu DB replication.
- error
- Replication error types.
- group_
admin - Group-administration service: master transfer and group shutdown.
- group_
service - Group membership service for replication.
- master_
transfer - Master transfer support.
- net
- Network transport layer for Noxu DB replication.
- network_
restore - Network restore for copying database files from another node.
- network_
restore_ server - Server-side network restore: stream log files to a requesting node.
- node_
state - Node state machine for replication nodes.
- node_
type - Replication node types.
- protocol
- Replication protocol messages.
- quorum_
policy - Quorum policy for Flexible Paxos (Howard 2019).
- rep_
config - Replication configuration.
- rep_
group - Replication group management.
- rep_
node - Replication node information.
- rep_
stats - Replication statistics.
- replicated_
environment - The main replicated environment API.
- state_
change_ listener - State change notification for replication nodes.
- stream
- Replication stream subsystem.
- subscription
- Replication subscription for receiving replicated entries from a feeder.
- test_
harness - In-memory test harness for replication group testing.
- tls
- TLS configuration for Noxu DB replication channels.
- vlsn
- VLSN tracking subsystem.