StorageTable

interface StorageTable

A storage unit that holds a collection of items. An item is a ByteString indexed by a unique key.

BaseStorageTable has two optional features: partitioning and expiration.

When the table is partitioned, each item is actually indexed by a key pair (partitionId, key). Keys are unique only within a particular partition.

When item expiration is enabled, each item can be given optional expiration time. An item is (conceptually) silently and automatically deleted once clock time goes past expiration time (in other words, an item still exists at exactly the expiration time).

Inheritors

Properties

Link copied to clipboard
abstract val storage: Storage

The Storage the table belongs to.

Functions

Link copied to clipboard
abstract suspend fun delete(key: String, partitionId: String? = null): Boolean

Deletes data.

Link copied to clipboard
abstract suspend fun deleteAll()

Deletes all data previously stored in this table.

Link copied to clipboard
abstract suspend fun deletePartition(partitionId: String)

Deletes all data previously stored in this the given partition.

Link copied to clipboard
abstract suspend fun enumerate(partitionId: String? = null, afterKey: String? = null, limit: Int = Int.MAX_VALUE): List<String>

Enumerate keys of the records with given table and partitionId in key lexicographic order.

Link copied to clipboard
abstract suspend fun enumerateWithData(partitionId: String? = null, afterKey: String? = null, limit: Int = Int.MAX_VALUE): List<Pair<String, ByteString>>

Enumerate the records with given table and partitionId in key lexicographic order.

Link copied to clipboard
abstract suspend fun get(key: String, partitionId: String? = null): ByteString?

Gets data.

Link copied to clipboard
abstract suspend fun insert(key: String?, data: ByteString, partitionId: String? = null, expiration: Instant = Instant.DISTANT_FUTURE): String

Stores new data.

Link copied to clipboard
abstract suspend fun update(key: String, data: ByteString, partitionId: String? = null, expiration: Instant? = null)

Updates data that is already stored in the engine.