Skip to content

Commit

Permalink
chore: address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
arriqaaq committed Jan 3, 2024
1 parent 5cb4c22 commit 3701038
Show file tree
Hide file tree
Showing 17 changed files with 164 additions and 340 deletions.
30 changes: 18 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
# surrealkv
# surrealkv - Readme

surrealkv is a versioned, low-level, embedded, key-value database in rust. It persists to disk, is ACID compliant, and supports multiple readers and writers.
**Note: This project is actively in development. Expect ongoing changes to the file format, APIs, or features until the project reaches stability in future releases.**

[![](https://img.shields.io/badge/license-Apache_License_2.0-00bfff.svg?style=flat-square)](https://github.com/surrealdb/surrealkv)
surrealkv is a versioned, low-level, embedded, key-value database implemented in Rust. It operates as an in-memory database, is embeddable, and boasts ACID compliance with support for multiple readers and writers.

[![License](https://img.shields.io/badge/license-Apache_License_2.0-00bfff.svg?style=flat-square)](https://github.com/surrealdb/surrealkv)

## Features

Features
========
- **In-memory Database:**
- **Embeddable:**
- **ACID Semantics:**
- **Rich Transaction Support:**
- **Built-in Item Versioning:** [TODO]
- **Multi-Version Concurrency Control (MVCC):**
- **Multiple Concurrent Readers and Writers:**
- **Durable Append-only File Format:**

- In-memory database
- Embeddable
- ACID semantics with rich transaction support with rollbacks
- Built-in item versioning
- Multi-version concurrency control
- Multiple concurrent readers and writers
- Durable append-only file format for persistence (with WAL support)
## Important Notice

This project is actively evolving, and as such, there might be changes to the file format, APIs, and feature set in future releases until reaching stability. Developers are encouraged to stay informed about updates and review release notes for any breaking changes.

Feel free to contribute, provide feedback, or report issues to help shape the future of surrealkv. Thank you for your interest and involvement in this project!
133 changes: 0 additions & 133 deletions examples/hit_ratio.rs

This file was deleted.

22 changes: 12 additions & 10 deletions src/storage/cache/s3fifo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ where
}
}


/// Cache is an implementation of "S3-FIFO" from "FIFO Queues are ALL You Need for Cache Eviction" by
/// Juncheng Yang, et al: https://jasony.me/publication/sosp23-s3fifo.pdf
pub struct Cache<K, V>
Expand All @@ -72,7 +71,6 @@ where
{
/// Creates a new cache with the given maximum size.
pub fn new(max_cache_size: usize) -> Self {
assert!(max_cache_size > 0);
let max_small_size = max_cache_size / 10;
let max_main_size = max_cache_size - max_small_size;

Expand Down Expand Up @@ -185,17 +183,21 @@ mod tests {
fn test_push_removes_oldest() {
let mut cache = Cache::new(2);

cache.insert("apple", "red");
cache.insert("banana", "yellow");
cache.insert("orange", "orange");
cache.insert("pear", "green");
cache.insert("tomato", "red");
let fruits = vec![
("apple", "red"),
("banana", "yellow"),
("orange", "orange"),
("pear", "green"),
("peach", "pink"),
];

for (fruit, color) in fruits {
cache.insert(fruit, color);
}

assert!(cache.get(&"apple").is_none());
// assert!(cache.get(&"banana").is_none());
// assert!(cache.get(&"orange").is_none());
assert_opt_eq(cache.get(&"pear"), "green");
assert_opt_eq(cache.get(&"tomato"), "red");
assert_opt_eq(cache.get(&"peach"), "pink");

// "apple" should been removed from the cache.
cache.insert("apple", "red");
Expand Down
Loading

0 comments on commit 3701038

Please sign in to comment.