utils: move ShardStripeSize into shard module (#12640)

## Problem

`ShardStripeSize` will be used in the compute spec and internally in the
communicator. It shouldn't require pulling in all of `pageserver_api`.

## Summary of changes

Move `ShardStripeSize` into `utils::shard`, along with other basic shard
types. Also remove the `Default` implementation, to discourage clients
from falling back to a default (it's generally a footgun).

The type is still re-exported from `pageserver_api::shard`, along with
all the other shard types.
This commit is contained in:
Erik Grinaker
2025-07-21 12:56:20 +02:00
committed by GitHub
parent 1406bdc6a8
commit e181b996c3
12 changed files with 49 additions and 67 deletions

View File

@@ -981,7 +981,7 @@ mod tests {
use pageserver_api::models::utilization::test_utilization;
use pageserver_api::shard::ShardIdentity;
use utils::id::TenantId;
use utils::shard::{ShardCount, ShardNumber, TenantShardId};
use utils::shard::{ShardCount, ShardNumber, ShardStripeSize, TenantShardId};
use super::*;
use crate::tenant_shard::IntentState;
@@ -1337,7 +1337,7 @@ mod tests {
let shard_identity = ShardIdentity::new(
tenant_shard_id.shard_number,
tenant_shard_id.shard_count,
pageserver_api::shard::ShardStripeSize(1),
ShardStripeSize(1),
)
.unwrap();
let mut shard = TenantShard::new(
@@ -1411,7 +1411,7 @@ mod tests {
let shard_identity = ShardIdentity::new(
tenant_shard_id.shard_number,
tenant_shard_id.shard_count,
pageserver_api::shard::ShardStripeSize(1),
ShardStripeSize(1),
)
.unwrap();
let mut shard = TenantShard::new(
@@ -1573,7 +1573,7 @@ mod tests {
let shard_identity = ShardIdentity::new(
tenant_shard_id.shard_number,
tenant_shard_id.shard_count,
pageserver_api::shard::ShardStripeSize(1),
ShardStripeSize(1),
)
.unwrap();
// 1 attached and 1 secondary.