-
public interface PersistenceStrategyThe main strategy used to persist data between the moment it's tracked and created, and the moment it's uploaded to the intake.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfacePersistenceStrategy.FactoryA factory used to create an instance of a PersistenceStrategy.
Each instance of a persistence strategy should have independent storage. Data written to one instance must not be readable from another one.
public final classPersistenceStrategy.BatchDescribes the content of event batch.
-
Method Summary
Modifier and Type Method Description abstract ByteArraycurrentMetadata()abstract Booleanwrite(RawBatchEvent event, ByteArray batchMetadata, EventType eventType)Writes the content of the event to the current available batch. abstract PersistenceStrategy.BatchlockAndReadNext()Reads the next batch of data and lock it so that it can't be read or written to by anyone. abstract UnitunlockAndKeep(String batchId)Marks the batch as unlocked and to be kept to be read again later. abstract UnitunlockAndDelete(String batchId)Marks the batch as unlocked and to be deleted. abstract UnitdropAll()Drop all data. abstract UnitmigrateData(PersistenceStrategy targetStrategy)Migrate the data to a different PersistenceStrategy. -
-
Method Detail
-
currentMetadata
@WorkerThread() abstract ByteArray currentMetadata()
-
write
@WorkerThread() abstract Boolean write(RawBatchEvent event, ByteArray batchMetadata, EventType eventType)
Writes the content of the event to the current available batch.
- Parameters:
event- the event to write (content + metadata)batchMetadata- the optional updated batch metadataeventType- additional information about the event that can impact the way it is stored.
-
lockAndReadNext
@WorkerThread() abstract PersistenceStrategy.Batch lockAndReadNext()
Reads the next batch of data and lock it so that it can't be read or written to by anyone.
-
unlockAndKeep
@WorkerThread() abstract Unit unlockAndKeep(String batchId)
Marks the batch as unlocked and to be kept to be read again later.
-
unlockAndDelete
@WorkerThread() abstract Unit unlockAndDelete(String batchId)
Marks the batch as unlocked and to be deleted. The corresponding batch should not be returned in any call to lockAndReadNext.
-
dropAll
@WorkerThread() abstract Unit dropAll()
Drop all data.
-
migrateData
abstract Unit migrateData(PersistenceStrategy targetStrategy)
Migrate the data to a different PersistenceStrategy. All readable and ongoing batches must be transferred to the given strategy.
-
-
-
-