Skip to content

Commit

Permalink
Rename SnapshotStoreFlat to SnapshotStore.
Browse files Browse the repository at this point in the history
The reason behind this is that there won't be a flat counterpart of the
store. It will be the only one.
  • Loading branch information
rtar committed Feb 15, 2024
1 parent cfe3861 commit 3dcd233
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ object SnapshotStoreAdapter {
): Resource[F, SnapshotStoreAdapter[F]] = {

def adapter(
store: SnapshotStoreFlat[F]
store: SnapshotStore[F]
)(implicit snapshotSerializer: SnapshotSerializer[F, A], snapshotReadWrite: SnapshotReadWrite[F, A]) =
SnapshotStoreAdapter(store, toKey, origin)

Expand All @@ -47,7 +47,7 @@ object SnapshotStoreAdapter {
} yield adapter(store)(snapshotSerializer, snapshotReadWrite)
}

def apply[F[_]: Monad: Fail, A](store: SnapshotStoreFlat[F], toKey: ToKey[F], origin: Option[Origin])(implicit
def apply[F[_]: Monad: Fail, A](store: SnapshotStore[F], toKey: ToKey[F], origin: Option[Origin])(implicit
snapshotSerializer: SnapshotSerializer[F, A],
snapshotReadWrite: SnapshotReadWrite[F, A]
): SnapshotStoreAdapter[F] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ object SnapshotCassandra {
config: SnapshotCassandraConfig,
origin: Option[Origin],
cassandraClusterOf: CassandraClusterOf[F]
): Resource[F, SnapshotStoreFlat[F]] = {
): Resource[F, SnapshotStore[F]] = {

def store(implicit cassandraCluster: CassandraCluster[F], cassandraSession: CassandraSession[F]) =
of(config.schema, origin, config.consistencyConfig, config.numberOfSnapshots)
Expand All @@ -36,16 +36,16 @@ object SnapshotCassandra {
origin: Option[Origin],
consistencyConfig: CassandraConsistencyConfig,
numberOfSnapshots: Int
): F[SnapshotStoreFlat[F]] =
): F[SnapshotStore[F]] =
for {
schema <- SetupSnapshotSchema[F](schemaConfig, origin, consistencyConfig)
statements <- Statements.of[F](schema, consistencyConfig)
} yield SnapshotCassandra(statements, numberOfSnapshots)

private sealed abstract class Main

def apply[F[_]: MonadThrow](statements: Statements[F], numberOfSnapshots: Int): SnapshotStoreFlat[F] = {
new Main with SnapshotStoreFlat[F] {
def apply[F[_]: MonadThrow](statements: Statements[F], numberOfSnapshots: Int): SnapshotStore[F] = {
new Main with SnapshotStore[F] {

def save(key: Key, snapshot: SnapshotRecord[EventualPayloadAndType]): F[Unit] = {
statements.selectMetadata(key).flatMap {
Expand Down

This file was deleted.

0 comments on commit 3dcd233

Please sign in to comment.