android-components / mozilla.components.service.glean.storages / StringsStorageEngineImplementation

StringsStorageEngineImplementation

open class StringsStorageEngineImplementation : GenericScalarStorageEngine<String> (source)

Constructors

<init>

StringsStorageEngineImplementation(logger: Logger = Logger("glean/StringsStorageEngine"))

Properties

logger

open val logger: Logger

Inherited Properties

applicationContext

open lateinit var applicationContext: Context

dataStores

val dataStores: Array<GenericStorageMap<ScalarType>>

userLifetimeStorage

val userLifetimeStorage: SharedPreferences

Functions

deserializeSingleMetric

open fun deserializeSingleMetric(value: Any?): String?

Implementor's provided function to convert deserialized 'user' lifetime data to the destination ScalarType.

record

fun record(stores: List<String>, category: String, name: String, lifetime: Lifetime, value: String): Unit

Record a string in the desired stores.

Inherited Functions

deserializeUserLifetime

open fun deserializeUserLifetime(): SharedPreferences

Deserialize the metrics with a lifetime = User that are on disk. This will be called the first time a metric is used or before a snapshot is taken.

getSnapshot

fun getSnapshot(storeName: String, clearStore: Boolean): GenericDataStorage<ScalarType>?

Retrieves the recorded metric data for the provided store name.

getSnapshotAsJSON

open fun getSnapshotAsJSON(storeName: String, clearStore: Boolean): Any?

Get a snapshot of the stored data as a JSON object.

recordScalar

fun recordScalar(stores: List<String>, category: String, name: String, lifetime: Lifetime, value: ScalarType): Unit

Helper function for the derived classes. It can be used to record simple scalars to the internal storage.

serializeSingleMetric

fun serializeSingleMetric(value: ScalarType): String?

Implementor's provided function to serialized 'user' lifetime data to String.