v0.3.6-pre.008
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-job-backfill-lib/src/request.rs
|
||||
// version: 2
|
||||
// version: 3
|
||||
|
||||
use sha2::Digest; // rust-rules: trait-import
|
||||
|
||||
@@ -251,6 +251,7 @@ pub struct BackfillRequest {
|
||||
hydration_concurrency: usize,
|
||||
min_context_slot: std::option::Option<u64>,
|
||||
scope_fingerprint: BackfillScopeFingerprint,
|
||||
checkpoint: std::option::Option<crate::BackfillCheckpoint>,
|
||||
}
|
||||
|
||||
impl BackfillRequest {
|
||||
@@ -308,6 +309,7 @@ impl BackfillRequest {
|
||||
hydration_concurrency,
|
||||
min_context_slot,
|
||||
scope_fingerprint,
|
||||
checkpoint: std::option::Option::None,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -379,6 +381,22 @@ impl BackfillRequest {
|
||||
pub const fn scope_fingerprint(&self) -> BackfillScopeFingerprint {
|
||||
return self.scope_fingerprint;
|
||||
}
|
||||
|
||||
/// Attaches one caller-owned checkpoint after validating Job and semantic scope identity.
|
||||
pub fn with_checkpoint(mut self, checkpoint: crate::BackfillCheckpoint) -> ksp_core_lib::Result<Self> {
|
||||
let validation = crate::validate_request_checkpoint(&self.job_id, self.scope_fingerprint, self.scope.kind(), &checkpoint);
|
||||
if let std::result::Result::Err(error) = validation {
|
||||
return std::result::Result::Err(error);
|
||||
}
|
||||
self.checkpoint = std::option::Option::Some(checkpoint);
|
||||
return std::result::Result::Ok(self);
|
||||
}
|
||||
|
||||
/// Returns the validated optional checkpoint supplied for controlled resumption.
|
||||
#[must_use]
|
||||
pub const fn checkpoint(&self) -> std::option::Option<&crate::BackfillCheckpoint> {
|
||||
return self.checkpoint.as_ref();
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for BackfillRequest {
|
||||
@@ -396,6 +414,7 @@ impl std::fmt::Debug for BackfillRequest {
|
||||
.field("hydration_concurrency", &self.hydration_concurrency)
|
||||
.field("min_context_slot", &self.min_context_slot)
|
||||
.field("scope_fingerprint", &self.scope_fingerprint)
|
||||
.field("has_checkpoint", &self.checkpoint.is_some())
|
||||
.finish();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user