v0.3.7-pre.011
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-job-backfill-lib/src/checkpoint.rs
|
||||
// version: 2
|
||||
// version: 3
|
||||
|
||||
/// Opaque caller-owned checkpoint for one controlled Backfill resumption.
|
||||
///
|
||||
@@ -43,6 +43,12 @@ impl crate::BackfillCheckpoint {
|
||||
return Self { job_id, scope_fingerprint, completed_prefix, resume_before };
|
||||
}
|
||||
|
||||
/// Reissues this opaque frontier for a new caller-owned Job identity without changing scope or progress.
|
||||
pub(crate) fn reissue_for_job(mut self, job_id: ksp_job_api::JobId) -> Self {
|
||||
self.job_id = job_id;
|
||||
return self;
|
||||
}
|
||||
|
||||
/// Returns the internal exclusive `before` cursor used only by controlled Before resumption.
|
||||
pub(crate) const fn resume_before(&self) -> std::option::Option<&crate::BackfillSignature> {
|
||||
return self.resume_before.as_ref();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-job-backfill-lib/src/request.rs
|
||||
// version: 5
|
||||
// version: 6
|
||||
|
||||
use sha2::Digest; // rust-rules: trait-import
|
||||
|
||||
@@ -396,6 +396,19 @@ impl crate::BackfillRequest {
|
||||
return std::result::Result::Ok(self);
|
||||
}
|
||||
|
||||
/// Reissues a validated checkpoint onto a new Job lifecycle while preserving exact request semantics.
|
||||
pub fn resume_for_job(&self, job_id: ksp_job_api::JobId, 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);
|
||||
}
|
||||
let checkpoint = checkpoint.reissue_for_job(job_id.clone());
|
||||
let mut resumed = self.clone();
|
||||
resumed.job_id = job_id;
|
||||
resumed.checkpoint = std::option::Option::None;
|
||||
return resumed.with_checkpoint(checkpoint);
|
||||
}
|
||||
|
||||
/// Returns the validated optional checkpoint supplied for controlled resumption.
|
||||
#[must_use]
|
||||
pub const fn checkpoint(&self) -> std::option::Option<&crate::BackfillCheckpoint> {
|
||||
|
||||
Reference in New Issue
Block a user