Packages

final class Cleanup extends AnyRef

Tool for deleting all events and/or snapshots for a given list of persistenceIds without using persistent actors. It's important that the actors with corresponding persistenceId are not running at the same time as using the tool.

If neverUsePersistenceIdAgain is true then the highest used sequence number is deleted and the persistenceId should not be used again, since it would be confusing to reuse the same sequence numbers for new events.

When a list of persistenceIds are given they are deleted sequentially in the order of the list. It's possible to parallelize the deletes by running several cleanup operations at the same time operating on different sets of persistenceIds.

Annotations
@ApiMayChange()
Source
Cleanup.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Cleanup
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Cleanup(systemProvider: ClassicActorSystemProvider)
  2. new Cleanup(systemProvider: ClassicActorSystemProvider, settings: CleanupSettings)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def cleanupBeforeSnapshot(persistenceIds: Seq[String], nrSnapshotsToKeep: Int, keepAfter: Long): Future[Done]

    Requires Cassandra 3+

    Requires Cassandra 3+

    See single persistenceId overload for what is done for each persistence id

  6. def cleanupBeforeSnapshot(persistenceIds: Seq[String], nrSnapshotsToKeep: Int): Future[Done]

    Requires Cassandra 3+

    Requires Cassandra 3+

    See single persistenceId overload for what is done for each persistence id

  7. def cleanupBeforeSnapshot(persistenceId: String, nrSnapshotsToKeep: Int, keepAfter: Long): Future[Done]

    Requires Cassandra 3+

    Requires Cassandra 3+

    Deletes all events for the given persistence id from before the first after keepAfter. If there are not enough snapshots to satisfy nrSnapshotsToKeep then snapshots before keepAfter will also be kept.

    WARNING: deleting events is generally discouraged in event sourced systems. once deleted the event by tag view can not be re-built

  8. def cleanupBeforeSnapshot(persistenceId: String, nrSnapshotsToKeep: Int): Future[Done]

    Requires Cassandra 3+

    Requires Cassandra 3+

    Deletes all but the last N snapshots and deletes all events before this snapshot Does not delete from the tag_views table

    WARNING: deleting events is generally discouraged in event sourced systems. once deleted the event by tag view can not be re-built

  9. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  10. def deleteAll(persistenceId: String, neverUsePersistenceIdAgain: Boolean): Future[Done]

    Delete everything related to one single persistenceId.

    Delete everything related to one single persistenceId. All events, tagged events, and snapshots are deleted.

  11. def deleteAll(persistenceIds: Seq[String], neverUsePersistenceIdAgain: Boolean): Future[Done]

    Delete everything related to the given list of persistenceIds.

    Delete everything related to the given list of persistenceIds. All events, tagged events, and snapshots are deleted.

  12. def deleteAllEvents(persistenceId: String, neverUsePersistenceIdAgain: Boolean): Future[Done]

    Delete all events related to one single persistenceId.

    Delete all events related to one single persistenceId. Snapshots are not deleted.

  13. def deleteAllEvents(persistenceIds: Seq[String], neverUsePersistenceIdAgain: Boolean): Future[Done]

    Delete all events related to the given list of persistenceIds.

    Delete all events related to the given list of persistenceIds. Snapshots are not deleted.

  14. def deleteAllSnapshots(persistenceId: String): Future[Done]

    Delete all snapshots related to one single persistenceId.

    Delete all snapshots related to one single persistenceId. Events are not deleted.

  15. def deleteAllSnapshots(persistenceIds: Seq[String]): Future[Done]

    Delete all snapshots related to the given list of persistenceIds.

    Delete all snapshots related to the given list of persistenceIds. Events are not deleted.

  16. def deleteAllTaggedEvents(persistenceId: String): Future[Done]

    Delete all events from tag_views table related to to one single persistenceId.

    Delete all events from tag_views table related to to one single persistenceId. Events in messages (journal) table are not deleted and snapshots are not deleted.

  17. def deleteAllTaggedEvents(persistenceIds: Seq[String]): Future[Done]

    Delete all events from tag_views table related to the given list of persistenceIds.

    Delete all events from tag_views table related to the given list of persistenceIds. Events in messages (journal) table are not deleted and snapshots are not deleted.

  18. def deleteBeforeSnapshot(persistenceId: String, maxSnapshotsToKeep: Int): Future[Option[SnapshotMetadata]]

    Requires Cassandra 3+

    Requires Cassandra 3+

    Keep N snapshots and delete all older snapshots along.

    This operation is much cheaper than including the timestamp because it can use the primary key and limit.

    returns

    the snapshot meta of the oldest remaining snapshot. None if there are no snapshots. This can be used to delete events from before the snapshot.

  19. def deleteBeforeSnapshot(persistenceId: String, snapshotsToKeep: Int, keepAfterUnixTimestamp: Long): Future[Option[SnapshotMetadata]]

    Requires Cassandra 3+

    Requires Cassandra 3+

    Keep all snapshots that occurred after keepAfter. If fewer than snapshotsToKeep occurred after keepAfter at least that many are kept. Setting this to 1 ensures that at least snapshot is kept even if it is older than the keepAfter

    If only N number of snapshot should be kept prefer overload without timestamp as it is more efficient.

    The returned snapshot metadata can be used to issue deletes for events older than the oldest snapshot.

    returns

    the snapshot meta of the oldest remaining snapshot. None if there are no snapshots

  20. def deleteEventsTo(persistenceId: String, toSequenceNr: Long): Future[Done]

    Requires Cassandra 3+

    Requires Cassandra 3+

    Delete all events before a sequenceNr for the given persistence id.

    WARNING: deleting events is generally discouraged in event sourced systems. once deleted the event by tag view can not be re-built

    persistenceId

    the persistence id to delete for

    toSequenceNr

    sequence nr (inclusive) to delete up to

  21. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  22. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  23. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  24. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  25. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  26. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  27. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  28. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  29. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  30. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  31. def toString(): String
    Definition Classes
    AnyRef → Any
  32. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  33. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  34. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped