https://github.com/rezkam/kashk
high-performance, persistent key-value storage engine
https://github.com/rezkam/kashk
go keyvaluestore persistent-storage
Last synced: 3 months ago
JSON representation
high-performance, persistent key-value storage engine
- Host: GitHub
- URL: https://github.com/rezkam/kashk
- Owner: rezkam
- License: gpl-2.0
- Created: 2023-09-05T01:48:06.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-14T07:06:14.000Z (about 2 years ago)
- Last Synced: 2025-04-10T02:53:12.333Z (9 months ago)
- Topics: go, keyvaluestore, persistent-storage
- Language: Go
- Homepage:
- Size: 71.3 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Kashk Storage
## Overview
Kashk Storage contains a versatile and configurable key-value storage engine written in Go. The engine offers efficient key-value storage, retrieval, and deletion operations, optimized for concurrency and featuring automatic size-based data file rotation.
## Features
- **Put Key-Value Pairs**: Efficiently put key-value pairs into the storage file, almost similar to the performance of writing to a file.
- **In-Memory Indexing**: Utilizes an in-memory index for quick data retrieval.
- **Thread-Safe**: It provides safe concurrent read and write access via a read-write mutex.
- **Read Values by Key**: Retrieve values quickly using an in-memory index.
- **Delete Key-Value Pairs**: Efficiently delete key-value pairs by marking them with a tombstone value.
- **Customizable File Size**: Set the maximum size for each log file. A new file will be used when the current one exceeds this limit.
- **Customizable Key Size**: Control the maximum allowed size for keys.
- **Customizable File Names**: You can set the name for the data file.
- **Customizable Tombstone Value**: You can define the tombstone value for marking deleted entries.
## Getting Started
### Installation
1. Clone this repository or download the source code.
2. Create a data and give the user permission to read and write to it.
### Usage
Here's how to create a new storage engine and use its features:
```go
import "path-to-storage-package/storage"
// Initialize a new storage engine with default settings
engine, err := storage.NewEngine("./data-path/")
if err != nil {
log.Fatal("Failed to initialize engine:", err)
}
// Initialize with options
engine, err := storage.NewEngine("./data-path/",
storage.WithMaxLogSize(10 * storage.MB),
storage.WithMaxKeySize(1 * storage.KB),
storage.WithTombStone("custom_tombstone")
)
if err != nil {
log.Fatal("Failed to initialize engine with options:", err)
}
// Put a key-value pair
err = engine.Put("name", "John Doe")
if err != nil {
log.Fatal("Failed to append key-value pair:", err)
}
// Read a value back
value, err := engine.Get("name")
if err != nil {
log.Fatal("Failed to get value:", err)
}
// Delete a key-value pair
err = engine.Delete("name")
if err != nil {
log.Fatal("Failed to delete key-value pair:", err)
}