mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-12-03 06:22:32 -05:00
drop ulid dependency
...and use v7 UUIDs exclusively. It's useful to have the timestamp in request ids in particular, and no reason we _need_ v4 anywhere.
This commit is contained in:
@@ -39,9 +39,8 @@ smallvec = "1.0"
|
||||
tempfile = "3.2.0"
|
||||
tokio = { version = "1.24", features = ["macros", "rt-multi-thread", "sync"] }
|
||||
tracing = { workspace = true }
|
||||
ulid = "1.0.0"
|
||||
url = { version = "2.1.1", features = ["serde"] }
|
||||
uuid = { version = "1.1.2", features = ["serde", "std", "v4"] }
|
||||
uuid = { workspace = true }
|
||||
|
||||
[build-dependencies]
|
||||
protobuf-codegen = "3.0"
|
||||
|
||||
@@ -1797,7 +1797,7 @@ impl LockedDatabase {
|
||||
|
||||
pub fn add_sample_file_dir(&mut self, path: PathBuf) -> Result<i32, Error> {
|
||||
let mut meta = schema::DirMeta::default();
|
||||
let uuid = Uuid::new_v4();
|
||||
let uuid = Uuid::now_v7();
|
||||
let uuid_bytes = &uuid.as_bytes()[..];
|
||||
let o = self
|
||||
.open
|
||||
@@ -1906,7 +1906,7 @@ impl LockedDatabase {
|
||||
|
||||
/// Adds a camera.
|
||||
pub fn add_camera(&mut self, mut camera: CameraChange) -> Result<i32, Error> {
|
||||
let uuid = Uuid::new_v4();
|
||||
let uuid = Uuid::now_v7();
|
||||
let uuid_bytes = &uuid.as_bytes()[..];
|
||||
let tx = self.conn.transaction()?;
|
||||
let streams;
|
||||
@@ -2227,7 +2227,7 @@ pub fn init(conn: &mut rusqlite::Connection) -> Result<(), Error> {
|
||||
tx.execute_batch(include_str!("schema.sql"))
|
||||
.map_err(|e| err!(e, msg("unable to create database schema")))?;
|
||||
{
|
||||
let uuid = ::uuid::Uuid::new_v4();
|
||||
let uuid = ::uuid::Uuid::now_v7();
|
||||
let uuid_bytes = &uuid.as_bytes()[..];
|
||||
tx.execute("insert into meta (uuid) values (?)", params![uuid_bytes])?;
|
||||
}
|
||||
@@ -2353,7 +2353,7 @@ impl<C: Clocks + Clone> Database<C> {
|
||||
let real = recording::Time::from(clocks.realtime());
|
||||
let mut stmt = conn
|
||||
.prepare(" insert into open (uuid, start_time_90k, boot_uuid) values (?, ?, ?)")?;
|
||||
let open_uuid = SqlUuid(Uuid::new_v4());
|
||||
let open_uuid = SqlUuid(Uuid::now_v7());
|
||||
let boot_uuid = match get_boot_uuid() {
|
||||
Err(e) => {
|
||||
warn!(err = %e.chain(), "unable to get boot uuid");
|
||||
|
||||
@@ -80,17 +80,17 @@ pub fn run(args: &super::Args, tx: &rusqlite::Transaction) -> Result<(), Error>
|
||||
create index user_session_uid on user_session (user_id);
|
||||
"#,
|
||||
)?;
|
||||
let db_uuid = ::uuid::Uuid::new_v4();
|
||||
let db_uuid = ::uuid::Uuid::now_v7();
|
||||
let db_uuid_bytes = &db_uuid.as_bytes()[..];
|
||||
tx.execute("insert into meta (uuid) values (?)", params![db_uuid_bytes])?;
|
||||
let open_uuid = ::uuid::Uuid::new_v4();
|
||||
let open_uuid = ::uuid::Uuid::now_v7();
|
||||
let open_uuid_bytes = &open_uuid.as_bytes()[..];
|
||||
tx.execute(
|
||||
"insert into open (uuid) values (?)",
|
||||
params![open_uuid_bytes],
|
||||
)?;
|
||||
let open_id = tx.last_insert_rowid() as u32;
|
||||
let dir_uuid = ::uuid::Uuid::new_v4();
|
||||
let dir_uuid = ::uuid::Uuid::now_v7();
|
||||
let dir_uuid_bytes = &dir_uuid.as_bytes()[..];
|
||||
|
||||
// Write matching metadata to the directory.
|
||||
|
||||
Reference in New Issue
Block a user