pub struct AnnotationQueue { /* private fields */ }Expand description
A named, versioned collection of annotation tasks.
Implementations§
Source§impl AnnotationQueue
impl AnnotationQueue
Sourcepub fn tasks(&self) -> &BTreeMap<String, AnnotationTask>
pub fn tasks(&self) -> &BTreeMap<String, AnnotationTask>
All tasks in stable id order.
Sourcepub fn task(&self, task_id: &str) -> Option<&AnnotationTask>
pub fn task(&self, task_id: &str) -> Option<&AnnotationTask>
Find a task by id.
Sourcepub fn enqueue(&mut self, task: AnnotationTask) -> Result<()>
pub fn enqueue(&mut self, task: AnnotationTask) -> Result<()>
Add a validated task without overwriting an existing id.
Sourcepub fn claim(
&mut self,
reviewer: impl Into<String>,
now_ms: u64,
lease_ms: u64,
) -> Result<Option<ReviewLease>>
pub fn claim( &mut self, reviewer: impl Into<String>, now_ms: u64, lease_ms: u64, ) -> Result<Option<ReviewLease>>
Claim the highest-priority eligible task.
Ordering is deterministic: priority descending, creation time ascending, then task id ascending. Calling claim again while the same reviewer owns a live lease returns that lease idempotently.
Sourcepub fn submit(
&mut self,
lease: &ReviewLease,
now_ms: u64,
submission: ReviewSubmission,
) -> Result<AnnotationStatus>
pub fn submit( &mut self, lease: &ReviewLease, now_ms: u64, submission: ReviewSubmission, ) -> Result<AnnotationStatus>
Submit a review under a live lease.
Sourcepub fn adjudicate(
&mut self,
task_id: &str,
adjudicator: impl Into<String>,
now_ms: u64,
decision: ReviewDecision,
) -> Result<()>
pub fn adjudicate( &mut self, task_id: &str, adjudicator: impl Into<String>, now_ms: u64, decision: ReviewDecision, ) -> Result<()>
Resolve a disagreement after all required reviews have arrived.
Trait Implementations§
Source§impl Clone for AnnotationQueue
impl Clone for AnnotationQueue
Source§impl Debug for AnnotationQueue
impl Debug for AnnotationQueue
Source§impl PartialEq for AnnotationQueue
impl PartialEq for AnnotationQueue
Source§impl Serialize for AnnotationQueue
impl Serialize for AnnotationQueue
impl StructuralPartialEq for AnnotationQueue
Auto Trait Implementations§
impl Freeze for AnnotationQueue
impl RefUnwindSafe for AnnotationQueue
impl Send for AnnotationQueue
impl Sync for AnnotationQueue
impl Unpin for AnnotationQueue
impl UnsafeUnpin for AnnotationQueue
impl UnwindSafe for AnnotationQueue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more