-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replace EventSourcedPersistence with SnapshotStore & EventStore
- Loading branch information
Denys Fakhritdinov
committed
Dec 11, 2023
1 parent
e6f1680
commit d29e5aa
Showing
15 changed files
with
86 additions
and
277 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
persistence-api/src/main/scala/com/evolutiongaming/akkaeffect/persistence/Event.scala
This file was deleted.
Oops, something went wrong.
85 changes: 0 additions & 85 deletions
85
...i/src/main/scala/com/evolutiongaming/akkaeffect/persistence/EventSourcedPersistence.scala
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
persistence-api/src/main/scala/com/evolutiongaming/akkaeffect/persistence/EventStore.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.evolutiongaming.akkaeffect.persistence | ||
|
||
import com.evolutiongaming.sstream | ||
|
||
trait EventStore[F[_], A] extends EventStore.Read[F, A] with EventStore.Write[F, A] | ||
|
||
object EventStore { | ||
|
||
trait Read[F[_], A] { | ||
def read(fromSeqNr: SeqNr): F[sstream.Stream[F, Event[A]]] | ||
} | ||
|
||
trait Write[F[_], A] { | ||
def append: Append[F, A] | ||
def deleteTo: DeleteEventsTo[F] | ||
} | ||
|
||
final case class Event[A](event: A, seqNr: SeqNr) | ||
|
||
} |
25 changes: 0 additions & 25 deletions
25
persistence-api/src/main/scala/com/evolutiongaming/akkaeffect/persistence/Snapshot.scala
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
...istence-api/src/main/scala/com/evolutiongaming/akkaeffect/persistence/SnapshotStore.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.evolutiongaming.akkaeffect.persistence | ||
|
||
import java.time.Instant | ||
|
||
trait SnapshotStore[F[_], A] extends SnapshotStore.Read[F, A] with SnapshotStore.Write[F, A] | ||
|
||
object SnapshotStore { | ||
|
||
trait Read[F[_], A] { | ||
def latest: F[Option[SnapshotStore.Offer[A]]] | ||
} | ||
|
||
trait Write[F[_], -A] { | ||
def save(seqNr: SeqNr, snapshot: A): F[F[Instant]] | ||
def delete(seqNr: SeqNr): F[F[Unit]] | ||
def delete(criteria: Criteria): F[F[Unit]] | ||
} | ||
|
||
final case class Metadata(seqNr: SeqNr, timestamp: Instant) | ||
|
||
final case class Offer[A](snapshot: A, metadata: Metadata) | ||
|
||
final case class Criteria( | ||
maxSequenceNr: Long = Long.MaxValue, | ||
maxTimestamp: Long = Long.MaxValue, | ||
minSequenceNr: Long = 0L, | ||
minTimestamp: Long = 0L | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
7 changes: 0 additions & 7 deletions
7
persistence/src/main/scala/com/evolutiongaming/akkaeffect/persistence/JournallerOf.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.