android-components / mozilla.components.feature.session.bundling / SessionBundleStorage


class SessionBundleStorage : Storage (source)

A Session storage implementation that saves snapshots as a SessionBundle.


bundleLifetime - The lifetime of a bundle controls whether a bundle will be restored or whether this bundle is considered expired and a new bundle will be used.


Name Summary
<init> SessionBundleStorage(context: Context, engine: Engine, bundleLifetime: Pair<Long, TimeUnit>)
A Session storage implementation that saves snapshots as a SessionBundle.


Name Summary
autoClose fun autoClose(sessionManager: SessionManager): Unit
Automatically clears the current bundle and starts a new bundle if the lifetime has expired while the app was in the background.
autoSave fun autoSave(sessionManager: SessionManager, interval: Long = AutoSave.DEFAULT_INTERVAL_MILLISECONDS, unit: TimeUnit = TimeUnit.MILLISECONDS): AutoSave
Starts configuring automatic saving of the state.
bundles fun bundles(since: Long = 0, limit: Int = 20): LiveData<List<SessionBundle>>
Returns the last saved SessionBundle instances (up to limit) as a LiveData list.
bundlesPaged fun bundlesPaged(since: Long = 0): Factory<Int, SessionBundle>
Returns all saved SessionBundle instances as a DataSource.Factory.
current fun current(): SessionBundle?
Returns the currently used SessionBundle for saving SessionManager.Snapshot instances. Or null if no bundle is in use currently.
new fun new(): Unit
Clear the currently used, active SessionBundle and use a new one the next time a SessionManager.Snapshot is saved.
remove fun remove(bundle: SessionBundle): Unit
Removes the given SessionBundle permanently. If this is the active bundle then a new one will be created the next time a SessionManager.Snapshot is saved.
removeAll fun removeAll(): Unit
Removes all saved SessionBundle instances permanently.
restore fun restore(): SessionBundle?
Restores the last SessionBundle if there is one without expired lifetime.
save fun save(snapshot: Snapshot): Boolean
Saves the SessionManager.Snapshot as a bundle. If a bundle was restored previously then this bundle will be updated with the data from the snapshot. If no bundle was restored a new bundle will be created.
use fun use(bundle: SessionBundle): Unit
Explicitly uses the given SessionBundle (even if not active) to save SessionManager.Snapshot instances to.