Implement replay-safe authorized public HTTP API
This commit is contained in:
parent
791e00f4c0
commit
4c93c25692
1 changed files with 3940 additions and 345 deletions
|
|
@ -16,8 +16,8 @@ use time::OffsetDateTime;
|
|||
use crate::{
|
||||
ActivationMutationOutcome, ActivationOutcome, AttemptAuthority, AttemptError,
|
||||
AttemptFaultInjector, AttemptFaultPoint, AttemptState, CheckpointProjection, ClaimOutcome,
|
||||
ClaimRejection, ExecutionEnvelopeRecord, LeaseProjection, RecoveryOutcome,
|
||||
RenewalMutationOutcome, RenewalOutcome,
|
||||
ClaimRejection, ExecutionEnvelopeRecord, LeaseProjection, ProgressRecord, ProgressSnapshot,
|
||||
RecoveryOutcome, RenewalMutationOutcome, RenewalOutcome,
|
||||
};
|
||||
|
||||
struct NoFaults;
|
||||
|
|
@ -87,6 +87,27 @@ impl AttemptService {
|
|||
})
|
||||
}
|
||||
|
||||
pub async fn progress_snapshot(
|
||||
&self,
|
||||
job_id: &OpaqueId,
|
||||
) -> Result<Option<ProgressSnapshot>, AttemptError> {
|
||||
let Some(hint) = self.coordination.get_progress(job_id.as_str()).await? else {
|
||||
return Ok(None);
|
||||
};
|
||||
Ok(Some(ProgressSnapshot {
|
||||
attempt_id: OpaqueId::parse(hint.attempt_id)
|
||||
.map_err(|error| AttemptError::Invalid(error.to_string()))?,
|
||||
fence: hint.fence,
|
||||
progress: ProgressRecord {
|
||||
completed_bytes: hint.bytes,
|
||||
total_bytes: hint.total_bytes,
|
||||
completed_members: hint.completed_members,
|
||||
total_members: hint.total_members,
|
||||
},
|
||||
observed_at: OffsetDateTime::now_utc(),
|
||||
}))
|
||||
}
|
||||
|
||||
pub async fn claim(
|
||||
&self,
|
||||
job_id: &OpaqueId,
|
||||
|
|
|
|||
Loading…
Reference in a new issue