No project description provided
Project description
Wind-KVStore Python SDK
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
-
Python 3.10+
-
Rust Toolchain
# Install Rust sudo snap install rustup
-
Maturin
pip install maturin
Installation
Building from Source
- Clone the project:
git clone https://github.com/starwindv/wind-kvstore-lib
cd wind-kvstore-lib
- 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 keyput(key: bytes, value: bytes) -> None- Store or update key-value pairdelete(key: bytes) -> None- Delete key-value pairget_all() -> List[Dict[str, str]]- Get all key-value pairscompact() -> None- Compact database to optimize performanceset_identifier(identifier: str) -> None- Set database identifierget_identifier() -> str- Get current database identifierclose() -> None- Close database connection
License
This project is licensed under the MIT License - see the LICENSE file for details.
Original Project
- Project Homepage: GitHub Repository
- Author: StarWindv
Project details
Release history Release notifications | RSS feed
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)
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b4b6afa7fbe46c94949ab358d0a8acea9ca8dddb776e1940feaa1ca29d97b45
|
|
| MD5 |
24640ada4e2c5d56454895553111af68
|
|
| BLAKE2b-256 |
14200da786d3ef45b7dd251a9cc077461ff10ded84c63c538cfe0e81433eddca
|