diff --git a/documentation/src/main/paradox/example.md b/documentation/src/main/paradox/example.md index 3e36cc4c..cc9ec0b1 100644 --- a/documentation/src/main/paradox/example.md +++ b/documentation/src/main/paradox/example.md @@ -36,7 +36,7 @@ Implementation of the repository algebra is trivial using `Sharding` instance (i Implementation of behavior algebra is done using the `Entity` typeclass instance (also injected by `deployRepository`): -@@snip [BookingEntity](/example/src/main/scala/endless/example/logic/BookingEntity.scala) { #definition } +@@snip [BookingEntityBehavior](/example/src/main/scala/endless/example/logic/BookingEntityBehavior.scala) { #definition } ## Event handling diff --git a/example/src/main/scala/endless/example/app/akka/AkkaApp.scala b/example/src/main/scala/endless/example/app/akka/AkkaApp.scala index 1e51cf29..4aa91a0f 100644 --- a/example/src/main/scala/endless/example/app/akka/AkkaApp.scala +++ b/example/src/main/scala/endless/example/app/akka/AkkaApp.scala @@ -111,12 +111,12 @@ object AkkaApp extends Bookings with Vehicles with Availabilities { BookingsAlg ]( RepositoryInterpreter.lift(ShardedBookings(_)), - BehaviorInterpreter.lift(BookingEntity(_)), + BehaviorInterpreter.lift(BookingEntityBehavior(_)), SideEffectInterpreter.lift((_, _) => new BookingSideEffect()) ), deployDurableRepository[IO, VehicleID, Vehicle, VehicleAlg, VehiclesAlg]( RepositoryInterpreter.lift(ShardedVehicles(_)), - DurableBehaviorInterpreter.lift(VehicleEntity(_)), + DurableBehaviorInterpreter.lift(VehicleEntityBehavior(_)), (_, _) => VehicleSideEffect() ) ) diff --git a/example/src/main/scala/endless/example/app/pekko/PekkoApp.scala b/example/src/main/scala/endless/example/app/pekko/PekkoApp.scala index d9bf4998..dff270a8 100644 --- a/example/src/main/scala/endless/example/app/pekko/PekkoApp.scala +++ b/example/src/main/scala/endless/example/app/pekko/PekkoApp.scala @@ -114,12 +114,12 @@ object PekkoApp extends Bookings with Vehicles with Availabilities { BookingsAlg ]( RepositoryInterpreter.lift(ShardedBookings(_)), - BehaviorInterpreter.lift(BookingEntity(_)), + BehaviorInterpreter.lift(BookingEntityBehavior(_)), SideEffectInterpreter.lift { case (_, _) => new BookingSideEffect() } ), deployDurableRepository[IO, VehicleID, Vehicle, VehicleAlg, VehiclesAlg]( RepositoryInterpreter.lift(ShardedVehicles(_)), - DurableBehaviorInterpreter.lift(VehicleEntity(_)), + DurableBehaviorInterpreter.lift(VehicleEntityBehavior(_)), (_, _) => VehicleSideEffect() ) ) diff --git a/example/src/main/scala/endless/example/logic/BookingEntity.scala b/example/src/main/scala/endless/example/logic/BookingEntityBehavior.scala similarity index 96% rename from example/src/main/scala/endless/example/logic/BookingEntity.scala rename to example/src/main/scala/endless/example/logic/BookingEntityBehavior.scala index 7bbaf80e..109d5f6f 100644 --- a/example/src/main/scala/endless/example/logic/BookingEntity.scala +++ b/example/src/main/scala/endless/example/logic/BookingEntityBehavior.scala @@ -18,7 +18,7 @@ import org.typelevel.log4cats.Logger import java.time.Instant //#definition -final case class BookingEntity[F[_]: Logger: Clock](entity: Entity[F, Booking, BookingEvent]) +final case class BookingEntityBehavior[F[_]: Logger: Clock](entity: Entity[F, Booking, BookingEvent]) extends BookingAlg[F] { import entity.* diff --git a/example/src/main/scala/endless/example/logic/VehicleEntity.scala b/example/src/main/scala/endless/example/logic/VehicleEntityBehavior.scala similarity index 93% rename from example/src/main/scala/endless/example/logic/VehicleEntity.scala rename to example/src/main/scala/endless/example/logic/VehicleEntityBehavior.scala index 0db78b6d..a2e8af28 100644 --- a/example/src/main/scala/endless/example/logic/VehicleEntity.scala +++ b/example/src/main/scala/endless/example/logic/VehicleEntityBehavior.scala @@ -8,7 +8,7 @@ import endless.example.algebra.VehicleAlg import endless.example.data.{LatLon, Speed, Vehicle} import org.typelevel.log4cats.Logger -final case class VehicleEntity[F[_]: Logger](entity: DurableEntity[F, Vehicle]) +final case class VehicleEntityBehavior[F[_]: Logger](entity: DurableEntity[F, Vehicle]) extends VehicleAlg[F] { import entity.* diff --git a/example/src/test/scala/endless/example/logic/BookingEntitySuite.scala b/example/src/test/scala/endless/example/logic/BookingEntityBehaviorSuite.scala similarity index 98% rename from example/src/test/scala/endless/example/logic/BookingEntitySuite.scala rename to example/src/test/scala/endless/example/logic/BookingEntityBehaviorSuite.scala index 0b441376..df30f2ee 100644 --- a/example/src/test/scala/endless/example/logic/BookingEntitySuite.scala +++ b/example/src/test/scala/endless/example/logic/BookingEntityBehaviorSuite.scala @@ -10,12 +10,12 @@ import org.scalacheck.effect.PropF.* import org.typelevel.log4cats.testing.TestingLogger //#example -class BookingEntitySuite +class BookingEntityBehaviorSuite extends munit.CatsEffectSuite with munit.ScalaCheckEffectSuite with Generators { implicit private val logger: TestingLogger[IO] = TestingLogger.impl[IO]() - private val bookingAlg = BookingEntity(EntityT.instance[IO, Booking, BookingEvent]) + private val bookingAlg = BookingEntityBehavior(EntityT.instance[IO, Booking, BookingEvent]) private implicit val eventApplier: BookingEventApplier = new BookingEventApplier test("place booking") { diff --git a/example/src/test/scala/endless/example/logic/VehicleEntitySuite.scala b/example/src/test/scala/endless/example/logic/VehicleEntityBehaviorSuite.scala similarity index 95% rename from example/src/test/scala/endless/example/logic/VehicleEntitySuite.scala rename to example/src/test/scala/endless/example/logic/VehicleEntityBehaviorSuite.scala index d24c5e7c..fee319ba 100644 --- a/example/src/test/scala/endless/example/logic/VehicleEntitySuite.scala +++ b/example/src/test/scala/endless/example/logic/VehicleEntityBehaviorSuite.scala @@ -7,12 +7,12 @@ import endless.example.data.{LatLon, Speed, Vehicle} import org.scalacheck.effect.PropF.* import org.typelevel.log4cats.testing.TestingLogger -class VehicleEntitySuite +class VehicleEntityBehaviorSuite extends munit.CatsEffectSuite with munit.ScalaCheckEffectSuite with Generators { implicit private val logger: TestingLogger[IO] = TestingLogger.impl[IO]() - private val vehicleAlg = VehicleEntity(DurableEntityT.instance[IO, Vehicle]) + private val vehicleAlg = VehicleEntityBehavior(DurableEntityT.instance[IO, Vehicle]) test("set position") { forAllF { (latLon: LatLon) =>