pub fn new(db: Arc<Db>) -> Self {
        let db = ArcDb::new(db);
        let shutdown = CancellationToken::new();

        let policy = LifecyclePolicy::new_suppress_persistence(db);

        let state = Arc::new(WorkerState {
            policy: Mutex::new(policy),
            shutdown,
        });

        let join = tokio::spawn(background_worker(Arc::clone(&state)))
            .map_err(Arc::new)
            .boxed()
            .shared();

        Self { join, state }
    }
/// Creates a new `LifecycleWorker`
///
/// The worker starts with persistence suppressed, persistence must be enabled
/// by a call to [`LifecycleWorker::unsuppress_persistence`]
Creates a new `LifecycleWorker`
The worker starts with persistence suppressed, persistence must be enabled
by a call to [`LifecycleWorker::unsuppress_persistence`]
Creates a new ` LifecycleWorker ` The worker starts with persistence suppressed persistence must be enabled by a call to [ ` LifecycleWorker :: unsuppress_persistence ` ]
pub fn new(db: Arc<Db>) -> Self {
        let db = ArcDb::new(db);
        let shutdown = CancellationToken::new();
        let policy = LifecyclePolicy::new_suppress_persistence(db);
        let state = Arc::new(WorkerState {
            policy: Mutex::new(policy),
            shutdown,
        });
        let join = tokio::spawn(background_worker(Arc::clone(&state)))
            .map_err(Arc::new)
            .boxed()
            .shared();
        Self { join, state }
    }
pub fn new ( db : Arc < Db > ) -> Self { let db = ArcDb :: new ( db ) ; let shutdown = CancellationToken :: new ( ) ; let policy = LifecyclePolicy :: new_suppress_persistence ( db ) ; let state = Arc :: new ( WorkerState { policy : Mutex :: new ( policy ) , shutdown , } ) ; let join = tokio :: spawn ( background_worker ( Arc :: clone ( & state ) ) ) . map_err ( Arc :: new ) . boxed ( ) . shared ( ) ; Self { join , state } }
Creates a new `LifecycleWorker`
The worker starts with persistence suppressed, persistence must be enabled
by a call to [`LifecycleWorker::unsuppress_persistence`]
Creates a new ` LifecycleWorker ` The worker starts with persistence suppressed persistence must be enabled by a call to [ ` LifecycleWorker :: unsuppress_persistence ` ]
db
Arc<Db>
db
Arc<Db>