refactor: PartitionData::id() -> partition_id()

Consistent naming is consistent - all the others are thing_id().
pull/24376/head
Dom Dwyer 2022-09-30 14:35:38 +02:00
parent 66e05b5ea7
commit 0847cc5458
6 changed files with 13 additions and 11 deletions

View File

@ -811,7 +811,7 @@ mod tests {
assert!(n.table_data("mem").is_some());
let mem_table = mem_table.write().await;
let p = mem_table.partition_data.get(&"1970-01-01".into()).unwrap();
p.id()
p.partition_id()
};
data.persist(partition_id).await;
@ -955,7 +955,7 @@ mod tests {
let p = mem_table.partition_data.get(&"1970-01-01".into()).unwrap();
table_id = mem_table.table_id();
partition_id = p.id();
partition_id = p.partition_id();
}
{
// verify the partition doesn't have a sort key before any data has been persisted

View File

@ -302,7 +302,7 @@ impl PartitionData {
self.data.progress()
}
pub(super) fn id(&self) -> PartitionId {
pub(super) fn partition_id(&self) -> PartitionId {
self.id
}

View File

@ -221,7 +221,7 @@ mod tests {
)
.await;
assert_eq!(got.id(), PARTITION_ID);
assert_eq!(got.partition_id(), PARTITION_ID);
assert_eq!(got.shard_id(), SHARD_ID);
assert_eq!(got.table_id(), TABLE_ID);
assert_eq!(got.table_name(), TABLE_NAME);
@ -255,7 +255,7 @@ mod tests {
)
.await;
assert_eq!(got.id(), PARTITION_ID);
assert_eq!(got.partition_id(), PARTITION_ID);
assert_eq!(got.shard_id(), SHARD_ID);
assert_eq!(got.table_id(), TABLE_ID);
assert_eq!(got.table_name(), TABLE_NAME);
@ -307,7 +307,7 @@ mod tests {
)
.await;
assert_eq!(got.id(), other_key_id);
assert_eq!(got.partition_id(), other_key_id);
assert_eq!(got.shard_id(), SHARD_ID);
assert_eq!(got.table_id(), TABLE_ID);
assert_eq!(got.table_name(), TABLE_NAME);
@ -346,7 +346,7 @@ mod tests {
)
.await;
assert_eq!(got.id(), PARTITION_ID);
assert_eq!(got.partition_id(), PARTITION_ID);
assert_eq!(got.shard_id(), SHARD_ID);
assert_eq!(got.table_id(), other_table);
assert_eq!(got.table_name(), TABLE_NAME);
@ -385,7 +385,7 @@ mod tests {
)
.await;
assert_eq!(got.id(), PARTITION_ID);
assert_eq!(got.partition_id(), PARTITION_ID);
assert_eq!(got.shard_id(), other_shard);
assert_eq!(got.table_id(), TABLE_ID);
assert_eq!(got.table_name(), TABLE_NAME);

View File

@ -82,7 +82,7 @@ mod tests {
Arc::clone(&table_name),
)
.await;
assert_eq!(got.id(), partition);
assert_eq!(got.partition_id(), partition);
assert_eq!(got.namespace_id(), namespace_id);
assert_eq!(*got.table_name(), *table_name);
}

View File

@ -37,6 +37,7 @@ impl DoubleRef {
self.by_name.get(name).map(Arc::clone)
}
#[cfg(test)]
fn by_id(&self, id: NamespaceId) -> Option<Arc<NamespaceData>> {
self.by_id.get(&id).map(Arc::clone)
}
@ -119,6 +120,7 @@ impl ShardData {
}
/// Gets the namespace data out of the map
#[cfg(test)]
pub(crate) fn namespace_by_id(&self, namespace_id: NamespaceId) -> Option<Arc<NamespaceData>> {
// TODO: this should be the default once IDs are pushed over the wire.
//

View File

@ -131,7 +131,7 @@ impl TableData {
// op may fail which would lead to a write being recorded, but not
// applied.
let should_pause = lifecycle_handle.log_write(
partition_data.id(),
partition_data.partition_id(),
self.shard_id,
self.namespace_id,
self.table_id,
@ -182,7 +182,7 @@ impl TableData {
self.partition_data
.values()
.map(|p| UnpersistedPartitionData {
partition_id: p.id(),
partition_id: p.partition_id(),
non_persisted: p
.get_non_persisting_data()
.expect("get_non_persisting should always work"),