tisonkun commented on code in PR #146:
URL: https://github.com/apache/datasketches-rust/pull/146#discussion_r3558680086


##########
datasketches/src/theta/raw_hash_table.rs:
##########
@@ -0,0 +1,400 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::hash::Hash;
+
+use crate::common::ResizeFactor;
+use crate::hash::MurmurHash3X64128;
+use crate::hash::compute_seed_hash;
+use crate::theta::HASH_TABLE_REBUILD_THRESHOLD;
+use crate::theta::HASH_TABLE_RESIZE_THRESHOLD;
+use crate::theta::MAX_THETA;
+use crate::theta::MIN_LG_K;
+use crate::theta::STRIDE_MASK;
+
+pub(crate) trait RawHashTableEntry {
+    fn hash(&self) -> u64;
+}
+
+/// Generic hash-table mechanics shared by Theta and Tuple sketches.
+///
+/// The entry type supplies the retained hash and any sketch-specific payload. 
The table owns all
+/// theta screening, probing, resizing, rebuilding, trimming, and 
logical-empty state.
+#[derive(Debug)]
+pub(crate) struct RawHashTable<E> {
+    pub(crate) lg_cur_size: u8,
+    pub(crate) lg_nom_size: u8,
+    pub(crate) lg_max_size: u8,
+    pub(crate) resize_factor: ResizeFactor,
+    pub(crate) sampling_probability: f32,
+    pub(crate) hash_seed: u64,
+
+    // Logical emptiness of the source set.
+    //
+    // * `false` if any update has been attempted (even if screened by theta)
+    // * `true` if no updates have been attempted.
+    //
+    // This can be false even when `num_retained` is 0.
+    pub(crate) is_empty: bool,
+
+    pub(crate) theta: u64,
+
+    pub(crate) entries: Vec<Option<E>>,
+
+    // Number of retained non-zero hashes currently stored in `entries`.
+    pub(crate) num_retained: usize,
+}

Review Comment:
   These `pub(crate)` can be `pub(super)` as they are limited to the `theta` 
module, never accesed by other modules.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to