pub struct BackupProvider {
_endpoint: Endpoint,
node_addr: NodeAddr,
auth_token: String,
handle: JoinHandle<Result<()>>,
_drop_guard: DropGuard,
}
Expand description
Provide or send a backup of this device.
This creates a backup of the current device and starts a service which offers another device to download this backup.
This does not make a full backup on disk, only the SQLite database is created on disk, the blobs in the blob directory are not copied.
This starts a task which acquires the global “ongoing” mutex. If you need to stop the
task use the Context::stop_ongoing
mechanism.
Fields§
§_endpoint: Endpoint
iroh-net endpoint.
node_addr: NodeAddr
iroh-net address.
auth_token: String
Authentication token that should be submitted to retrieve the backup.
handle: JoinHandle<Result<()>>
Handle for the task accepting backup transfer requests.
_drop_guard: DropGuard
Guard to cancel the provider on drop.
Implementations§
source§impl BackupProvider
impl BackupProvider
sourcepub async fn prepare(context: &Context) -> Result<Self>
pub async fn prepare(context: &Context) -> Result<Self>
Prepares for sending a backup to a second device.
Before calling this function all I/O must be stopped so that no changes to the blobs
or database are happening, this is done by calling the Accounts::stop_io
or
Context::stop_io
APIs first.
This will acquire the global “ongoing process” mutex, which can be used to cancel the process.
async fn handle_connection( context: Context, conn: Connecting, auth_token: String, dbfile: Arc<TempPathGuard>, ) -> Result<()>
async fn accept_loop( context: Context, endpoint: Endpoint, auth_token: String, cancel_token: Receiver<()>, drop_token: CancellationToken, dbfile: TempPathGuard, )
sourcepub fn qr(&self) -> Qr
pub fn qr(&self) -> Qr
Returns a QR code that allows fetching this backup.
This QR code can be passed to get_backup
on a (different) device.
Trait Implementations§
source§impl Debug for BackupProvider
impl Debug for BackupProvider
Auto Trait Implementations§
impl Freeze for BackupProvider
impl !RefUnwindSafe for BackupProvider
impl Send for BackupProvider
impl Sync for BackupProvider
impl Unpin for BackupProvider
impl !UnwindSafe for BackupProvider
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<F> FutureExt for F
impl<F> FutureExt for F
§fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
§impl<F> FutureExt for Fwhere
F: Future,
impl<F> FutureExt for Fwhere
F: Future,
§fn timeout_at<T>(self, target: T) -> TimeoutAt<Self>
fn timeout_at<T>(self, target: T) -> TimeoutAt<Self>
§impl<F> FutureExt for F
impl<F> FutureExt for F
§fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
§impl<F1> FutureExt for F1where
F1: Future,
impl<F1> FutureExt for F1where
F1: Future,
§fn join<F2>(self, other: F2) -> Join2<F1, <F2 as IntoFuture>::IntoFuture>where
F1: Future,
F2: IntoFuture,
fn join<F2>(self, other: F2) -> Join2<F1, <F2 as IntoFuture>::IntoFuture>where
F1: Future,
F2: IntoFuture,
§fn race<T, S2>(self, other: S2) -> Race2<T, F1, <S2 as IntoFuture>::IntoFuture>where
F1: Future<Output = T>,
S2: IntoFuture<Output = T>,
fn race<T, S2>(self, other: S2) -> Race2<T, F1, <S2 as IntoFuture>::IntoFuture>where
F1: Future<Output = T>,
S2: IntoFuture<Output = T>,
§fn wait_until<D>(
self,
deadline: D,
) -> WaitUntil<Self, <D as IntoFuture>::IntoFuture>where
Self: Sized,
D: IntoFuture,
fn wait_until<D>(
self,
deadline: D,
) -> WaitUntil<Self, <D as IntoFuture>::IntoFuture>where
Self: Sized,
D: IntoFuture,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn map<U, F>(self, f: F) -> Map<Self, F>
fn map<U, F>(self, f: F) -> Map<Self, F>
§fn map_into<U>(self) -> MapInto<Self, U>
fn map_into<U>(self) -> MapInto<Self, U>
§fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
f
. Read more§fn left_future<B>(self) -> Either<Self, B>
fn left_future<B>(self) -> Either<Self, B>
§fn right_future<A>(self) -> Either<A, Self>
fn right_future<A>(self) -> Either<A, Self>
§fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
§fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
§fn flatten_stream(self) -> FlattenStream<Self>
fn flatten_stream(self) -> FlattenStream<Self>
§fn fuse(self) -> Fuse<Self>where
Self: Sized,
fn fuse(self) -> Fuse<Self>where
Self: Sized,
poll
will never again be called once it has
completed. This method can be used to turn any Future
into a
FusedFuture
. Read more§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
§fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
§fn remote_handle(self) -> (Remote<Self>, RemoteHandle<Self::Output>)where
Self: Sized,
fn remote_handle(self) -> (Remote<Self>, RemoteHandle<Self::Output>)where
Self: Sized,
()
on completion and sends
its output to another future on a separate task. Read more§fn boxed<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a>>
fn boxed<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a>>
§fn boxed_local<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a>>where
Self: Sized + 'a,
fn boxed_local<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a>>where
Self: Sized + 'a,
§fn unit_error(self) -> UnitError<Self>where
Self: Sized,
fn unit_error(self) -> UnitError<Self>where
Self: Sized,
Future<Output = T>
into a
TryFuture<Ok = T, Error = ()
>.§fn never_error(self) -> NeverError<Self>where
Self: Sized,
fn never_error(self) -> NeverError<Self>where
Self: Sized,
Future<Output = T>
into a
TryFuture<Ok = T, Error = Never
>.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
source§type IntoFuture = F
type IntoFuture = F
source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
§impl<F, T, E> TryFuture for F
impl<F, T, E> TryFuture for F
§impl<T, E, F> TryFuture for F
impl<T, E, F> TryFuture for F
§impl<Fut> TryFutureExt for Futwhere
Fut: TryFuture + ?Sized,
impl<Fut> TryFutureExt for Futwhere
Fut: TryFuture + ?Sized,
§fn flatten_sink<Item>(self) -> FlattenSink<Self, Self::Ok>where
Self::Ok: Sink<Item, Error = Self::Error>,
Self: Sized,
fn flatten_sink<Item>(self) -> FlattenSink<Self, Self::Ok>where
Self::Ok: Sink<Item, Error = Self::Error>,
Self: Sized,
Sink
]. Read more