Skip to content

Commit

Permalink
applying codespell fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
yaleman committed Jun 26, 2024
1 parent cbfb537 commit afd64c8
Show file tree
Hide file tree
Showing 29 changed files with 110 additions and 124 deletions.
3 changes: 2 additions & 1 deletion .codespell_ignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
crate
crate
ser
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ clippy:
cargo clippy --features arcache

check: ## check all the things
check: test clippy
check: test clippy codespell
cargo fmt --check
cargo outdated -R
cargo audit

Expand Down Expand Up @@ -59,4 +60,4 @@ codespell: ## spell-check things.
codespell:
codespell -c \
--ignore-words .codespell_ignore \
--skip='./target'
--skip='./target,dhat-heap.json'
2 changes: 1 addition & 1 deletion src/arcache/ll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ where
while n != tail {
unsafe {
let next = (*n).next;
// For sanity - we want to check that the node preceeding us is the correct link.
// For sanity - we want to check that the node preceding us is the correct link.
debug_assert!((*next).prev == n);

// K is not a null pointer.
Expand Down
12 changes: 6 additions & 6 deletions src/arcache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1547,8 +1547,8 @@ impl<
// Inserts are accepted.
}

/// Attempt to retieve a k-v pair from the cache. If it is present in the main cache OR
/// the thread local cache, a `Some` is returned, else you will recieve a `None`. On a
/// Attempt to retrieve a k-v pair from the cache. If it is present in the main cache OR
/// the thread local cache, a `Some` is returned, else you will receive a `None`. On a
/// `None`, you must then consult the external data source that this structure is acting
/// as a cache for.
pub fn get<Q>(&mut self, k: &Q) -> Option<&V>
Expand Down Expand Up @@ -1890,8 +1890,8 @@ impl<
S: ARCacheReadStat + Clone,
> ARCacheReadTxn<'_, K, V, S>
{
/// Attempt to retieve a k-v pair from the cache. If it is present in the main cache OR
/// the thread local cache, a `Some` is returned, else you will recieve a `None`. On a
/// Attempt to retrieve a k-v pair from the cache. If it is present in the main cache OR
/// the thread local cache, a `Some` is returned, else you will receive a `None`. On a
/// `None`, you must then consult the external data source that this structure is acting
/// as a cache for.
pub fn get<Q>(&mut self, k: &Q) -> Option<&V>
Expand Down Expand Up @@ -2022,7 +2022,7 @@ impl<
/// Note that is invalid to insert an item who's key already exists in this thread local cache,
/// and this is asserted IE will panic if you attempt this. It is also invalid for you to insert
/// a value that does not match the source-of-truth state, IE inserting a different
/// value than another thread may percieve. This is a *read* thread, so you should only be adding
/// value than another thread may perceive. This is a *read* thread, so you should only be adding
/// values that are relevant to this read transaction and this point in time. If you do not
/// heed this warning, you may alter the fabric of time and space and have some interesting
/// distortions in your data over time.
Expand Down Expand Up @@ -2846,7 +2846,7 @@ mod tests {
);
wr_txn.commit();

// Now once commited, the proper sizes kick in.
// Now once committed, the proper sizes kick in.

let wr_txn = arc.write();
eprintln!("{:?}", wr_txn.peek_stat());
Expand Down
4 changes: 2 additions & 2 deletions src/bptree/asynch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl<K: Clone + Ord + Debug + Sync + Send + 'static, V: Clone + Sync + Send + 's
BptreeMapWriteTxn<'_, K, V>
{
/// Commit the changes from this write transaction. Readers after this point
/// will be able to percieve these changes.
/// will be able to perceive these changes.
///
/// To abort (unstage changes), just do not call this function.
pub fn commit(self) {
Expand Down Expand Up @@ -267,7 +267,7 @@ mod tests {
async fn test_bptree2_map_acb_order() {
// Need to ensure that txns are dropped in order.

// Add data, enouugh to cause a split. All data should be *2
// Add data, enough to cause a split. All data should be *2
let map = BptreeMap::new();
// add values
{
Expand Down
10 changes: 5 additions & 5 deletions src/bptree/impl.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::internals::bptree::cursor::CursorReadOps;
use crate::internals::bptree::cursor::{CursorRead, CursorWrite, SuperBlock};
use crate::internals::bptree::iter::{Iter, RangeIter, KeyIter, ValueIter};
use crate::internals::bptree::iter::{Iter, KeyIter, RangeIter, ValueIter};
use crate::internals::bptree::mutiter::RangeMutIter;
use crate::internals::lincowcell::LinCowCellCapable;
use std::borrow::Borrow;
Expand All @@ -24,7 +24,7 @@ use std::ops::RangeBounds;
/// This is achieved through the use of [COW](https://en.wikipedia.org/wiki/Copy-on-write)
/// or [MVCC](https://en.wikipedia.org/wiki/Multiversion_concurrency_control).
/// As a write occurs, subsets of the tree are cloned into the writer thread
/// and then commited later. This may cause memory usage to increase in exchange
/// and then committed later. This may cause memory usage to increase in exchange
/// for a gain in concurrent behaviour.
///
/// Transactions can be rolled-back (aborted) without penalty by dropping
Expand Down Expand Up @@ -70,7 +70,7 @@ unsafe impl<K: Clone + Ord + Debug + Sync + Send + 'static, V: Clone + Sync + Se
/// may be modified exclusively through this transaction without affecting
/// readers. The write may be rolledback/aborted by dropping this guard
/// without calling `commit()`. Once `commit()` is called, readers will be
/// able to access and percieve changes in new transactions.
/// able to access and perceive changes in new transactions.
pub struct BptreeMapWriteTxn<'a, K, V>
where
K: Ord + Clone + Debug + Sync + Send + 'static,
Expand All @@ -89,7 +89,7 @@ where
}

/// A point-in-time snapshot of the tree from within a read OR write. This is
/// useful for building other transactional types ontop of this structure, as
/// useful for building other transactional types on top of this structure, as
/// you need a way to downcast both BptreeMapReadTxn or BptreeMapWriteTxn to
/// a singular reader type for a number of get_inner() style patterns.
///
Expand Down Expand Up @@ -239,7 +239,7 @@ impl<K: Clone + Ord + Debug + Sync + Send + 'static, V: Clone + Sync + Send + 's
// == RW methods

/// Reset this tree to an empty state. As this is within the transaction this
/// change only takes effect once commited.
/// change only takes effect once committed.
pub fn clear(&mut self) {
self.inner.as_mut().clear()
}
Expand Down
4 changes: 2 additions & 2 deletions src/bptree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl<K: Clone + Ord + Debug + Sync + Send + 'static, V: Clone + Sync + Send + 's
BptreeMapWriteTxn<'_, K, V>
{
/// Commit the changes from this write transaction. Readers after this point
/// will be able to percieve these changes.
/// will be able to perceive these changes.
///
/// To abort (unstage changes), just do not call this function.
pub fn commit(self) {
Expand Down Expand Up @@ -270,7 +270,7 @@ mod tests {
fn test_bptree2_map_acb_order() {
// Need to ensure that txns are dropped in order.

// Add data, enouugh to cause a split. All data should be *2
// Add data, enough to cause a split. All data should be *2
let map = BptreeMap::new();
// add values
{
Expand Down
4 changes: 2 additions & 2 deletions src/cowcell/asynch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ where
}

fn commit(&self, newdata: Option<T>) {
if let Some(nd) = newdata {
if let Some(new_data) = newdata {
// now over-write the last value in the `ArcSwap`.
self.active.store(Arc::new(nd));
self.active.store(Arc::new(new_data));
}
// If not some, we do nothing.
// Done
Expand Down
4 changes: 2 additions & 2 deletions src/cowcell/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ where
}

fn commit(&self, newdata: Option<T>) {
if let Some(nd) = newdata {
if let Some(new_data) = newdata {
// now over-write the last value in the `ArcSwap`.
self.active.store(Arc::new(nd));
self.active.store(Arc::new(new_data));
}
// If not some, we do nothing.
// Done
Expand Down
4 changes: 2 additions & 2 deletions src/ebrcell/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ where
})
}

/// This is an internal compontent of the commit cycle. It takes ownership
/// This is an internal component of the commit cycle. It takes ownership
/// of the value stored in the writetxn, and commits it to the main EbrCell
/// safely.
///
Expand Down Expand Up @@ -257,7 +257,7 @@ pub struct EbrCellReadTxn<T> {
impl<T> Deref for EbrCellReadTxn<T> {
type Target = T;

/// Derference and access the value within the read transaction.
/// De-reference and access the value within the read transaction.
fn deref(&self) -> &T {
unsafe { &(*self.data) }
}
Expand Down
2 changes: 1 addition & 1 deletion src/hashmap/asynch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl<K: Hash + Eq + Clone + Debug + Sync + Send + 'static, V: Clone + Sync + Sen
HashMapWriteTxn<'_, K, V>
{
/// Commit the changes from this write transaction. Readers after this point
/// will be able to percieve these changes.
/// will be able to perceive these changes.
///
/// To abort (unstage changes), just do not call this function.
pub fn commit(self) {
Expand Down
35 changes: 13 additions & 22 deletions src/hashmap/impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use std::iter::FromIterator;
/// in time.
///
/// This is achieved through the use of COW or MVCC. As a write occurs
/// subsets of the tree are cloned into the writer thread and then commited
/// subsets of the tree are cloned into the writer thread and then committed
/// later. This may cause memory usage to increase in exchange for a gain
/// in concurrent behaviour.
///
Expand Down Expand Up @@ -59,7 +59,7 @@ where
/// may be modified exclusively through this transaction without affecting
/// readers. The write may be rolledback/aborted by dropping this guard
/// without calling `commit()`. Once `commit()` is called, readers will be
/// able to access and percieve changes in new transactions.
/// able to access and perceive changes in new transactions.
pub struct HashMapWriteTxn<'a, K, V>
where
K: Hash + Eq + Clone + Debug + Sync + Send + 'static,
Expand All @@ -78,7 +78,7 @@ where
}

/// A point-in-time snapshot of the tree from within a read OR write. This is
/// useful for building other transactional types ontop of this structure, as
/// useful for building other transactional types on top of this structure, as
/// you need a way to downcast both HashMapReadTxn or HashMapWriteTxn to
/// a singular reader type for a number of get_inner() style patterns.
///
Expand Down Expand Up @@ -118,20 +118,16 @@ impl<K: Hash + Eq + Clone + Debug + Sync + Send + 'static, V: Clone + Sync + Sen
}
}

impl<
K: Hash + Eq + Clone + Debug + Sync + Send + 'static,
V: Clone + Sync + Send + 'static,
> Extend<(K, V)> for HashMapWriteTxn<'_, K, V>
impl<K: Hash + Eq + Clone + Debug + Sync + Send + 'static, V: Clone + Sync + Send + 'static>
Extend<(K, V)> for HashMapWriteTxn<'_, K, V>
{
fn extend<I: IntoIterator<Item = (K, V)>>(&mut self, iter: I) {
self.inner.as_mut().extend(iter);
}
}

impl<
K: Hash + Eq + Clone + Debug + Sync + Send + 'static,
V: Clone + Sync + Send + 'static,
> HashMapWriteTxn<'_, K, V>
impl<K: Hash + Eq + Clone + Debug + Sync + Send + 'static, V: Clone + Sync + Send + 'static>
HashMapWriteTxn<'_, K, V>
{
/*
pub(crate) fn prehash<Q>(&self, k: &Q) -> u64
Expand Down Expand Up @@ -197,8 +193,8 @@ impl<
}

/// Reset this map to an empty state. As this is within the transaction this
/// change only takes effect once commited. Once cleared, you can begin adding
/// new writes and changes, again, that will only be visible once commited.
/// change only takes effect once committed. Once cleared, you can begin adding
/// new writes and changes, again, that will only be visible once committed.
pub fn clear(&mut self) {
self.inner.as_mut().clear()
}
Expand Down Expand Up @@ -236,10 +232,8 @@ impl<
}
}

impl<
K: Hash + Eq + Clone + Debug + Sync + Send + 'static,
V: Clone + Sync + Send + 'static,
> HashMapReadTxn<'_, K, V>
impl<K: Hash + Eq + Clone + Debug + Sync + Send + 'static, V: Clone + Sync + Send + 'static>
HashMapReadTxn<'_, K, V>
{
pub(crate) fn get_prehashed<Q>(&self, k: &Q, k_hash: u64) -> Option<&V>
where
Expand Down Expand Up @@ -303,10 +297,8 @@ impl<
}
}

impl<
K: Hash + Eq + Clone + Debug + Sync + Send + 'static,
V: Clone + Sync + Send + 'static,
> HashMapReadSnapshot<'_, K, V>
impl<K: Hash + Eq + Clone + Debug + Sync + Send + 'static, V: Clone + Sync + Send + 'static>
HashMapReadSnapshot<'_, K, V>
{
/// Retrieve a value from the tree. If the value exists, a reference is returned
/// as `Some(&V)`, otherwise if not present `None` is returned.
Expand Down Expand Up @@ -375,4 +367,3 @@ impl<
}
}
}

4 changes: 2 additions & 2 deletions src/hashmap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//!
//! This structure is very different to the `im` crate. The `im` crate is
//! sync + send over individual operations. This means that multiple writes can
//! be interleaved atomicly and safely, and the readers always see the latest
//! be interleaved atomically and safely, and the readers always see the latest
//! data. While this is potentially useful to a set of problems, transactional
//! structures are suited to problems where readers have to maintain consistent
//! data views for a duration of time, cpu cache friendly behaviours and
Expand Down Expand Up @@ -99,7 +99,7 @@ impl<K: Hash + Eq + Clone + Debug + Sync + Send + 'static, V: Clone + Sync + Sen
}

/// Commit the changes from this write transaction. Readers after this point
/// will be able to percieve these changes.
/// will be able to perceive these changes.
///
/// To abort (unstage changes), just do not call this function.
pub fn commit(self) {
Expand Down
2 changes: 1 addition & 1 deletion src/hashtrie/asynch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl<K: Hash + Eq + Clone + Debug + Sync + Send + 'static, V: Clone + Sync + Sen
HashTrieWriteTxn<'_, K, V>
{
/// Commit the changes from this write transaction. Readers after this point
/// will be able to percieve these changes.
/// will be able to perceieve these changes.
///
/// To abort (unstage changes), just do not call this function.
pub fn commit(self) {
Expand Down
24 changes: 10 additions & 14 deletions src/hashtrie/impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use std::iter::FromIterator;
/// in time.
///
/// This is achieved through the use of COW or MVCC. As a write occurs
/// subsets of the tree are cloned into the writer thread and then commited
/// subsets of the tree are cloned into the writer thread and then committed
/// later. This may cause memory usage to increase in exchange for a gain
/// in concurrent behaviour.
///
Expand Down Expand Up @@ -57,7 +57,7 @@ where
/// may be modified exclusively through this transaction without affecting
/// readers. The write may be rolledback/aborted by dropping this guard
/// without calling `commit()`. Once `commit()` is called, readers will be
/// able to access and percieve changes in new transactions.
/// able to access and perceive changes in new transactions.
pub struct HashTrieWriteTxn<'a, K, V>
where
K: Hash + Eq + Clone + Debug + Sync + Send + 'static,
Expand All @@ -76,7 +76,7 @@ where
}

/// A point-in-time snapshot of the tree from within a read OR write. This is
/// useful for building other transactional types ontop of this structure, as
/// useful for building other transactional types on top of this structure, as
/// you need a way to downcast both HashTrieReadTxn or HashTrieWriteTxn to
/// a singular reader type for a number of get_inner() style patterns.
///
Expand Down Expand Up @@ -116,20 +116,16 @@ impl<K: Hash + Eq + Clone + Debug + Sync + Send + 'static, V: Clone + Sync + Sen
}
}

impl<
K: Hash + Eq + Clone + Debug + Sync + Send + 'static,
V: Clone + Sync + Send + 'static,
> Extend<(K, V)> for HashTrieWriteTxn<'_, K, V>
impl<K: Hash + Eq + Clone + Debug + Sync + Send + 'static, V: Clone + Sync + Send + 'static>
Extend<(K, V)> for HashTrieWriteTxn<'_, K, V>
{
fn extend<I: IntoIterator<Item = (K, V)>>(&mut self, iter: I) {
self.inner.as_mut().extend(iter);
}
}

impl<
K: Hash + Eq + Clone + Debug + Sync + Send + 'static,
V: Clone + Sync + Send + 'static,
> HashTrieWriteTxn<'_, K, V>
impl<K: Hash + Eq + Clone + Debug + Sync + Send + 'static, V: Clone + Sync + Send + 'static>
HashTrieWriteTxn<'_, K, V>
{
/*
pub(crate) fn prehash<Q>(&self, k: &Q) -> u64
Expand Down Expand Up @@ -195,8 +191,8 @@ impl<
}

/// Reset this map to an empty state. As this is within the transaction this
/// change only takes effect once commited. Once cleared, you can begin adding
/// new writes and changes, again, that will only be visible once commited.
/// change only takes effect once committed. Once cleared, you can begin adding
/// new writes and changes, again, that will only be visible once committed.
pub fn clear(&mut self) {
self.inner.as_mut().clear()
}
Expand Down Expand Up @@ -250,7 +246,7 @@ impl<K: Hash + Eq + Clone + Debug + Sync + Send + 'static, V: Clone + Sync + Sen
pub fn get<Q>(&self, k: &Q) -> Option<&V>
where
K: Borrow<Q>,
Q: Hash + Eq+ ?Sized,
Q: Hash + Eq + ?Sized,
{
let k_hash = self.inner.as_ref().hash_key(k);
self.get_prehashed(k, k_hash)
Expand Down
Loading

0 comments on commit afd64c8

Please sign in to comment.