Skip to content

Commit 6d521b2

Browse files
committed
partitioner: unpub Partitioner(Hasher) trait and impls
We do not expect users to implement their own Partitioners nor use their methods. Therefore, `Partitioner` trait and its implementors, `Murmur3Partitioner` and `CDCPartitioner`, are made `pub(crate)`. Same with `PartitionerHasher` trait and its implementors.
1 parent c1cf21a commit 6d521b2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

scylla/src/routing/partitioner.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ impl Partitioner for PartitionerName {
4949
}
5050
}
5151

52-
// TODO: make this back `pub(crate)` in this PR.
5352
#[allow(clippy::upper_case_acronyms)]
54-
pub enum PartitionerHasherAny {
53+
pub(crate) enum PartitionerHasherAny {
5554
Murmur3(Murmur3PartitionerHasher),
5655
CDC(CDCPartitionerHasher),
5756
}
@@ -77,11 +76,12 @@ impl PartitionerHasher for PartitionerHasherAny {
7776
/// The Partitioners' design is based on std::hash design: `Partitioner`
7877
/// corresponds to `HasherBuilder`, and `PartitionerHasher` to `Hasher`.
7978
/// See their documentation for more details.
80-
pub trait Partitioner {
79+
pub(crate) trait Partitioner {
8180
type Hasher: PartitionerHasher;
8281

8382
fn build_hasher(&self) -> Self::Hasher;
8483

84+
#[allow(unused)] // Currently, no public API uses this.
8585
fn hash_one(&self, data: &[u8]) -> Token {
8686
let mut hasher = self.build_hasher();
8787
hasher.write(data);
@@ -94,12 +94,12 @@ pub trait Partitioner {
9494
/// Instances of this trait are created by a `Partitioner` and are stateful.
9595
/// At any point, one can call `finish()` and a `Token` will be computed
9696
/// based on values that has been fed so far.
97-
pub trait PartitionerHasher {
97+
pub(crate) trait PartitionerHasher {
9898
fn write(&mut self, pk_part: &[u8]);
9999
fn finish(&self) -> Token;
100100
}
101101

102-
pub struct Murmur3Partitioner;
102+
pub(crate) struct Murmur3Partitioner;
103103

104104
impl Partitioner for Murmur3Partitioner {
105105
type Hasher = Murmur3PartitionerHasher;
@@ -114,7 +114,7 @@ impl Partitioner for Murmur3Partitioner {
114114
}
115115
}
116116

117-
pub struct Murmur3PartitionerHasher {
117+
pub(crate) struct Murmur3PartitionerHasher {
118118
total_len: usize,
119119
buf: [u8; Self::BUF_CAPACITY],
120120
h1: Wrapping<i64>,
@@ -280,9 +280,9 @@ enum CDCPartitionerHasherState {
280280
Computed(Token),
281281
}
282282

283-
pub struct CDCPartitioner;
283+
pub(crate) struct CDCPartitioner;
284284

285-
pub struct CDCPartitionerHasher {
285+
pub(crate) struct CDCPartitionerHasher {
286286
state: CDCPartitionerHasherState,
287287
}
288288

0 commit comments

Comments
 (0)