Skip to main content

No project description provided

Project description

Wind-KVStore Python SDK

License Python Rust

A Python wrapper for a high-performance Rust-based key-value storage engine, providing a stable and reliable data persistence solution.

Project Structure

wind-kvstore-lib/
├── Cargo.toml          # Rust project configuration
├── pyproject.toml      # Python packaging configuration
├── src/
│   ├── lib.rs          # PyO3 module entry point
│   └── kvstore.rs      # Core storage engine implementation
└── wind_kvcore/
    ├── __init__.py     # Package exports
    ├── WindKVCore.py   # Python wrapper class
    └── wind_kvcore.pyi # Type hint file

Requirements

System Requirements

  • Operating Systems: Windows, Linux, macOS
  • Python: 3.10 or higher
  • Rust Toolchain: Required for compiling from source

Required Tools

  1. Python 3.10+

  2. Rust Toolchain

    # Install Rust
    sudo snap install rustup
    
  3. Maturin

    pip install maturin
    

Installation

Building from Source

  1. Clone the project:
git clone https://github.com/starwindv/wind-kvstore-lib
cd wind-kvstore-lib
  1. Build and install using maturin:
maturin build
pip install target/wheels/wind_kvcore-*.whl

Usage

Basic Operations

from wind_kvcore import WindKVCore

# Open database (creates if it doesn't exist)
with WindKVCore("./mydatabase.db") as db:
    # Store data
    db.put(b"key1", b"value1")
    db.put(b"key2", b"value2")
    
    # Read data
    value = db.get(b"key1")
    print(f"key1: {value}")  # Output: b'value1'
    
    # Delete data
    db.delete(b"key2")
    
    # Get all key-value pairs
    all_data = db.get_all()
    for item in all_data:
        print(f"{item['key']}: {item['value']}")

Database Identifier Management

# Specify identifier during creation
db = WindKVCore("./data.db", "my_database")

# Or set identifier later
db.set_identifier("new_identifier")
current_id = db.get_identifier()
print(f"Current database identifier: {current_id}")

Performance Optimization

# Use context manager to ensure proper resource cleanup
with WindKVCore("./data.db") as db:
    # Perform operations...
    pass

API Reference

WindKVCore Class

Initialization

WindKVCore(path: str, db_identifier: Optional[str] = None)

Main Methods

  • get(key: bytes) -> Optional[bytes] - Get value by key
  • put(key: bytes, value: bytes) -> None - Store or update key-value pair
  • delete(key: bytes) -> None - Delete key-value pair
  • get_all() -> List[Dict[str, str]] - Get all key-value pairs
  • compact() -> None - Compact database to optimize performance
  • set_identifier(identifier: str) -> None - Set database identifier
  • get_identifier() -> str - Get current database identifier
  • close() -> None - Close database connection

License

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

Original Project

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wind_kvcore-0.0.2.tar.gz (35.7 kB view details)

Uploaded Source

File details

Details for the file wind_kvcore-0.0.2.tar.gz.

File metadata

  • Download URL: wind_kvcore-0.0.2.tar.gz
  • Upload date:
  • Size: 35.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.6

File hashes

Hashes for wind_kvcore-0.0.2.tar.gz
Algorithm Hash digest
SHA256 8b4b6afa7fbe46c94949ab358d0a8acea9ca8dddb776e1940feaa1ca29d97b45
MD5 24640ada4e2c5d56454895553111af68
BLAKE2b-256 14200da786d3ef45b7dd251a9cc077461ff10ded84c63c538cfe0e81433eddca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page