[−][src]Struct rusqlite::backup::Backup
feature = "backup"
A handle to an online backup.
Implementations
impl<'_, '_> Backup<'_, '_>
[src]
pub fn new<'a, 'b>(
from: &'a Connection,
to: &'b mut Connection
) -> Result<Backup<'a, 'b>>
[src]
from: &'a Connection,
to: &'b mut Connection
) -> Result<Backup<'a, 'b>>
Attempt to create a new handle that will allow backups from from
to
to
. Note that to
is a &mut
- this is because SQLite forbids any
API calls on the destination of a backup while the backup is taking
place.
Failure
Will return Err
if the underlying sqlite3_backup_init
call returns
NULL
.
pub fn new_with_names<'a, 'b>(
from: &'a Connection,
from_name: DatabaseName<'_>,
to: &'b mut Connection,
to_name: DatabaseName<'_>
) -> Result<Backup<'a, 'b>>
[src]
from: &'a Connection,
from_name: DatabaseName<'_>,
to: &'b mut Connection,
to_name: DatabaseName<'_>
) -> Result<Backup<'a, 'b>>
Attempt to create a new handle that will allow backups from the
from_name
database of from
to the to_name
database of to
. Note
that to
is a &mut
- this is because SQLite forbids any API calls on
the destination of a backup while the backup is taking place.
Failure
Will return Err
if the underlying sqlite3_backup_init
call returns
NULL
.
pub fn progress(&self) -> Progress
[src]
Gets the progress of the backup as of the last call to step
.
pub fn step(&self, num_pages: c_int) -> Result<StepResult>
[src]
Attempts to back up the given number of pages. If num_pages
is
negative, will attempt to back up all remaining pages. This will hold a
lock on the source database for the duration, so it is probably not
what you want for databases that are currently active (see
run_to_completion
for a better alternative).
Failure
Will return Err
if the underlying sqlite3_backup_step
call returns
an error code other than DONE
, OK
, BUSY
, or LOCKED
. BUSY
and
LOCKED
are transient errors and are therefore returned as possible
Ok
values.
pub fn run_to_completion(
&self,
pages_per_step: c_int,
pause_between_pages: Duration,
progress: Option<fn(_: Progress)>
) -> Result<()>
[src]
&self,
pages_per_step: c_int,
pause_between_pages: Duration,
progress: Option<fn(_: Progress)>
) -> Result<()>
Attempts to run the entire backup. Will call step(pages_per_step)
as
many times as necessary, sleeping for pause_between_pages
between
each call to give the source database time to process any pending
queries. This is a direct implementation of "Example 2: Online Backup
of a Running Database" from SQLite's Online Backup API
documentation.
If progress
is not None
, it will be called after each step with the
current progress of the backup. Note that is possible the progress may
not change if the step returns Busy
or Locked
even though the
backup is still running.
Failure
Will return Err
if any of the calls to step
return Err
.
Trait Implementations
Auto Trait Implementations
impl<'a, 'b> !RefUnwindSafe for Backup<'a, 'b>
impl<'a, 'b> !Send for Backup<'a, 'b>
impl<'a, 'b> !Sync for Backup<'a, 'b>
impl<'a, 'b> Unpin for Backup<'a, 'b>
impl<'a, 'b> !UnwindSafe for Backup<'a, 'b>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,