Skip to main content

Mirror

Struct Mirror 

Source
pub struct Mirror { /* private fields */ }

Implementations§

Source§

impl Mirror

Source

pub fn of(prj: &Prj) -> Result<Self>

The machine’s mirror, in $PRJ/.state.

Source

pub fn open(path: &Path) -> Result<Self>

The mirror in one file, created if it does not exist.

A file written by another version of this schema is refused: reading one optimistically is how a page comes to render half a board.

Source

pub fn path(&self) -> &Path

Source

pub fn state(&self, scope: &Scope) -> Result<SyncState>

Source

pub fn states(&self) -> Result<BTreeMap<String, SyncState>>

Every scope this mirror knows about.

Source

pub fn synced( &self, scope: &Scope, etag: Option<&str>, cursor: Option<&str>, ) -> Result<()>

Record a sync that worked.

Clears last_error: the scope is current, and a stale error beside current data is a page reporting a problem that is over.

Source

pub fn failed(&self, scope: &Scope, error: &str) -> Result<()>

Record an attempt that failed.

Leaves synced_at, the ETag and the cursor alone: the data this scope holds is still the data GitHub last gave it, and the next attempt should still be conditional.

Source

pub fn hold(&self, scope: &Scope) -> Result<()>

Put a scope in the sweep before it has ever been read.

What opening a comment thread does: a thread nobody has opened is not worth a request per sweep, and one somebody opened is. Recorded as a scope with no data and no attempt, which is exactly “not read yet”.

Source

pub fn forget(&self, scope: &Scope) -> Result<()>

Forget a scope entirely, data and state.

Source

pub fn forget_repository(&self, repo: &str) -> Result<usize>

Forget everything about one repository.

For a repository no project has any more: its issues, its pull requests, its releases and everything else go together, and a list of kinds to delete would be a list to keep in step with every kind added afterwards.

Source

pub fn put(&self, scope: &Scope, documents: &[Document]) -> Result<bool>

Write what a fetch returned, and say whether anything changed.

An AUTHORITATIVE scope replaces its contents: what the answer does not mention no longer exists. An incremental one only adds and updates, because its answer is “what changed”, and clearing on that empties the mirror every time nothing did.

Source

pub fn put_one(&self, scope: &Scope, document: Document) -> Result<bool>

Write one document — what a create or an edit produced.

Never prunes, whatever the scope: one document is not an answer about what exists.

Source

pub fn remove_one(&self, scope: &Scope, key: &str) -> Result<bool>

Take one document out of a scope — what a deletion on GitHub produced.

Source

pub fn put_project_write( &self, boards_scope: &Scope, board: Document, items_scope: &Scope, items: &[Document], ) -> Result<()>

Atomically store one changed board and the complete card set GitHub returned after that board changed.

A removed column changes both documents at once: the board loses an option and its cards lose that option’s values. Committing those in two transactions creates a state no GitHub answer ever had if the second write fails, so this is one database act.

Source

pub fn documents(&self, scope: &Scope) -> Result<Vec<Document>>

Everything one scope holds, newest movement first.

Source

pub fn payloads(&self, scope: &Scope) -> Result<Vec<Value>>

Just the payloads, which is what a reader serves.

Source

pub fn document(&self, scope: &Scope, key: &str) -> Result<Option<Document>>

One document, when the scope holds it.

Source

pub fn only(&self, scope: &Scope) -> Result<Option<Value>>

The single document of a scope that holds exactly one: a repository’s metadata, a commit’s checks, its traffic, the rate limit.

Source

pub fn put_only(&self, scope: &Scope, payload: Value) -> Result<bool>

Write the single document of such a scope.

Source

pub fn counts_by_state(&self, scope: &Scope) -> Result<BTreeMap<String, i64>>

How many documents of each state one scope holds.

Counted in SQL: an explorer asks this for every row it draws, and reading every payload to answer would make a redraw proportional to the whole mirror.

Source

pub fn open_counts(&self, kind: &str) -> Result<BTreeMap<String, i64>>

How many documents are open, per repository, across every scope of one kind (issues or pulls).

One query for a whole tree rather than one per row.

Source

pub fn latest_change(&self) -> Result<i64>

The newest change recorded, or 0 when nothing ever changed.

Source

pub fn changes_since(&self, since: i64) -> Result<Changes>

Which scopes changed after change since, written by whichever process.

Trait Implementations§

Source§

impl Clone for Mirror

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Mirror

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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