This is an automated email from the ASF dual-hosted git repository.
mdedetrich pushed a commit to branch main
in repository
https://gitbox.apache.org/repos/asf/incubator-pekko-persistence-cassandra.git
commit 869800d7424a5665fdbfb8530f453e37335b1f25
Author: Auto Format <nobody>
AuthorDate: Wed Sep 6 17:50:16 2023 +0200
format source with javafmt, #97
---
.../test/java/jdoc/cleanup/CleanupDocExample.java | 67 ++++++++++++----------
1 file changed, 38 insertions(+), 29 deletions(-)
diff --git a/docs/src/test/java/jdoc/cleanup/CleanupDocExample.java
b/docs/src/test/java/jdoc/cleanup/CleanupDocExample.java
index 6e6fe4d..48c7159 100644
--- a/docs/src/test/java/jdoc/cleanup/CleanupDocExample.java
+++ b/docs/src/test/java/jdoc/cleanup/CleanupDocExample.java
@@ -20,33 +20,42 @@ import java.time.temporal.ChronoUnit;
public class CleanupDocExample {
-
-
- public static void example() {
-
- ActorSystem system = null;
-
- //#cleanup
- CassandraReadJournal queries =
PersistenceQuery.get(system).getReadJournalFor(CassandraReadJournal.class,
CassandraReadJournal.Identifier());
- Cleanup cleanup = new Cleanup(system);
-
- int persistenceIdParallelism = 10;
-
-
- // forall persistence ids, keep two snapshots and delete all events
before the oldest kept snapshot
- queries.currentPersistenceIds().mapAsync(persistenceIdParallelism, pid
-> FutureConverters.toJava(cleanup.cleanupBeforeSnapshot(pid, 2))).run(system);
-
- // forall persistence ids, keep everything after the provided unix
timestamp, if there aren't enough snapshots after this time
- // go back before the timestamp to find snapshot to delete before
- // this operation is more expensive that the one above
- ZonedDateTime keepAfter = ZonedDateTime.now().minus(1,
ChronoUnit.MONTHS);
- queries
- .currentPersistenceIds()
- .mapAsync(persistenceIdParallelism, pid ->
FutureConverters.toJava(cleanup.cleanupBeforeSnapshot(pid, 2,
keepAfter.toInstant().toEpochMilli())))
- .run(system);
-
- //#cleanup
-
-
- }
+ public static void example() {
+
+ ActorSystem system = null;
+
+ // #cleanup
+ CassandraReadJournal queries =
+ PersistenceQuery.get(system)
+ .getReadJournalFor(CassandraReadJournal.class,
CassandraReadJournal.Identifier());
+ Cleanup cleanup = new Cleanup(system);
+
+ int persistenceIdParallelism = 10;
+
+ // forall persistence ids, keep two snapshots and delete all events before
the oldest kept
+ // snapshot
+ queries
+ .currentPersistenceIds()
+ .mapAsync(
+ persistenceIdParallelism,
+ pid -> FutureConverters.toJava(cleanup.cleanupBeforeSnapshot(pid,
2)))
+ .run(system);
+
+ // forall persistence ids, keep everything after the provided unix
timestamp, if there aren't
+ // enough snapshots after this time
+ // go back before the timestamp to find snapshot to delete before
+ // this operation is more expensive that the one above
+ ZonedDateTime keepAfter = ZonedDateTime.now().minus(1, ChronoUnit.MONTHS);
+ queries
+ .currentPersistenceIds()
+ .mapAsync(
+ persistenceIdParallelism,
+ pid ->
+ FutureConverters.toJava(
+ cleanup.cleanupBeforeSnapshot(pid, 2,
keepAfter.toInstant().toEpochMilli())))
+ .run(system);
+
+ // #cleanup
+
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]