Skip to main content

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, and close

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


Download files

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

Source Distribution

segkv-0.1.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

segkv-0.1.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

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

Hashes for segkv-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5c93924325f746565ec3bb628e46faac66cba612a4c963dc996938da1167acd2
MD5 7d8f57d3092263fa20c8e5e622ac3ee3
BLAKE2b-256 1b43fcbbcbeafbcad8cd774970aac52b092af41f1cfd86a181e57eb983b9bb29

See more details on using hashes here.

Provenance

The following attestation bundles were made for segkv-0.1.0.tar.gz:

Publisher: publish.yml on janettai/segkv

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for segkv-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 83eb7b9ad41ae3dcf043efed8fc7e6a529007d6f413ae7617ac07eef52f39364
MD5 4b29bb7be843e7bde9f2e4b59d221f32
BLAKE2b-256 7d34668c3dbf6b1695a4617b2138e29f0f920deec4981bfc6e54036fd164820d

See more details on using hashes here.

Provenance

The following attestation bundles were made for segkv-0.1.0-py3-none-any.whl:

Publisher: publish.yml on janettai/segkv

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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