Browse Source

Use UUID v7 instead of v4 for build and session IDs

V7 UUIDs include a timestamp and are sortable. This is useful to see which ID is newer.
tags/v0.3.12-rc0
Philipp Oppermann 1 year ago
parent
commit
8a4ddf4f4d
Failed to extract signature
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      libraries/message/src/lib.rs

+ 3
- 3
libraries/message/src/lib.rs View File

@@ -24,7 +24,7 @@ pub mod coordinator_to_cli;

pub use arrow_data;
pub use arrow_schema;
use uuid::Uuid;
use uuid::{Timestamp, Uuid};

pub type DataflowId = uuid::Uuid;

@@ -35,7 +35,7 @@ pub struct SessionId(uuid::Uuid);

impl SessionId {
pub fn generate() -> Self {
Self(Uuid::new_v4())
Self(Uuid::new_v7(Timestamp::now(uuid::NoContext)))
}
}

@@ -52,7 +52,7 @@ pub struct BuildId(uuid::Uuid);

impl BuildId {
pub fn generate() -> Self {
Self(Uuid::new_v4())
Self(Uuid::new_v7(Timestamp::now(uuid::NoContext)))
}
}



Loading…
Cancel
Save