pub struct Claimed { /* private fields */ }Expand description
A queue taken out of its place to be read: the file is renamed, so a hook
that queues meanwhile starts a new one, and what the reader does not send
it appends there. The claimed files are removed by Claimed::release; a
reader that dies first leaves them to be taken over (after
[ABANDONED_AFTER]) instead of losing what it held in memory.
Implementations§
Source§impl Claimed
impl Claimed
pub fn is_empty(&self) -> bool
Sourcepub fn records(&self) -> impl Iterator<Item = Result<String>> + Send + '_
pub fn records(&self) -> impl Iterator<Item = Result<String>> + Send + '_
The claimed records in order, one at a time.
Sourcepub fn reader(&self) -> Reader<'_>
pub fn reader(&self) -> Reader<'_>
A reader that knows how far into the claim it is (see Reader).
Sourcepub fn retarget(self, pending_path: &Path) -> Result<Claimed>
pub fn retarget(self, pending_path: &Path) -> Result<Claimed>
The same claim, as one on the queue at pending_path: files claimed
from another queue are renamed to claims on this one, in order. For a
queue that is adopted (a repo switch): from here on its records are
sent as this queue’s, and whoever takes the claim over after its
reader died must send them there too, not to the target they were
queued for.
Sourcepub fn finish(self, rest: Option<Position>, pending_path: &Path) -> Result<()>
pub fn finish(self, rest: Option<Position>, pending_path: &Path) -> Result<()>
Give the claim up. With rest (where a Reader stopped) the
records from there on stay queued, in order and ahead of anything
queued since; without it every record was dealt with and nothing
stays.
The rest is not copied back into the queue: each file is left as a claim that counts as abandoned at once, cut down to what was not read by replacing it in one step. A reader that dies anywhere in this leaves every record in exactly one file, so recovery neither loses nor repeats one. When nothing else was queued meanwhile, the one file left takes the queue’s own name again.