erebor


Nameerebor JSON
Version 2.0.6 PyPI version JSON
download
home_pageNone
Summarykey-value store
upload_time2024-11-06 21:50:48
maintainerNone
docs_urlNone
authorChris Varga
requires_pythonNone
licenseNone
keywords erebor persistent key-value store
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # erebor
Erebor is a lightweight key-value store with a Redis-like syntax.

## Installation
To install the erebor server:
```bash
pip install erebor
```

## Usage
Run the server like so:
```bash
$ erebor
```

You can verify erebor is running by connecting to 127.0.0.1:8044.
```bash
$ nc localhost 8044
keys
[]
set foo bar
OK
keys
["foo"]
get foo
bar
set thorin:food lembas
OK
set thorin:weapon Orcrist
OK
json thorin:
{"food":"lembas","weapon":"Orcrist"}
```

## API
Erebor recognizes the following commands:
```
    set   <key> <value>  set a key to a value
    del   <key>          remove a key and its value
    get   <key>          retrieve the value of a key
    keys  [prefix]       return a list of keys starting with prefix
    json  <prefix>       return json with matching key prefix trimmed
```

## Configuration
By default, erebor listens on 127.0.0.1:8044. You can change this as follows:

```bash
$ erebor -b 0.0.0.0 -p 8055
```

For security reasons, it is not recommended to bind on 0.0.0.0 and expose the
database to the world.

By default, erebor runs in ephemeral mode, where keys are only stored in memory.
To run in durable mode, simply specify the `-d` option:

```bash
$ erebor -d /path/to/database
```

This will save the database to disk at the specified path.

## Other notes
The erebor API uses vanilla TCP sockets, so you can make API requests using `netcat`.
```bash
$ echo "set home $(cat index.html)" | nc -q 0 localhost 8044
OK
```

You can also talk to erebor programmatically using any language that can speak TCP:
```python
import socket

# Setup a socket to the host and port where erebor is running.
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("127.0.0.1", 8044))

def erebor(message):
    sock.send(message.encode())
    return sock.recv(1024).decode().strip()

print(erebor("set foo bar"))
# OK
print(erebor("get foo"))
# bar
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "erebor",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "erebor persistent key-value store",
    "author": "Chris Varga",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/4a/22/c72c576f2595ef2c1a79f129f73adb421eed3d33b60c98c4104807340c5f/erebor-2.0.6.tar.gz",
    "platform": null,
    "description": "# erebor\nErebor is a lightweight key-value store with a Redis-like syntax.\n\n## Installation\nTo install the erebor server:\n```bash\npip install erebor\n```\n\n## Usage\nRun the server like so:\n```bash\n$ erebor\n```\n\nYou can verify erebor is running by connecting to 127.0.0.1:8044.\n```bash\n$ nc localhost 8044\nkeys\n[]\nset foo bar\nOK\nkeys\n[\"foo\"]\nget foo\nbar\nset thorin:food lembas\nOK\nset thorin:weapon Orcrist\nOK\njson thorin:\n{\"food\":\"lembas\",\"weapon\":\"Orcrist\"}\n```\n\n## API\nErebor recognizes the following commands:\n```\n    set   <key> <value>  set a key to a value\n    del   <key>          remove a key and its value\n    get   <key>          retrieve the value of a key\n    keys  [prefix]       return a list of keys starting with prefix\n    json  <prefix>       return json with matching key prefix trimmed\n```\n\n## Configuration\nBy default, erebor listens on 127.0.0.1:8044. You can change this as follows:\n\n```bash\n$ erebor -b 0.0.0.0 -p 8055\n```\n\nFor security reasons, it is not recommended to bind on 0.0.0.0 and expose the\ndatabase to the world.\n\nBy default, erebor runs in ephemeral mode, where keys are only stored in memory.\nTo run in durable mode, simply specify the `-d` option:\n\n```bash\n$ erebor -d /path/to/database\n```\n\nThis will save the database to disk at the specified path.\n\n## Other notes\nThe erebor API uses vanilla TCP sockets, so you can make API requests using `netcat`.\n```bash\n$ echo \"set home $(cat index.html)\" | nc -q 0 localhost 8044\nOK\n```\n\nYou can also talk to erebor programmatically using any language that can speak TCP:\n```python\nimport socket\n\n# Setup a socket to the host and port where erebor is running.\nsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\nsock.connect((\"127.0.0.1\", 8044))\n\ndef erebor(message):\n    sock.send(message.encode())\n    return sock.recv(1024).decode().strip()\n\nprint(erebor(\"set foo bar\"))\n# OK\nprint(erebor(\"get foo\"))\n# bar\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "key-value store",
    "version": "2.0.6",
    "project_urls": null,
    "split_keywords": [
        "erebor",
        "persistent",
        "key-value",
        "store"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "be039e98ffe1ba647a0cfbb11055aa0cc17e35f31fc70c059810f12b1ba8d1b1",
                "md5": "0704228076983d12e3a043ab571d42d6",
                "sha256": "c7e11cec37fd29718715e9efa55ebf9d84266417089d76f3cab84890a8be6cc9"
            },
            "downloads": -1,
            "filename": "erebor-2.0.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0704228076983d12e3a043ab571d42d6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 3692,
            "upload_time": "2024-11-06T21:50:47",
            "upload_time_iso_8601": "2024-11-06T21:50:47.269797Z",
            "url": "https://files.pythonhosted.org/packages/be/03/9e98ffe1ba647a0cfbb11055aa0cc17e35f31fc70c059810f12b1ba8d1b1/erebor-2.0.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4a22c72c576f2595ef2c1a79f129f73adb421eed3d33b60c98c4104807340c5f",
                "md5": "7cd99e9e7ed74de3a7a479b2a25b68dd",
                "sha256": "df3deff91676f794924e8243464ce27eee3061a0edf699d9da2222b5e07180f9"
            },
            "downloads": -1,
            "filename": "erebor-2.0.6.tar.gz",
            "has_sig": false,
            "md5_digest": "7cd99e9e7ed74de3a7a479b2a25b68dd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3488,
            "upload_time": "2024-11-06T21:50:48",
            "upload_time_iso_8601": "2024-11-06T21:50:48.649446Z",
            "url": "https://files.pythonhosted.org/packages/4a/22/c72c576f2595ef2c1a79f129f73adb421eed3d33b60c98c4104807340c5f/erebor-2.0.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-06 21:50:48",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "erebor"
}
        
Elapsed time: 0.53482s