insert

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

Stores new data.

The data can later be retrieved using StorageTable.get.

  • key the key used to identify the data. If null, and new unique key will be generated. if not null, the key (or (partitionId,key) pair if partitioning is enabled) must be unique and KeyExistsStorageException is thrown if the key (or (partitionId,key) pair) already exists in the table.

  • partitionId secondary key. If partitioning is supported (see StorageTableSpec.supportExpiration), it must be non-null. If partitioning is not supported it must be null.

  • expiration if expiration is not supported (see StorageTableSpec), this must be Instant.DISTANT_FUTURE which is default value. If expiration is supported this should be last moment of time when the newly-created record still exists. Expired records are not accessible using Storage APIs, and the storage they occupy can be reclaimed at any moment.

  • data the data to store.

Returns the key for the newly-inserted record. Generated keys only contain letters, digits, and characters '_' and '-' (base64url character set). This restriction does not apply to the user-provided keys.