PersistenceStrategy - DataDog/dd-sdk-android GitHub Wiki
interface PersistenceStrategy
The main strategy used to persist data between the moment it's tracked and created, and the moment it's uploaded to the intake.
Types
Functions
currentMetadata
abstract fun currentMetadata(): ByteArray?
Return
the metadata of the current writeable batch
dropAll
abstract fun dropAll()
Drop all data.
lockAndReadNext
abstract fun lockAndReadNext(): PersistenceStrategy.Batch?
Reads the next batch of data and lock it so that it can't be read or written to by anyone.
migrateData
abstract fun migrateData(targetStrategy: PersistenceStrategy)
Migrate the data to a different PersistenceStrategy. All readable and ongoing batches must be transferred to the given strategy.
unlockAndDelete
abstract fun unlockAndDelete(batchId: String)
Marks the batch as unlocked and to be deleted. The corresponding batch should not be returned in any call to lockAndReadNext.
unlockAndKeep
abstract fun unlockAndKeep(batchId: String)
Marks the batch as unlocked and to be kept to be read again later.
write
abstract fun write(event: RawBatchEvent, batchMetadata: ByteArray?, eventType: EventType): Boolean
Writes the content of the event to the current available batch.
Return
true if event was written, false otherwise.
Parameters
event | the event to write (content + metadata) |
batchMetadata | the optional updated batch metadata |
eventType | additional information about the event that can impact the way it is stored. Note: events with the CRASH type are being sent as part of the Crash Reporting feature, and implies that the process will exit soon, meaning that those event must be kept synchronously and in a way to be retrieved after the app restarts in a new process (e.g.: on the file system, or in a local database). |