R2dbcDurableStateStore

akka.persistence.r2dbc.state.scaladsl.R2dbcDurableStateStore
See theR2dbcDurableStateStore companion object
class R2dbcDurableStateStore[A](system: ExtendedActorSystem, config: Config, cfgPath: String) extends DurableStateUpdateStore[A] with DurableStateStoreBySliceQuery[A] with DurableStateStorePagedPersistenceIdsQuery[A]

Attributes

Companion:
object
Graph
Supertypes
trait DurableStateStorePagedPersistenceIdsQuery[A]
trait DurableStateStoreBySliceQuery[A]
trait DurableStateUpdateStore[A]
trait DurableStateStore[A]
class Object
trait Matchable
class Any

Members list

Concise view

Value members

Concrete methods

override def changesBySlices(entityType: String, minSlice: Int, maxSlice: Int, offset: Offset): Source[DurableStateChange[A], NotUsed]

Get a source of the most recent changes made to objects of the given slice range since the passed in offset.

Get a source of the most recent changes made to objects of the given slice range since the passed in offset.

A slice is deterministically defined based on the persistence id. The purpose is to evenly distribute all persistence ids over the slices.

The returned source will never terminate, it effectively watches for changes to the objects and emits changes as they happen.

Not all changes that occur are guaranteed to be emitted, this call only guarantees that eventually, the most recent change for each object since the offset will be emitted. In particular, multiple updates to a given object in quick succession are likely to be skipped, with only the last update resulting in a change from this source.

The DurableStateChange elements can be akka.persistence.query.UpdatedDurableState or akka.persistence.query.DeletedDurableState.

Attributes

Definition Classes
DurableStateStoreBySliceQuery
override def currentChangesBySlices(entityType: String, minSlice: Int, maxSlice: Int, offset: Offset): Source[DurableStateChange[A], NotUsed]

Get a source of the most recent changes made to objects with the given slice range since the passed in offset.

Get a source of the most recent changes made to objects with the given slice range since the passed in offset.

A slice is deterministically defined based on the persistence id. The purpose is to evenly distribute all persistence ids over the slices.

Note that this only returns the most recent change to each object, if an object has been updated multiple times since the offset, only the most recent of those changes will be part of the stream.

This will return changes that occurred up to when the Source returned by this call is materialized. Changes to objects made since materialization are not guaranteed to be included in the results.

The DurableStateChange elements can be akka.persistence.query.UpdatedDurableState or akka.persistence.query.DeletedDurableState.

Attributes

Definition Classes
DurableStateStoreBySliceQuery
override def currentPersistenceIds(afterId: Option[String], limit: Long): Source[String, NotUsed]

Note: If you have configured custom-table this query will look in both the default table and the custom tables. If you are only interested in ids for a specific entity type it's more efficient to use currentPersistenceIds with entityType parameter.

Note: If you have configured custom-table this query will look in both the default table and the custom tables. If you are only interested in ids for a specific entity type it's more efficient to use currentPersistenceIds with entityType parameter.

Attributes

Definition Classes
DurableStateStorePagedPersistenceIdsQuery
def currentPersistenceIds(entityType: String, afterId: Option[String], limit: Long): Source[String, NotUsed]

Get the current persistence ids.

Get the current persistence ids.

Note: to reuse existing index, the actual query filters entity types based on persistence_id column and sql LIKE operator. Hence the persistenceId must start with an entity type followed by default separator ("|") from akka.persistence.typed.PersistenceId.

Attributes

afterId

The ID to start returning results from, or None to return all ids. This should be an id returned from a previous invocation of this command. Callers should not assume that ids are returned in sorted order.

entityType

The entity type name.

limit

The maximum results to return. Use Long.MaxValue to return all results. Must be greater than zero.

Returns:

A source containing all the persistence ids, limited as specified.

def currentPersistenceIds(): Source[String, NotUsed]
override def deleteObject(persistenceId: String, revision: Long): Future[Done]

Delete the value, which will fail with IllegalStateException if the existing stored revision + 1 isn't equal to the given revision. This optimistic locking check can be disabled with configuration assert-single-writer. The stored revision for the persistenceId is updated and next call to getObject will return the revision, but with no value.

Delete the value, which will fail with IllegalStateException if the existing stored revision + 1 isn't equal to the given revision. This optimistic locking check can be disabled with configuration assert-single-writer. The stored revision for the persistenceId is updated and next call to getObject will return the revision, but with no value.

If the given revision is 0 it will fully delete the value and revision from the database without any optimistic locking check. Next call to getObject will then return revision 0 and no value.

Attributes

Definition Classes
DurableStateUpdateStore
override def getObject(persistenceId: String): Future[GetObjectResult[A]]

Attributes

Definition Classes
DurableStateStore
override def sliceForPersistenceId(persistenceId: String): Int

Attributes

Definition Classes
DurableStateStoreBySliceQuery
override def sliceRanges(numberOfRanges: Int): Seq[Range]

Attributes

Definition Classes
DurableStateStoreBySliceQuery
override def upsertObject(persistenceId: String, revision: Long, value: A, tag: String): Future[Done]

Insert the value if revision is 1, which will fail with IllegalStateException if there is already a stored value for the given persistenceId. Otherwise update the value, which will fail with IllegalStateException if the existing stored revision + 1 isn't equal to the given revision. This optimistic locking check can be disabled with configuration assert-single-writer.

Insert the value if revision is 1, which will fail with IllegalStateException if there is already a stored value for the given persistenceId. Otherwise update the value, which will fail with IllegalStateException if the existing stored revision + 1 isn't equal to the given revision. This optimistic locking check can be disabled with configuration assert-single-writer.

Attributes

Definition Classes
DurableStateUpdateStore

Deprecated methods

override def deleteObject(persistenceId: String): Future[Done]

Attributes

Deprecated
[Since version 1.0.0] Use the deleteObject overload with revision instead.
Definition Classes
DurableStateUpdateStore