Skip to content
This repository was archived by the owner on Jul 23, 2024. It is now read-only.

Commit 49c99c1

Browse files
iamvigneshwarsgarryod
authored andcommitted
Uuidv7 update
1 parent 9d193cd commit 49c99c1

File tree

9 files changed

+18
-11
lines changed

9 files changed

+18
-11
lines changed

backend/Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ tokio = { version = "1.35.1", features = ["macros", "rt-multi-thread"] }
4545
tracing = { version = "0.1.40" }
4646
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
4747
url = { version = "2.5.0" }
48-
uuid = { version = "1.7.0", features = ["v4"] }
48+
uuid = { version = "1.7.0", features = ["v7"] }

backend/chimp_chomp/src/jobs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ pub async fn setup_rabbitmq_client(address: Url) -> Result<Connection, anyhow::E
3030
}
3131

3232
/// Joins a RabbitMQ channel, creating a [`Consumer`] with [`Default`] [`BasicConsumeOptions`] and [`FieldTable`].
33-
/// The consumer tag is generated following the format `chimp_chomp_${`[`Uuid::new_v4`]`}`.
33+
/// The consumer tag is generated following the format `chimp_chomp_${`[`Uuid::now_v7`]`}`.
3434
///
3535
/// Returns a [`lapin::Error`] if the requested channel is not available.
3636
pub async fn setup_job_consumer(
3737
rabbitmq_channel: Channel,
3838
channel: impl AsRef<str>,
3939
) -> Result<Consumer, lapin::Error> {
40-
let worker_id = Uuid::new_v4();
40+
let worker_id = Uuid::now_v7();
4141
let worker_tag = format!("chimp_chomp_{worker_id}");
4242
rabbitmq_channel
4343
.queue_declare(

backend/chimp_controller/src/chimp_messages.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub async fn setup_chimp_client(
2020

2121
let channel = connection.create_channel().await?;
2222

23-
let reply_queue_id = Uuid::new_v4();
23+
let reply_queue_id = Uuid::now_v7();
2424
channel
2525
.queue_declare(
2626
&reply_queue_id.to_string(),

backend/pin_packing/src/resolvers/cane_mount.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl CaneMountMutation {
7474
}?;
7575

7676
let cane = cane_mount::ActiveModel {
77-
id: ActiveValue::Set(Uuid::new_v4()),
77+
id: ActiveValue::Set(Uuid::now_v7()),
7878
barcode: ActiveValue::Set(barcode),
7979
operator_id: ActiveValue::Set(operator_id),
8080
timestamp: ActiveValue::Set(Utc::now()),

backend/pin_packing/src/resolvers/crystal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl CrystalMutation {
5353
let operator_id = subject_authorization!("xchemlab.pin_packing.write_crystal", ctx).await?;
5454
let database = ctx.data::<DatabaseConnection>()?;
5555
let crystal = crystal::ActiveModel {
56-
id: ActiveValue::Set(Uuid::new_v4()),
56+
id: ActiveValue::Set(Uuid::now_v7()),
5757
plate: ActiveValue::Set(well.plate),
5858
well: ActiveValue::Set(well.well),
5959
crystal_state: ActiveValue::Set(crystal_state),

backend/pin_packing/src/resolvers/pin_mount.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl PinMountMutation {
7777
}?;
7878

7979
let pin_mount = pin_mount::ActiveModel {
80-
id: ActiveValue::Set(Uuid::new_v4()),
80+
id: ActiveValue::Set(Uuid::now_v7()),
8181
crystal_id: ActiveValue::Set(crystal_id),
8282
puck_mount_id: ActiveValue::Set(puck_mount_id),
8383
puck_location: ActiveValue::Set(puck_location),

backend/pin_packing/src/resolvers/puck_mount.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl PuckMountMutation {
6666
}?;
6767

6868
let puck = puck_mount::ActiveModel {
69-
id: ActiveValue::Set(Uuid::new_v4()),
69+
id: ActiveValue::Set(Uuid::now_v7()),
7070
cane_mount_id: ActiveValue::Set(None),
7171
cane_location: ActiveValue::Set(None),
7272
barcode: ActiveValue::Set(barcode),

backend/targeting/src/resolvers/prediction.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct CrystalInput {
4646
impl prediction_crystal::ActiveModel {
4747
fn from_crystal_input_and_drop_id(crystal_input: &CrystalInput, drop_id: Uuid) -> Self {
4848
Self {
49-
id: ActiveValue::Set(Uuid::new_v4()),
49+
id: ActiveValue::Set(Uuid::now_v7()),
5050
drop_id: ActiveValue::Set(drop_id),
5151
left: ActiveValue::Set(crystal_input.bounding_box.left),
5252
right: ActiveValue::Set(crystal_input.bounding_box.right),
@@ -96,7 +96,7 @@ struct DropInput {
9696
impl prediction_drop::ActiveModel {
9797
fn from_drop_input_and_prediction_id(drop_input: &DropInput, prediction_id: Uuid) -> Self {
9898
Self {
99-
id: ActiveValue::Set(Uuid::new_v4()),
99+
id: ActiveValue::Set(Uuid::now_v7()),
100100
prediction_id: ActiveValue::Set(prediction_id),
101101
insertion_point_x: ActiveValue::Set(drop_input.insertion_point.x),
102102
insertion_point_y: ActiveValue::Set(drop_input.insertion_point.y),
@@ -185,7 +185,7 @@ impl PredicitonMutation {
185185
.transaction::<_, _, DbErr>(|transaction| {
186186
Box::pin(async move {
187187
let prediction = prediction::Entity::insert(prediction::ActiveModel {
188-
id: ActiveValue::Set(Uuid::new_v4()),
188+
id: ActiveValue::Set(Uuid::now_v7()),
189189
plate: ActiveValue::Set(plate.plate),
190190
well: ActiveValue::Set(plate.well),
191191
well_centroid_x: ActiveValue::Set(well_centroid.x),

0 commit comments

Comments
 (0)