diff --git a/safe-persistence/src/main/scala/akka/persistence/SnapshotterFromPersistenceSnapshotter.scala b/safe-persistence/src/main/scala/akka/persistence/SnapshotterFromPersistenceSnapshotter.scala index 3e8c7a0..fcfbb8f 100644 --- a/safe-persistence/src/main/scala/akka/persistence/SnapshotterFromPersistenceSnapshotter.scala +++ b/safe-persistence/src/main/scala/akka/persistence/SnapshotterFromPersistenceSnapshotter.scala @@ -1,14 +1,24 @@ package akka.persistence +import akka.persistence.SnapshotProtocol.SaveSnapshot import com.evolutiongaming.safeakka +import com.evolutiongaming.safeakka.persistence.SeqNr -/* -The class has been renamed to SnapshotterInterop by Yaroslav Klymko after 3.0.0 release, but the changes never got -to release. -The class has been restored with deprecation to satisfy MiMa bincompat report. - */ - -@deprecated(message = "use SnapshotterInterop", since = "3.1.0") object SnapshotterFromPersistenceSnapshotter { - def apply[A](snapshotter: Snapshotter): safeakka.persistence.Snapshotter[A] = SnapshotterInterop.apply(snapshotter) -} \ No newline at end of file + + def apply[A]( + snapshotter: Snapshotter + ): safeakka.persistence.Snapshotter[A] = new safeakka.persistence.Snapshotter[A] { + + def save(snapshot: A) = snapshotter.saveSnapshot(snapshot) + + def save(seqNr: SeqNr, snapshot: A) = { + val saveSnapshot = SaveSnapshot(SnapshotMetadata(snapshotter.snapshotterId, seqNr), snapshot) + snapshotter.snapshotStore.tell(saveSnapshot, snapshotter.self) + } + + def delete(seqNr: SeqNr) = snapshotter.deleteSnapshot(seqNr) + + def delete(criteria: SnapshotSelectionCriteria) = snapshotter.deleteSnapshots(criteria) + } +} diff --git a/safe-persistence/src/main/scala/akka/persistence/SnapshotterInterop.scala b/safe-persistence/src/main/scala/akka/persistence/SnapshotterInterop.scala deleted file mode 100644 index fa2ea92..0000000 --- a/safe-persistence/src/main/scala/akka/persistence/SnapshotterInterop.scala +++ /dev/null @@ -1,24 +0,0 @@ -package akka.persistence - -import akka.persistence.SnapshotProtocol.SaveSnapshot -import com.evolutiongaming.safeakka -import com.evolutiongaming.safeakka.persistence.SeqNr - -object SnapshotterInterop { - - def apply[A]( - snapshotter: Snapshotter - ): safeakka.persistence.Snapshotter[A] = new safeakka.persistence.Snapshotter[A] { - - def save(snapshot: A) = snapshotter.saveSnapshot(snapshot) - - def save(seqNr: SeqNr, snapshot: A) = { - val saveSnapshot = SaveSnapshot(SnapshotMetadata(snapshotter.snapshotterId, seqNr), snapshot) - snapshotter.snapshotStore.tell(saveSnapshot, snapshotter.self) - } - - def delete(seqNr: SeqNr) = snapshotter.deleteSnapshot(seqNr) - - def delete(criteria: SnapshotSelectionCriteria) = snapshotter.deleteSnapshots(criteria) - } -} diff --git a/safe-persistence/src/main/scala/com/evolutiongaming/safeakka/persistence/Snapshotter.scala b/safe-persistence/src/main/scala/com/evolutiongaming/safeakka/persistence/Snapshotter.scala index 5628788..f918514 100644 --- a/safe-persistence/src/main/scala/com/evolutiongaming/safeakka/persistence/Snapshotter.scala +++ b/safe-persistence/src/main/scala/com/evolutiongaming/safeakka/persistence/Snapshotter.scala @@ -58,7 +58,7 @@ object Snapshotter { def apply[S](snapshotter: akka.persistence.Snapshotter): Snapshotter[S] = { - SnapshotterInterop(snapshotter) + SnapshotterFromPersistenceSnapshotter(snapshotter) }