Skip to main content

Hashable storage on disk

Project description

MappingOnDisk

An effort to make a map system which can be stored on hard disk/SSDs and other non voletile media.

Installation

pip install mapdisk

Usage

from mapDisk import mapDisk

create the hashed map file object md = mapDisk.MapD("HashMapName.md","path/to/file")

"HashMapName.mpd" is the name of the database file, it is created if it does not already exists and read otherwise path/to/file is "." by default

Adding key-value pairs

md.add("key","value")

key and value are converted to string and then stored for current implementation, returns the value stored for validating written data the same function is used to overwrite the previous data/value

Reading value

md.read(str("key))

returns the value in string format, only catch is if the value contains \x00 at the end it will be trimmed off for current implementation as a temporary fix

Deleting value

md.delete(str(key))

deletes the key-value from datafile

md.shrink()

can be called to shrink datafile if some delete operations are performed, isn't called by default after delete operation.

md.close()

It should be called at the end of data operations to close file descriptors

The above operations return None if they fail for some reason, this can be used to check for failures

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

mapdisk-0.0.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

mapdisk-0.0.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file mapdisk-0.0.1.tar.gz.

File metadata

  • Download URL: mapdisk-0.0.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for mapdisk-0.0.1.tar.gz
Algorithm Hash digest
SHA256 2d3eee6633a54eea7242dc464ed5b28ffaaa219d3e1cb07b26cf9c69e3ddeb81
MD5 eb52658b6229f61b5d6d950691166a40
BLAKE2b-256 1842b9def1b2c92168b231112a94eb01819006a9745a143b87d43a34251683ea

See more details on using hashes here.

File details

Details for the file mapdisk-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: mapdisk-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for mapdisk-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e9ac378ae61de334724204fe1e49e30e1b22e65e7ac15f77e843d96f404a6689
MD5 2a2bfe522c1ae2ff83bb6f389c433351
BLAKE2b-256 a5e03e42b2c36da7eaa88debf1c46be17f29452da3f08d5eb0318cf8bb016e98

See more details on using hashes here.

Supported by

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