Skip to content

Commit a81f781

Browse files
committed
partitioner: expose PartitionerName
There are two reasons to do so. First, users may be interested which partitioner is used for a specific PreparedStatement. Second, tests in session_test.rs call `get_partitioner_name()` to assert some things. If we want to extract `session_test.rs` to integration tests directory - out of `scylla` crate - we must therefore expose `get_partitioner_name(). NOTE: PartitionerHasherAny is made `pub` in this commit. This is a temporary measure. This is needed because otherwise the compiler errors out that we leak a crate-private type in public interface (the associated type in `impl Partitioner for PartitionerName`). We will be able to revert this once we unpub `Partitioner(Hasher)`.
1 parent 02771d6 commit a81f781

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

scylla/src/routing/partitioner.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ use std::num::Wrapping;
1616
use crate::{prepared_statement::TokenCalculationError, routing::Token};
1717

1818
#[allow(clippy::upper_case_acronyms)]
19-
#[derive(Clone, PartialEq, Debug, Default)]
20-
pub(crate) enum PartitionerName {
19+
#[derive(Clone, PartialEq, Eq, Debug, Default)]
20+
#[non_exhaustive]
21+
pub enum PartitionerName {
2122
#[default]
2223
Murmur3,
2324
CDC,
@@ -48,8 +49,9 @@ impl Partitioner for PartitionerName {
4849
}
4950
}
5051

52+
// TODO: make this back `pub(crate)` in this PR.
5153
#[allow(clippy::upper_case_acronyms)]
52-
pub(crate) enum PartitionerHasherAny {
54+
pub enum PartitionerHasherAny {
5355
Murmur3(Murmur3PartitionerHasher),
5456
CDC(CDCPartitionerHasher),
5557
}

scylla/src/statement/prepared_statement.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ impl PreparedStatement {
418418
}
419419

420420
/// Get the name of the partitioner used for this statement.
421-
pub(crate) fn get_partitioner_name(&self) -> &PartitionerName {
421+
pub fn get_partitioner_name(&self) -> &PartitionerName {
422422
&self.partitioner_name
423423
}
424424

0 commit comments

Comments
 (0)