Merge pull request #1838 from krasserm/wip-3717-deletion-api-krasserm

!per #3717 Deletion API for snapshots and persistent messages
This commit is contained in:
Patrik Nordwall 2013-11-21 00:54:44 -08:00
commit 524addd404
32 changed files with 352 additions and 118 deletions

View file

@ -101,7 +101,7 @@ public class PersistenceDocTest {
@Override
public void preRestart(Throwable reason, Option<Object> message) {
if (message.isDefined() && message.get() instanceof Persistent) {
deleteMessage((Persistent) message.get());
deleteMessage(((Persistent) message.get()).sequenceNr());
}
super.preRestart(reason, message);
}

View file

@ -32,6 +32,10 @@ public class PersistencePluginDocTest {
@Override
public void doDelete(SnapshotMetadata metadata) throws Exception {
}
@Override
public void doDelete(String processorId, SnapshotSelectionCriteria criteria) throws Exception {
}
}
class MyAsyncJournal extends AsyncWriteJournal {
@ -51,7 +55,7 @@ public class PersistencePluginDocTest {
}
@Override
public Future<Void> doDeleteAsync(String processorId, long sequenceNr, boolean physical) {
public Future<Void> doDeleteAsync(String processorId, long fromSequenceNr, long toSequenceNr, boolean permanent) {
return null;
}

View file

@ -143,11 +143,12 @@ a replay of that message during recovery it can be deleted.
Message deletion
----------------
A processor can delete messages by calling the ``delete`` method with a ``Persistent`` message object or a
sequence number as argument. An optional ``physical`` parameter specifies whether the message shall be
physically deleted from the journal or only marked as deleted. In both cases, the message won't be replayed.
Later extensions to Akka persistence will allow to replay messages that have been marked as deleted which can
be useful for debugging purposes, for example.
A processor can delete a single message by calling the ``deleteMessage`` method with the sequence number of
that message as argument. An optional ``permanent`` parameter specifies whether the message shall be permanently
deleted from the journal or only marked as deleted. In both cases, the message won't be replayed. Later extensions
to Akka persistence will allow to replay messages that have been marked as deleted which can be useful for debugging
purposes, for example. To delete all messages (journaled by a single processor) up to a specified sequence number,
processors can call the ``deleteMessages`` method.
Identifiers
-----------
@ -315,6 +316,13 @@ If not specified, they default to ``SnapshotSelectionCriteria.latest()`` which s
To disable snapshot-based recovery, applications should use ``SnapshotSelectionCriteria.none()``. A recovery where no
saved snapshot matches the specified ``SnapshotSelectionCriteria`` will replay all journaled messages.
Snapshot deletion
-----------------
A processor can delete a single snapshot by calling the ``deleteSnapshot`` method with the sequence number and the
timestamp of the snapshot as argument. To bulk-delete snapshots that match a specified ``SnapshotSelectionCriteria``
argument, processors can call the ``deleteSnapshots`` method.
.. _event-sourcing-java:
Event sourcing