import { Resource } from '@dxos/context'; export type PersistentLifecycleProps = { /** * Create connection. * If promise resolves successfully, connection is considered established. */ start: () => Promise; /** * Reset connection to initial state. */ stop: (state: T) => Promise; /** * Called after successful start. */ onRestart?: () => Promise; /** * Maximum delay between restartion attempts. * Default: 5000ms */ maxRestartDelay?: number; }; /** * Handles restarts (e.g. persists connection). * Restarts are scheduled with exponential backoff. */ export declare class PersistentLifecycle extends Resource { private readonly _start; private readonly _stop; private readonly _onRestart?; private readonly _maxRestartDelay; private _currentState; private _restartTask?; private _restartAfter; private _connectedAt; constructor({ start, stop, onRestart, maxRestartDelay }: PersistentLifecycleProps); get state(): T | undefined; protected _open(): Promise; protected _close(): Promise; private _restart; private _stopCurrentState; /** * Scheduling restart should be done from outside. */ scheduleRestart(): Promise; } //# sourceMappingURL=persistent-lifecycle.d.ts.map