75 lines
2.7 KiB
Rust
75 lines
2.7 KiB
Rust
//! Replication types and protocols for distributed tidalDB deployments.
|
|
//!
|
|
//! The `replication` module is empty in single-node deployments --
|
|
//! all types default to `shard_id=0`, `region_id=0`, and routing is a no-op.
|
|
|
|
pub mod commit;
|
|
pub mod control;
|
|
pub mod crdt;
|
|
pub mod election;
|
|
pub mod election_store;
|
|
pub mod idempotency;
|
|
pub mod in_process;
|
|
pub mod lag;
|
|
pub mod membership_store;
|
|
pub mod migration;
|
|
pub mod receiver;
|
|
pub mod reconcile;
|
|
pub mod relay;
|
|
pub mod reseed;
|
|
pub mod segment_id;
|
|
pub mod session_bridge;
|
|
pub mod shard;
|
|
pub mod ship;
|
|
pub mod shipper;
|
|
pub mod state;
|
|
pub mod tenant;
|
|
pub mod transport;
|
|
pub mod upgrade;
|
|
|
|
pub use commit::{CommitIndex, QuorumWaitError};
|
|
pub use control::{ClusterHealth, ControlPlane, RegionHealth, ShardStats};
|
|
pub use crdt::{Hlc, HlcTimestamp};
|
|
pub use election::{
|
|
Action as ElectionAction, ElectionConfig, ElectionState, LogPosition, Role, VoteReply, VoteRpc,
|
|
};
|
|
pub use election_store::{BootState, ElectionStore, HardState};
|
|
pub use idempotency::{IdempotencyKey, IdempotencyStore};
|
|
pub use in_process::{InProcessTransport, InProcessTransportFactory};
|
|
pub use lag::ReplicationLagGauge;
|
|
pub use membership_store::{MembershipSnapshot, MembershipStore};
|
|
pub use migration::{MigrationState, TenantMigration};
|
|
pub use receiver::{
|
|
SegmentReceiverHandle, apply_payload, apply_payload_with_leader_seq, spawn_receiver,
|
|
};
|
|
pub use reconcile::{HardNegAction, MergePlan, ReconciliationEngine, StateSnapshot};
|
|
pub use relay::{
|
|
RelayEvent, SignalRelay, StagedRelayWrite, encode_run, range_payload, redeliver_missed,
|
|
single_event_payload,
|
|
};
|
|
pub use reseed::{RESEED_REQUIRED_MARKER, ReseedMarker, ReseedMarkerStore, ReseedReason};
|
|
pub use segment_id::WalSegmentId;
|
|
pub use session_bridge::{
|
|
InProcessSessionTransportFactory, SessionBridgeError, SessionPayload, SessionReplicationBridge,
|
|
SessionShardTransport,
|
|
};
|
|
pub use shard::{EntityIdRange, RegionId, RouterError, RoutingStrategy, ShardId, ShardRouter};
|
|
pub use ship::{ShipCollect, ShipQueue, ShipQueueConfig, ShipSource, WalFeedSource};
|
|
pub use shipper::{ShipperConfig, ShipperState, WalShipperHandle, spawn_shipper};
|
|
pub use state::ReplicationState;
|
|
pub use tenant::{
|
|
ClusterTopology, ShardAssignment, TenantConfig, TenantId, TenantRateLimiter, TenantRouter,
|
|
};
|
|
pub use transport::{Transport, TransportError, WalSegmentPayload};
|
|
pub use upgrade::{RollingUpgradeCoordinator, UpgradePhase};
|
|
|
|
/// Current wall-clock time in nanoseconds since the Unix epoch.
|
|
///
|
|
/// Uses `u64`, which overflows in year 2554 — safe for all practical purposes.
|
|
pub(crate) fn now_ns() -> u64 {
|
|
std::time::SystemTime::now()
|
|
.duration_since(std::time::UNIX_EPOCH)
|
|
.unwrap_or_default()
|
|
.as_nanos() as u64
|
|
}
|