Skip to content

Commit

Permalink
Merge pull request #5104 from systeminit/nick/f8d3367
Browse files Browse the repository at this point in the history
Migrate all remaining IDs to si-id
  • Loading branch information
nickgerace authored Dec 11, 2024
2 parents 14d25e6 + 1059c5f commit 1f1c136
Show file tree
Hide file tree
Showing 23 changed files with 245 additions and 462 deletions.
4 changes: 3 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions lib/dal/src/workspace_snapshot/vector_clock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ impl VectorClock {
&self,
change_set_id_filter: Option<ChangeSetId>,
) -> Option<(VectorClockId, LamportClock)> {
let maybe_change_set_id = change_set_id_filter
.map(|change_set_id| VectorClockChangeSetId::new(change_set_id.into_inner().into()));
let maybe_change_set_id = change_set_id_filter.map(VectorClockChangeSetId::from);
self.entries
.iter()
.filter(|(clock_id, _)| {
Expand Down
1 change: 1 addition & 0 deletions lib/module-index-server/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ rust_library(
"//lib/module-index-types:module-index-types",
"//lib/si-data-pg:si-data-pg",
"//lib/si-hash:si-hash",
"//lib/si-id:si-id",
"//lib/si-jwt-public-key:si-jwt-public-key",
"//lib/si-pkg:si-pkg",
"//lib/si-posthog-rs:si-posthog",
Expand Down
1 change: 1 addition & 0 deletions lib/module-index-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ buck2-resources = { path = "../../lib/buck2-resources" }
module-index-types = { path = "../../lib/module-index-types" }
si-data-pg = { path = "../../lib/si-data-pg" }
si-hash = { path = "../../lib/si-hash" }
si-id = { path = "../../lib/si-id" }
si-jwt-public-key = { path = "../../lib/si-jwt-public-key" }
si-pkg = { path = "../../lib/si-pkg" }
si-posthog = { path = "../../lib/si-posthog-rs" }
Expand Down
10 changes: 3 additions & 7 deletions lib/module-index-server/src/models/si_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@ use sea_orm::{entity::prelude::*, sea_query, TryGetError};
use serde::{Deserialize, Serialize};
use std::str::FromStr;

pub mod module_id;
pub mod schema_id;
pub mod schema_variant_id;

pub use module_id::ModuleId;
pub use schema_id::SchemaId;
pub use schema_variant_id::SchemaVariantId;
pub use si_id::ModuleIndexModuleId as ModuleId;
pub use si_id::SchemaId;
pub use si_id::SchemaVariantId;

#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
Expand Down
79 changes: 0 additions & 79 deletions lib/module-index-server/src/models/si_module/module_id.rs

This file was deleted.

84 changes: 0 additions & 84 deletions lib/module-index-server/src/models/si_module/schema_id.rs

This file was deleted.

87 changes: 0 additions & 87 deletions lib/module-index-server/src/models/si_module/schema_variant_id.rs

This file was deleted.

15 changes: 8 additions & 7 deletions lib/module-index-server/src/routes/upsert_module_route.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::str::FromStr;

use axum::{
extract::{multipart::MultipartError, Multipart},
response::{IntoResponse, Response},
Expand All @@ -18,7 +20,6 @@ use serde::{Deserialize, Serialize};
use si_pkg::{SiPkg, SiPkgError, SiPkgKind};
use telemetry::prelude::*;
use thiserror::Error;
use ulid::Ulid;

use crate::{
extract::{Authorization, DbConnection, ExtractedS3Bucket},
Expand Down Expand Up @@ -121,11 +122,11 @@ pub async fn upsert_module_route(
SiPkgKind::Module => ModuleKind::Module,
};

let new_schema_id = Some(SchemaId(Ulid::new()));
let new_schema_id = Some(SchemaId::new());
let schema_id = match module_kind {
ModuleKind::WorkspaceBackup => None,
ModuleKind::Module => match module_schema_id {
Some(schema_id_string) => Some(SchemaId(Ulid::from_string(&schema_id_string)?)),
Some(schema_id_string) => Some(SchemaId::from_str(&schema_id_string)?),
None => match module_based_on_hash {
None => new_schema_id,
Some(based_on_hash) => {
Expand Down Expand Up @@ -156,7 +157,7 @@ pub async fn upsert_module_route(
};

if let Some(schema_id) = schema_id {
info!("module gets schema id: {}", schema_id.0);
info!("module gets schema id: {}", schema_id.as_raw_id());
}

let schemas: Vec<String> = loaded_module
Expand All @@ -177,9 +178,9 @@ pub async fn upsert_module_route(
let schema_variant_id = match module_kind {
ModuleKind::WorkspaceBackup => None,
ModuleKind::Module => match module_schema_variant_id {
Some(schema_variant_id_string) => Some(SchemaVariantId(Ulid::from_string(
&schema_variant_id_string,
)?)),
Some(schema_variant_id_string) => {
Some(SchemaVariantId::from_str(&schema_variant_id_string)?)
}
_ => None,
},
};
Expand Down
1 change: 0 additions & 1 deletion lib/si-events-rs/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ rust_library(
"//third-party/rust:serde_json",
"//third-party/rust:strum",
"//third-party/rust:thiserror",
"//third-party/rust:ulid",
"//third-party/rust:xxhash-rust",
],
srcs = glob([
Expand Down
1 change: 0 additions & 1 deletion lib/si-events-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ serde = { workspace = true }
serde_json = { workspace = true }
strum = { workspace = true }
thiserror = { workspace = true }
ulid = { workspace = true }
xxhash-rust = { workspace = true }
Loading

0 comments on commit 1f1c136

Please sign in to comment.