DataLayer

interface DataLayer

The DataLayer is available to store key-value data that should be present on every event tracked through the Tealium SDK.

There are a variety of getter/setter methods to store/retrieve common data types. All methods operate on the Tealium thread.

For updating multiple entries at once, the transactionally method is available to use.

Properties

Link copied to clipboard

Returns a Subscribable object with which to receive notifications of DataLayer entries being removed.

Link copied to clipboard

Returns a Subscribable object with which to receive notifications of DataLayer entries being updated.

Functions

Link copied to clipboard
abstract fun clear(): Single<TealiumResult<Unit>>

Removes all entries from the DataLayer.

Link copied to clipboard
abstract fun get(key: String): Single<TealiumResult<DataItem?>>

Gets a single DataItem if available.

abstract fun <T> get(key: String, converter: DataItemConverter<T>): Single<TealiumResult<T?>>

Retrieves a value of type T at the given key using the provided converter to convert from a DataItem to an instance of T

Link copied to clipboard

Gets all entries in the DataLayer and returns them as a DataObject

Link copied to clipboard

Retrieves a Boolean value at the given key.

Link copied to clipboard

Retrieves a DataList value at the given key.

Link copied to clipboard

Retrieves a DataObject value at the given key.

Link copied to clipboard
abstract fun getDouble(key: String): Single<TealiumResult<Double?>>

Retrieves a Double value at the given key.

Link copied to clipboard
abstract fun getInt(key: String): Single<TealiumResult<Int?>>

Retrieves an Int value at the given key.

Link copied to clipboard
abstract fun getLong(key: String): Single<TealiumResult<Long?>>

Retrieves a Long value at the given key.

Link copied to clipboard
abstract fun getString(key: String): Single<TealiumResult<String?>>

Retrieves a String value at the given key.

Link copied to clipboard
abstract fun put(data: DataObject): Single<TealiumResult<Unit>>
abstract fun put(data: DataObject, expiry: Expiry): Single<TealiumResult<Unit>>

Attempts to update all key-value pairs from the data and inserts them into the DataStore.

abstract fun put(key: String, value: DataItem): Single<TealiumResult<Unit>>
abstract fun put(key: String, value: DataItem, expiry: Expiry): Single<TealiumResult<Unit>>

Puts a single key-value pair into the DataStore

abstract fun put(key: String, value: DataItemConvertible): Single<TealiumResult<Unit>>
abstract fun put(key: String, value: DataItemConvertible, expiry: Expiry): Single<TealiumResult<Unit>>

Stores a DataItemConvertible at the given key. The value will be eagerly converted to a DataItem on the caller thread.

abstract fun put(key: String, value: Boolean): Single<TealiumResult<Unit>>
abstract fun put(key: String, value: Boolean, expiry: Expiry): Single<TealiumResult<Unit>>

Stores a Boolean at the given key.

abstract fun put(key: String, value: Double): Single<TealiumResult<Unit>>
abstract fun put(key: String, value: Double, expiry: Expiry): Single<TealiumResult<Unit>>

Stores a Double at the given key.

abstract fun put(key: String, value: Int): Single<TealiumResult<Unit>>
abstract fun put(key: String, value: Int, expiry: Expiry): Single<TealiumResult<Unit>>

Stores an Int at the given key.

abstract fun put(key: String, value: Long): Single<TealiumResult<Unit>>
abstract fun put(key: String, value: Long, expiry: Expiry): Single<TealiumResult<Unit>>

Stores a Long at the given key.

abstract fun put(key: String, value: String): Single<TealiumResult<Unit>>
abstract fun put(key: String, value: String, expiry: Expiry): Single<TealiumResult<Unit>>

Stores a String at the given key.

Link copied to clipboard
abstract fun remove(key: String): Single<TealiumResult<Unit>>

Removes the entry from the DataLayer, identified by the given key

abstract fun remove(keys: List<String>): Single<TealiumResult<Unit>>

Removes all entries from the DataLayer, identified by the given keys

Link copied to clipboard

Allows editing of the DataLayer using a DataStore.Editor to enable more fine-grained control over key-value additions and removals.