Skip to main content

Claimed

Struct Claimed 

Source
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

Source

pub fn is_empty(&self) -> bool

Source

pub fn then(self, later: Claimed) -> Claimed

This claim followed by later’s, read as one.

Source

pub fn records(&self) -> impl Iterator<Item = Result<String>> + Send + '_

The claimed records in order, one at a time.

Source

pub fn reader(&self) -> Reader<'_>

A reader that knows how far into the claim it is (see Reader).

Source

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.

Source

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.

Source

pub fn release(self)

Remove the claimed files: every record was dealt with.

Trait Implementations§

Source§

impl Default for Claimed

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more