A log-structured storage engine with compaction for Python
Project description
lsdb
A log-structured storage engine with compaction for Python.
Installation
pip install lsdb
Quick Start
from lsdb import LSDB
# Create a database
db = LSDB(base_dir="./data")
# Write data
db.set("user:1", '{"name": "Alice", "age": 30}')
# Read data
value = db.get("user:1")
# Delete data
db.delete("user:1")
# Get statistics
stats = db.stats()
# Close when done
db.close()
Features
- Append-only writes: All writes are appended to log files for durability
- Hash index: In-memory index for O(1) key lookups
- Automatic compaction: Background thread merges segments and removes deleted entries
- Crash recovery: Index rebuilt from segments on startup
- Simple API: Just
set,get,delete, andclose
Configuration
db = LSDB(
base_dir="./data", # Directory for data files
segment_size=1024*1024, # Max segment size in bytes (default: 1MB)
auto_compact=True, # Enable automatic compaction
compact_threshold=5, # Number of segments before compaction triggers
)
License
MIT
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file segkv-0.1.0.tar.gz.
File metadata
- Download URL: segkv-0.1.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c93924325f746565ec3bb628e46faac66cba612a4c963dc996938da1167acd2
|
|
| MD5 |
7d8f57d3092263fa20c8e5e622ac3ee3
|
|
| BLAKE2b-256 |
1b43fcbbcbeafbcad8cd774970aac52b092af41f1cfd86a181e57eb983b9bb29
|
Provenance
The following attestation bundles were made for segkv-0.1.0.tar.gz:
Publisher:
publish.yml on janettai/segkv
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
segkv-0.1.0.tar.gz -
Subject digest:
5c93924325f746565ec3bb628e46faac66cba612a4c963dc996938da1167acd2 - Sigstore transparency entry: 811633442
- Sigstore integration time:
-
Permalink:
janettai/segkv@88d21c6a8f9fd090052fc80bac3f856281ed1f3c -
Branch / Tag:
refs/heads/main - Owner: https://github.com/janettai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@88d21c6a8f9fd090052fc80bac3f856281ed1f3c -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file segkv-0.1.0-py3-none-any.whl.
File metadata
- Download URL: segkv-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83eb7b9ad41ae3dcf043efed8fc7e6a529007d6f413ae7617ac07eef52f39364
|
|
| MD5 |
4b29bb7be843e7bde9f2e4b59d221f32
|
|
| BLAKE2b-256 |
7d34668c3dbf6b1695a4617b2138e29f0f920deec4981bfc6e54036fd164820d
|
Provenance
The following attestation bundles were made for segkv-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on janettai/segkv
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
segkv-0.1.0-py3-none-any.whl -
Subject digest:
83eb7b9ad41ae3dcf043efed8fc7e6a529007d6f413ae7617ac07eef52f39364 - Sigstore transparency entry: 811633478
- Sigstore integration time:
-
Permalink:
janettai/segkv@88d21c6a8f9fd090052fc80bac3f856281ed1f3c -
Branch / Tag:
refs/heads/main - Owner: https://github.com/janettai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@88d21c6a8f9fd090052fc80bac3f856281ed1f3c -
Trigger Event:
workflow_dispatch
-
Statement type: