Skip to content

Commit

Permalink
Declare the event type bit size (#1120)
Browse files Browse the repository at this point in the history
Declares the number of bits used for the event type.
  • Loading branch information
huntc authored Feb 2, 2024
1 parent 0efacf5 commit a9b3005
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 5 additions & 5 deletions samples/grpc/iot-service-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ edition = "2021"
rust-version = "1.70.0"

[workspace.dependencies]
akka-persistence-rs = { version = "0.7.0", registry = "lightbend-akka-rs" }
akka-persistence-rs-commitlog = { version = "0.7.0", registry = "lightbend-akka-rs" }
akka-projection-rs = { version = "0.7.0", registry = "lightbend-akka-rs" }
akka-projection-rs-commitlog = { version = "0.7.0", registry = "lightbend-akka-rs" }
akka-projection-rs-grpc = { version = "0.7.0", registry = "lightbend-akka-rs" }
akka-persistence-rs = { version = "0.8.0", registry = "lightbend-akka-rs" }
akka-persistence-rs-commitlog = { version = "0.8.0", registry = "lightbend-akka-rs" }
akka-projection-rs = { version = "0.8.0", registry = "lightbend-akka-rs" }
akka-projection-rs-commitlog = { version = "0.8.0", registry = "lightbend-akka-rs" }
akka-projection-rs-grpc = { version = "0.8.0", registry = "lightbend-akka-rs" }
#akka-persistence-rs = { path = "../../../../akka-edge-rs/akka-persistence-rs" }
#akka-persistence-rs-commitlog = { path = "../../../../akka-edge-rs/akka-persistence-rs-commitlog" }
#akka-projection-rs = { path = "../../../../akka-edge-rs/akka-projection-rs" }
Expand Down
5 changes: 4 additions & 1 deletion samples/grpc/iot-service-rs/backend/src/temperature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,13 @@ impl EventSourcedBehavior for Behavior {
// A namespace for our entity's events when constructing persistence ids.
pub const ENTITY_TYPE: &str = "Sensor";

// Produces a marshaller for our file based commit log and uses the
// upper 12 bits of the log's 64 bit key for holding up to 4K event
// types. The remainder of the key is for the numeric entity id (52 bits).
pub fn marshaller(
events_key_secret_path: String,
secret_store: FileSecretStore,
) -> Marshaller<Event, impl Fn(&Event) -> u32, FileSecretStore> {
) -> Marshaller<Event, impl Fn(&Event) -> u64, FileSecretStore, 12> {
let to_record_type = |event: &Event| match event {
Event::TemperatureRead { .. } => 0,
Event::Registered { .. } => 1,
Expand Down

0 comments on commit a9b3005

Please sign in to comment.