Skip to content

Commit 9cb681b

Browse files
committed
connection: unpub fields of nonpub structs
Some structs were private, but had all methods public. Those are made private, too.
1 parent c8d1a3c commit 9cb681b

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

scylla/src/transport/connection.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,30 +1532,30 @@ struct OrphanageTracker {
15321532
}
15331533

15341534
impl OrphanageTracker {
1535-
pub fn new() -> Self {
1535+
fn new() -> Self {
15361536
Self {
15371537
orphans: HashMap::new(),
15381538
by_orphaning_times: BTreeSet::new(),
15391539
}
15401540
}
15411541

1542-
pub fn insert(&mut self, stream_id: i16) {
1542+
fn insert(&mut self, stream_id: i16) {
15431543
let now = Instant::now();
15441544
self.orphans.insert(stream_id, now);
15451545
self.by_orphaning_times.insert((now, stream_id));
15461546
}
15471547

1548-
pub fn remove(&mut self, stream_id: i16) {
1548+
fn remove(&mut self, stream_id: i16) {
15491549
if let Some(time) = self.orphans.remove(&stream_id) {
15501550
self.by_orphaning_times.remove(&(time, stream_id));
15511551
}
15521552
}
15531553

1554-
pub fn contains(&self, stream_id: i16) -> bool {
1554+
fn contains(&self, stream_id: i16) -> bool {
15551555
self.orphans.contains_key(&stream_id)
15561556
}
15571557

1558-
pub fn orphans_older_than(&self, age: std::time::Duration) -> usize {
1558+
fn orphans_older_than(&self, age: std::time::Duration) -> usize {
15591559
let minimal_age = Instant::now() - age;
15601560
self.by_orphaning_times
15611561
.range(..(minimal_age, i16::MAX))
@@ -1581,7 +1581,7 @@ enum HandlerLookupResult {
15811581
}
15821582

15831583
impl ResponseHandlerMap {
1584-
pub fn new() -> Self {
1584+
fn new() -> Self {
15851585
Self {
15861586
stream_set: StreamIdSet::new(),
15871587
handlers: HashMap::new(),
@@ -1590,7 +1590,7 @@ impl ResponseHandlerMap {
15901590
}
15911591
}
15921592

1593-
pub fn allocate(&mut self, response_handler: ResponseHandler) -> Result<i16, ResponseHandler> {
1593+
fn allocate(&mut self, response_handler: ResponseHandler) -> Result<i16, ResponseHandler> {
15941594
if let Some(stream_id) = self.stream_set.allocate() {
15951595
self.request_to_stream
15961596
.insert(response_handler.request_id, stream_id);
@@ -1605,7 +1605,7 @@ impl ResponseHandlerMap {
16051605

16061606
// Orphan stream_id (associated with this request_id) by moving it to
16071607
// `orphanage_tracker`, and freeing its handler
1608-
pub fn orphan(&mut self, request_id: RequestId) {
1608+
fn orphan(&mut self, request_id: RequestId) {
16091609
if let Some(stream_id) = self.request_to_stream.get(&request_id) {
16101610
debug!(
16111611
"Orphaning stream_id = {} associated with request_id = {}",
@@ -1617,12 +1617,12 @@ impl ResponseHandlerMap {
16171617
}
16181618
}
16191619

1620-
pub fn old_orphans_count(&self) -> usize {
1620+
fn old_orphans_count(&self) -> usize {
16211621
self.orphanage_tracker
16221622
.orphans_older_than(OLD_AGE_ORPHAN_THRESHOLD)
16231623
}
16241624

1625-
pub fn lookup(&mut self, stream_id: i16) -> HandlerLookupResult {
1625+
fn lookup(&mut self, stream_id: i16) -> HandlerLookupResult {
16261626
self.stream_set.free(stream_id);
16271627

16281628
if self.orphanage_tracker.contains(stream_id) {
@@ -1646,7 +1646,7 @@ impl ResponseHandlerMap {
16461646

16471647
// Retrieves the map of handlers, used after connection breaks
16481648
// and we have to respond to all of them with an error
1649-
pub fn into_handlers(self) -> HashMap<i16, ResponseHandler> {
1649+
fn into_handlers(self) -> HashMap<i16, ResponseHandler> {
16501650
self.handlers
16511651
}
16521652
}
@@ -1656,14 +1656,14 @@ struct StreamIdSet {
16561656
}
16571657

16581658
impl StreamIdSet {
1659-
pub fn new() -> Self {
1659+
fn new() -> Self {
16601660
const BITMAP_SIZE: usize = (std::i16::MAX as usize + 1) / 64;
16611661
Self {
16621662
used_bitmap: vec![0; BITMAP_SIZE].into_boxed_slice(),
16631663
}
16641664
}
16651665

1666-
pub fn allocate(&mut self) -> Option<i16> {
1666+
fn allocate(&mut self) -> Option<i16> {
16671667
for (block_id, block) in self.used_bitmap.iter_mut().enumerate() {
16681668
if *block != !0 {
16691669
let off = block.trailing_ones();
@@ -1675,7 +1675,7 @@ impl StreamIdSet {
16751675
None
16761676
}
16771677

1678-
pub fn free(&mut self, stream_id: i16) {
1678+
fn free(&mut self, stream_id: i16) {
16791679
let block_id = stream_id as usize / 64;
16801680
let off = stream_id as usize % 64;
16811681
self.used_bitmap[block_id] &= !(1 << off);

0 commit comments

Comments
 (0)