Skip to content

Commit 8538cc1

Browse files
authored
Merge pull request #62 from skel84/issue-51-quorum-write-path
feat(replication): add quorum write path
2 parents 1c0a2f1 + 9871620 commit 8538cc1

File tree

8 files changed

+990
-38
lines changed

8 files changed

+990
-38
lines changed

crates/allocdb-node/src/engine.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,27 @@ impl SingleNodeEngine {
588588
self.enqueue_validated(request_slot, request, encoded.to_vec())
589589
}
590590

591+
/// Validates one encoded client request against the current engine bounds without enqueuing or
592+
/// applying it.
593+
///
594+
/// # Errors
595+
///
596+
/// Returns [`SubmissionError`] if decoding fails, the payload is oversized, the engine is
597+
/// halted, or the request slot would overflow the allocator's bounded windows.
598+
pub fn validate_encoded_submission(
599+
&self,
600+
request_slot: Slot,
601+
encoded: &[u8],
602+
) -> Result<(), SubmissionError> {
603+
if !self.accepting_writes {
604+
return Err(SubmissionError::EngineHalted);
605+
}
606+
607+
self.validate_bytes(encoded)?;
608+
let request = decode_client_request(encoded).map_err(SubmissionError::InvalidRequest)?;
609+
self.validate_client_request_slot(request_slot, request.command)
610+
}
611+
591612
/// Processes one queued submission by assigning an LSN, appending it to the WAL, syncing, and
592613
/// applying through the live allocator path.
593614
///

crates/allocdb-node/src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ pub use engine::{
1919
SubmissionErrorCategory, SubmissionResult,
2020
};
2121
pub use replica::{
22-
DurableVote, RecoverReplicaError, ReplicaFault, ReplicaFaultReason, ReplicaId, ReplicaIdentity,
23-
ReplicaMetadata, ReplicaMetadataDecodeError, ReplicaMetadataFile, ReplicaMetadataFileError,
24-
ReplicaMetadataLoadError, ReplicaNode, ReplicaNodeStatus, ReplicaOpenError, ReplicaPaths,
25-
ReplicaRole, ReplicaStartupValidationError,
22+
DurableVote, NotPrimaryReadError, RecoverReplicaError, ReplicaFault, ReplicaFaultReason,
23+
ReplicaId, ReplicaIdentity, ReplicaMetadata, ReplicaMetadataDecodeError, ReplicaMetadataFile,
24+
ReplicaMetadataFileError, ReplicaMetadataLoadError, ReplicaNode, ReplicaNodeStatus,
25+
ReplicaOpenError, ReplicaPaths, ReplicaPreparedEntry, ReplicaProtocolError, ReplicaRole,
26+
ReplicaStartupValidationError,
2627
};

0 commit comments

Comments
 (0)