v0.3.6-pre.009-fix.001
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-job-backfill-lib/src/checkpoint.rs
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
/// Opaque caller-owned checkpoint for one controlled Backfill resumption.
|
||||
///
|
||||
@@ -14,7 +14,7 @@ pub struct BackfillCheckpoint {
|
||||
resume_before: std::option::Option<crate::BackfillSignature>,
|
||||
}
|
||||
|
||||
impl BackfillCheckpoint {
|
||||
impl crate::BackfillCheckpoint {
|
||||
/// Returns the logical Job identity that owns this checkpoint.
|
||||
#[must_use]
|
||||
pub const fn job_id(&self) -> &ksp_job_api::JobId {
|
||||
@@ -49,7 +49,7 @@ impl BackfillCheckpoint {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for BackfillCheckpoint {
|
||||
impl std::fmt::Debug for crate::BackfillCheckpoint {
|
||||
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
return formatter
|
||||
.debug_struct("BackfillCheckpoint")
|
||||
@@ -67,7 +67,7 @@ pub(crate) struct CompletionFrontier {
|
||||
contiguous_completed: usize,
|
||||
}
|
||||
|
||||
impl CompletionFrontier {
|
||||
impl crate::CompletionFrontier {
|
||||
/// Creates one empty frontier for the exact bounded candidate count.
|
||||
pub(crate) fn new(candidate_count: usize) -> Self {
|
||||
return Self { durable: vec![false; candidate_count], contiguous_completed: 0 };
|
||||
@@ -109,7 +109,7 @@ pub(crate) fn validate_request_checkpoint(
|
||||
request_job_id: &ksp_job_api::JobId,
|
||||
scope_fingerprint: crate::BackfillScopeFingerprint,
|
||||
scope_kind: crate::BackfillScopeKind,
|
||||
checkpoint: &BackfillCheckpoint,
|
||||
checkpoint: &crate::BackfillCheckpoint,
|
||||
) -> ksp_core_lib::Result<()> {
|
||||
if checkpoint.job_id() != request_job_id {
|
||||
return std::result::Result::Err(checkpoint_error("checkpoint.job_id"));
|
||||
@@ -157,9 +157,9 @@ pub(crate) fn execution_resume_offset(request: &crate::BackfillRequest, discover
|
||||
pub(crate) fn checkpoint_from_frontier(
|
||||
request: &crate::BackfillRequest,
|
||||
discovery: &crate::BackfillDiscovery,
|
||||
frontier: &CompletionFrontier,
|
||||
) -> ksp_core_lib::Result<BackfillCheckpoint> {
|
||||
let validation = validate_discovery_identity(request, discovery);
|
||||
frontier: &crate::CompletionFrontier,
|
||||
) -> ksp_core_lib::Result<crate::BackfillCheckpoint> {
|
||||
let validation = crate::validate_discovery_identity(request, discovery);
|
||||
if let std::result::Result::Err(error) = validation {
|
||||
return std::result::Result::Err(error);
|
||||
}
|
||||
@@ -168,12 +168,12 @@ pub(crate) fn checkpoint_from_frontier(
|
||||
if let std::option::Option::Some(checkpoint) = request.checkpoint() {
|
||||
return std::result::Result::Ok(checkpoint.clone());
|
||||
}
|
||||
return std::result::Result::Ok(BackfillCheckpoint::new(request.job_id().clone(), request.scope_fingerprint(), 0, std::option::Option::None));
|
||||
return std::result::Result::Ok(crate::BackfillCheckpoint::new(request.job_id().clone(), request.scope_fingerprint(), 0, std::option::Option::None));
|
||||
}
|
||||
let (completed_prefix, resume_before) = match request.scope().kind() {
|
||||
crate::BackfillScopeKind::LatestAddress => (local_prefix, std::option::Option::None),
|
||||
crate::BackfillScopeKind::BeforeAddress => {
|
||||
let previous = request.checkpoint().map_or(0, BackfillCheckpoint::completed_prefix);
|
||||
let previous = request.checkpoint().map_or(0, crate::BackfillCheckpoint::completed_prefix);
|
||||
let completed_prefix = match previous.checked_add(local_prefix) {
|
||||
std::option::Option::Some(value) => value,
|
||||
std::option::Option::None => return std::result::Result::Err(checkpoint_error("checkpoint.completed_prefix")),
|
||||
@@ -195,7 +195,7 @@ pub(crate) fn checkpoint_from_frontier(
|
||||
},
|
||||
crate::BackfillScopeKind::AfterAddress | crate::BackfillScopeKind::ExplicitSignatures => (local_prefix, std::option::Option::None),
|
||||
};
|
||||
return std::result::Result::Ok(BackfillCheckpoint::new(request.job_id().clone(), request.scope_fingerprint(), completed_prefix, resume_before));
|
||||
return std::result::Result::Ok(crate::BackfillCheckpoint::new(request.job_id().clone(), request.scope_fingerprint(), completed_prefix, resume_before));
|
||||
}
|
||||
|
||||
/// Validates that one discovery result belongs to the request network and semantic scope.
|
||||
|
||||
Reference in New Issue
Block a user