android-components / mozilla.components.browser.session.storage / SessionStorage

SessionStorage

interface SessionStorage (source)

Storage component for browser and engine sessions.

Functions

clear

abstract fun clear(engine: Engine): Unit

Erases persisted SessionsSnapshot (if present) for a given Engine.

persist

abstract fun persist(engine: Engine, snapshot: SessionsSnapshot): Boolean

Persists the provided SessionsSnapshot for a given Engine. SessionsSnapshot may be obtained using SessionManager.createSnapshot. Throws if snapshot is empty or otherwise incoherent.

read

abstract fun read(engine: Engine): SessionsSnapshot?

Returns the latest persisted sessions snapshot that may be used to read sessions. Resulting SessionsSnapshot may be restored via SessionManager.restore.

start

abstract fun start(sessionManager: SessionManager): Unit

Starts persisting the state frequently and automatically.

stop

abstract fun stop(): Unit

Stops persisting the state automatically.

Inheritors

DefaultSessionStorage

class DefaultSessionStorage : SessionStorage

Default implementation of SessionStorage which persists browser and engine session states to a JSON file.