Skip to content

Commit

Permalink
Event Journal: Use ULID instead of UUID for record ids
Browse files Browse the repository at this point in the history
  • Loading branch information
uklotzde committed Sep 26, 2022
1 parent 16bf4ec commit fd45eed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions crates/msr-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ csv = { version = "1.1.6", optional = true, default-features = false }
serde = { version = "1.0.145", optional = true, default-features = false }
serde_json = { version = "1.0.85", optional = true, default-features = false }
thread-priority = { version = "0.9.2", optional = true, default-features = false }
uuid = { version = "1.1.2", optional = true, default-features = false }
ulid = { version = "1.0.0", optional = true }

[target.'cfg(loom)'.dependencies]
loom = "0.5.6"
Expand All @@ -30,7 +30,7 @@ loom = "0.5.6"
default = []
full = ["csv-event-journal", "csv-register-recorder", "realtime-worker-thread"]
serde = ["dep:serde", "time/serde-well-known"]
event-journal = ["serde/derive", "bs58/std", "uuid/v4"]
event-journal = ["serde/derive", "ulid"]
register-recorder = ["serde/derive", "bs58/std"]
csv-storage = ["serde", "csv"]
csv-event-journal = ["event-journal", "csv-storage"]
Expand Down
4 changes: 2 additions & 2 deletions crates/msr-core/src/event_journal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::{fmt, num::NonZeroUsize, time::SystemTime};

use serde::{Deserialize, Serialize};
use thiserror::Error;
use uuid::Uuid;
use ulid::Ulid;

use crate::{
storage::{
Expand Down Expand Up @@ -280,7 +280,7 @@ pub struct DefaultRecordPreludeGenerator;

impl RecordPreludeGenerator for DefaultRecordPreludeGenerator {
fn generate_prelude(&self) -> Result<(SystemInstant, RecordPrelude)> {
let id = RecordId::from(bs58::encode(Uuid::new_v4().as_bytes()).into_string());
let id = RecordId::from(Ulid::new().to_string());
Ok((
SystemInstant::now(),
RecordPrelude {
Expand Down

0 comments on commit fd45eed

Please sign in to comment.