diff --git a/d-engine-core/src/raft_role/leader_state.rs b/d-engine-core/src/raft_role/leader_state.rs index 2fe9afed..b82c959b 100644 --- a/d-engine-core/src/raft_role/leader_state.rs +++ b/d-engine-core/src/raft_role/leader_state.rs @@ -3247,7 +3247,7 @@ impl LeaderState { // Step 1: Remove stale entries (older than configured threshold) let now = Instant::now(); self.pending_promotions.retain(|entry| { - now.duration_since(entry.ready_since) <= config.stale_learner_threshold + now.saturating_duration_since(entry.ready_since) <= config.stale_learner_threshold }); if self.pending_promotions.is_empty() { @@ -3661,10 +3661,11 @@ impl LeaderState { trace!( "Inspecting entry: {:?} - {:?} - {:?}", entry, - now.duration_since(entry.ready_since), + now.saturating_duration_since(entry.ready_since), &config.stale_learner_threshold ); - if now.duration_since(entry.ready_since) > config.stale_learner_threshold { + if now.saturating_duration_since(entry.ready_since) > config.stale_learner_threshold + { stale_entries.push(entry); } else { // Return non-stale entry and stop diff --git a/d-engine-server/src/lib.rs b/d-engine-server/src/lib.rs index ac7c8f08..0338d456 100644 --- a/d-engine-server/src/lib.rs +++ b/d-engine-server/src/lib.rs @@ -132,8 +132,11 @@ pub use d_engine_core::Result; pub use d_engine_core::SnapshotError; /// Storage-specific error type pub use d_engine_core::StorageError; -// -------------------- Extension Traits -------------------- +// -------------------- Client API -------------------- pub use api::EmbeddedClient; +/// Unified client operations trait (put/get/delete/CAS/watch). +/// Re-exported here so embedded-mode users don't need a separate d-engine-client dependency. +pub use d_engine_core::client::{ClientApi, ClientApiError, ClientApiResult}; /// Storage trait for implementing custom storage backends /// /// Implement this trait to create your own storage engine.