Skip to content

Commit

Permalink
Add missing docs; rename linked lists to lists since they are not lin…
Browse files Browse the repository at this point in the history
…ked anymore
  • Loading branch information
tomerfiliba committed Aug 19, 2024
1 parent 8ddbd1c commit 6f04522
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 51 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ for res in db.iter() {

assert_eq!(db.iter().count(), 0);

// list API ("linked lists")
// lists API

db.set_in_list("mylist", "key1", "123")?;
db.set_in_list("mylist", "key2", "456")?;
Expand Down Expand Up @@ -160,7 +160,7 @@ existing element requires two IOs, since it needs to compare the key before writ
These IOs may return from the kernel's page cache, in which case it's practically immediate, or from disk,
in which case you can expect it to take 1-2 round-trip times of your device.

Inserting to/removing from a linked-lists require 2-3 IOs, since these operations need to update the list's
Inserting to/removing from a lists require 2-3 IOs, since these operations need to update the list's
head or tail, as well as link/unlink to their previous element. Such operations should really be done with a "large enough page cache".
Updating/fetching an existing element element in a list is a single IO as above.

Expand Down
2 changes: 1 addition & 1 deletion candy-perf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Performance results from my machine
Large entries removal: 0.139us
```

### Linked-lists
### Lists
```
10 collections with 100000 items in each
Inserts: 8.104us
Expand Down
8 changes: 3 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//! table of ~380KB is kept `mmap`-ed (it is also file-backed, so can be evicted if needed). A shard-file can
//! hold around 30K entries, and more shard-files are created as needed.
//!
//! A unique feature of Candy is the support of *linked lists*, which allow creating cheap collections.
//! A unique feature of Candy is the support of *lists*, which allow creating cheap collections.
//!
//! Notes:
//! * the file format is not yet stable!
Expand All @@ -30,7 +30,7 @@
//! db.remove("hello")?;
//! assert_eq!(db.get("hello")?, None);
//!
//! // linked lists
//! // lists
//! db.set_in_list("italian", "bye", "arrivederci")?;
//! db.set_in_list("italian", "thanks", "grazie")?;
//! assert_eq!(db.get_from_list("italian", "bye")?, Some("arrivederci".into()));
Expand All @@ -57,7 +57,7 @@ mod typed;

pub use hashing::HashSeed;
pub use insertion::{GetOrCreateStatus, ReplaceStatus, SetStatus};
pub use lists::{LinkedListIterator, ListCompactionParams};
pub use lists::{ListCompactionParams, ListIterator};
use std::fmt::{Display, Formatter};
pub use store::{CandyStore, CoarseHistogram, SizeHistogram, Stats};
pub use typed::{CandyTypedDeque, CandyTypedKey, CandyTypedList, CandyTypedStore};
Expand All @@ -75,7 +75,6 @@ pub enum CandyError {
CompactionFailed(String),
SplitFailed(String),
LoadingFailed(String),
CorruptedLinkedList(String),
}

impl Display for CandyError {
Expand All @@ -88,7 +87,6 @@ impl Display for CandyError {
Self::EntryCannotFitInShard(sz, max) => {
write!(f, "entry too big ({sz}) for a single shard file ({max})")
}
Self::CorruptedLinkedList(s) => write!(f, "corrupted linked list: {s}"),
Self::CompactionFailed(s) => write!(f, "shard compaction failed: {s}"),
Self::LoadingFailed(s) => write!(f, "loading store failed: {s}"),
Self::SplitFailed(s) => write!(f, "shard split failed: {s}"),
Expand Down
Loading

0 comments on commit 6f04522

Please sign in to comment.