Skip to content

Commit 63e95b8

Browse files
committed
u32 max attach count
1 parent a1b10d0 commit 63e95b8

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

nexus/src/db/collection_attach.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ pub trait DatastoreAttachTarget<ResourceType>: Selectable<Pg> + Sized {
182182
collection_query: BoxedQuery<CollectionTable<ResourceType, Self>>,
183183
resource_query: BoxedQuery<ResourceTable<ResourceType, Self>>,
184184

185-
max_attached_resources: usize,
185+
max_attached_resources: u32,
186186

187187
// We are intentionally picky about this update statement:
188188
// - The second argument - the WHERE clause - must match the default
@@ -344,7 +344,7 @@ where
344344
// A (mostly) user-provided query for validating the resource.
345345
resource_query: Box<dyn QueryFragment<Pg> + Send>,
346346
// The maximum number of resources which may be attached to the collection.
347-
max_attached_resources: usize,
347+
max_attached_resources: u32,
348348

349349
// Update statement for the resource.
350350
update_resource_statement:

nexus/src/db/datastore.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,6 @@ impl DataStore {
11711171
let attached_label =
11721172
api::external::DiskState::Attached(authz_instance.id()).label();
11731173

1174-
// TODO "u32" seems reasonable for the max disks value (input / output)
11751174
let (instance, disk) = Instance::attach_resource(
11761175
authz_instance.id(),
11771176
authz_disk.id(),
@@ -1181,8 +1180,7 @@ impl DataStore {
11811180
disk::table
11821181
.into_boxed()
11831182
.filter(disk::dsl::disk_state.eq_any(ok_to_attach_disk_state_labels)),
1184-
// TODO: Remove unwrap?
1185-
usize::try_from(max_disks).unwrap(),
1183+
max_disks,
11861184
diesel::update(disk::dsl::disk)
11871185
.set((
11881186
disk::dsl::disk_state.eq(attached_label),

0 commit comments

Comments
 (0)