Skip to main content

Mirror

Struct Mirror 

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

A database kept current from replication, and the directory of its node file and reverse index.

Implementations§

Source§

impl Mirror

Source

pub fn new(url: impl Into<String>, dir: impl Into<PathBuf>) -> Self

A mirror in the database at url (postgresql://user@host/db, or host=… user=…), with its files in dir. Connections use TLS as its sslmode and sslrootcert ask, as the connections section says.

Source

pub fn import( &self, pbf: impl AsRef<Path>, replication: Option<&Replication>, opts: &ImportOpts, ) -> Result<ImportStats, SyncError>

Creates the osm schema from a PBF file, which must be sorted by type and ID as published files are, and makes the node file and the reverse index in the directory, replacing any there.

The file’s replication sequence is the one ImportOpts::sequence or its header gives. replication, the stream ImportOpts::replication_url or the header names, finds it from the file’s timestamp when neither does, as for a planet file, and checks a sequence given in the options against that timestamp when the header gives none for the stream.

Source

pub fn update( &self, replication: &Replication, opts: &UpdateOpts, ) -> Result<UpdateStats, SyncError>

open, then OpenMirror::update: the diffs of replication after the database’s sequence.

Source

pub fn open(&self) -> Result<OpenMirror, SyncError>

Connects to the database and opens the reverse index, checked against the database and brought up to it if a crash left it behind: an error if it is missing, or of another database or ahead of it, which rebuild fixes. The node file is opened by the first update, and stays open with the index until the mirror is dropped; only one process can have either open at a time.

Source

pub fn rebuild(&self, from: &Rebuild<'_>) -> Result<RebuildStats, SyncError>

Makes the node file and the reverse index again, up to the database’s revision. The database is only read.

Source

pub fn state(&self) -> Result<DbState, SyncError>

The database’s position in its replication stream.

Source

pub fn status(&self) -> Result<Status, SyncError>

The database’s position, and its files’ stamps.

Source

pub fn node_path(&self) -> PathBuf

The node file.

Source

pub fn index_path(&self) -> PathBuf

The reverse index.

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

Without the database’s URL, which may hold a password.

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for Mirror

§

impl Freeze for Mirror

§

impl Move for Mirror

§

impl RefUnwindSafe for Mirror

§

impl Send for Mirror

§

impl Sync for Mirror

§

impl Unpin for Mirror

§

impl UnsafeUnpin for Mirror

§

impl UnwindSafe for Mirror

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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