Skip to content

naimjeem/rustore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rustore 🚀

A production-ready, high-performance key-value store written in Rust with advanced features including transactions, multiple serialization formats, and comprehensive CLI tools.

Features ✨

  • High Performance: Optimized for speed with multiple storage backends
  • Transaction Support: ACID-compliant transactions with rollback capabilities
  • Multiple Serialization Formats: JSON, Bincode, and MessagePack support
  • Flexible Storage: In-memory and persistent file-based storage
  • Comprehensive CLI: Full-featured command-line interface with interactive mode
  • Configuration Management: TOML config files and environment variable support
  • Structured Logging: Built-in logging with configurable levels
  • Import/Export: JSON import/export functionality
  • Backup & Restore: Built-in backup and restore capabilities
  • Cross-Platform: Works on Windows, macOS, and Linux

Installation 📦

From Source

git clone https://github.com/naimjeem/rustore.git
cd rustore
cargo build --release

Using Cargo

cargo install rustore

Quick Start 🚀

Basic Operations

# Set a key-value pair
rustore set mykey "Hello, World!"

# Get a value
rustore get mykey

# Delete a key
rustore delete mykey

# List all keys
rustore list

# Show database statistics
rustore stats

Interactive Mode

rustore interactive

Using Different Formats

# Use JSON format
rustore --format json set key "value"

# Use MessagePack format
rustore --format msgpack set key "value"

Configuration ⚙️

Configuration File

Create a rustore.toml file:

database_path = "my_database.db"
serialization_format = "bincode"  # json, bincode, msgpack
compression = false
cache_size_mb = 100
wal_enabled = true
sync_frequency = 30
indexing_enabled = true
log_level = "info"

Environment Variables

export RUSTORE_DB_PATH="/path/to/database.db"
export RUSTORE_FORMAT="json"
export RUSTORE_CACHE_SIZE="200"
export RUST_LOG="debug"

CLI Commands 📋

Core Commands

  • set <key> <value> - Set a key-value pair
  • get <key> - Get a value by key
  • delete <key> - Delete a key
  • exists <key> - Check if key exists
  • list - List all keys
  • list-all - List all key-value pairs
  • stats - Show database statistics

Advanced Commands

  • interactive - Start interactive session
  • import <file> - Import from JSON file
  • export <file> - Export to JSON file
  • compact - Compact the database
  • backup <file> - Create backup
  • restore <file> - Restore from backup

Options

  • --database, -d <path> - Database file path (default: rustore.db)
  • --config, -c <path> - Configuration file path
  • --format, -f <format> - Serialization format (json, bincode, msgpack)
  • --verbose, -v - Enable verbose logging

Programmatic Usage 💻

use rustore::{Database, Config};

// Create a new database
let config = Config::default();
let db = Database::new(config)?;

// Basic operations
db.set("key", "value")?;
let value = db.get("key")?;
db.delete("key")?;

// Transactions
let tx_id = db.begin_transaction()?;
db.set_in_transaction(tx_id, "key", "value")?;
db.commit_transaction(tx_id)?;

// Statistics
let stats = db.stats()?;
println!("{}", stats);

Performance 🏃‍♂️

Rustore is designed for high performance:

  • Memory Storage: Sub-microsecond operations
  • File Storage: Optimized for concurrent access
  • Serialization: Multiple formats optimized for different use cases
  • Transactions: Efficient transaction management

Run benchmarks:

cargo bench

Testing 🧪

# Run all tests
cargo test

# Run integration tests
cargo test --test integration_tests

# Run with coverage
cargo test --features coverage

Contributing 🤝

Contributions are welcome! Please see our Contributing Guide for details.

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

License 📄

This project is licensed under the MIT License - see the LICENSE file for details.

Changelog 📝

See CHANGELOG.md for a list of changes and version history.

Support 💬

Roadmap 🗺️

  • Distributed storage support
  • REST API server
  • WebSocket support
  • Advanced indexing
  • Compression support
  • Encryption at rest
  • Replication
  • Clustering support

Made with ❤️ by Naim Jeem

About

key value store database in rust

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages