Reverbrain wiki

Site Tools


thevoid:elliptics

TheVoid Elliptics Proxy

Elliptics Proxy is highly-customizable HTTP frontend for Elliptics storage.

Currently it supports following handlers:

Handlers

on_get

Simply reads data from storage and returns result to client.

Query parameters:

  • name - key to read from
  • id - read data by specified hex-encoded id instead of name
  • offset - offset from file's start
  • size - read no more than size bytes

This handler supports Range requests according to RFC 2616.

on_download_info

Perform lookup request to storage and returns result encoded as JSON to client.

Query parameters:

  • name - key to read from

Example of result:

{
    "id": "a5c12c102bdaed8ee80168cb41606295eaf5512ba04045fac5dd0dc65c2f54f13566090025c05f14cdfdf9b1e39ce835c6f3262a4aedba31f8b6d07ed299b23b",
    "csum": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "filename": "/tmp/blob/data-0.0",
    "size": 37,
    "offset-within-data-file": 13717,
    "mtime": {
        "time": "2013-10-23 MSK 14:43:25.000000",
        "time-raw": "1382525005.0"
    },
    "server": "127.0.0.1:1025",
    "signature": "feeaa1f8016b02057505b62ff883121ea9e2b33ae567abdbc6689cbaf449b67c0329503247b4f67610dfdd85c6eacfd768f31fdb161b3078e4e0b58823350e1a",
    "time": "1382543029"
}

on_redirectable_get

Perform lookup request to storage and redirects by 302 code and “Location” headers directly to server where data is stored.

It's a good way for streaming by nginx.

For security reasons handler also generates signature based on the url and secret key passed by the configuration file.

Let's suggest that the final url is https://example.org:8080/?arg1=value&arg2=value&arg3=value&time=129324295&signature=a4f… Signature is generated from this url by removing “signature” query item and adding “key=${secret_key}” by it's lexicographical order into query list. Produced url is hashed by sha512 algorithm and this is signature value.

Query parameters:

  • name - key to read from

on_upload

Write file to storage.

Query parameters:

  • name - key to write into
  • id - read data by specified hex-encoded id instead of name
  • offset - write into file by offset
  • prepare - prepare enough space for next plain-write and commit commands and write first chunk
  • plain-write - write chunk to file
  • commit - finish serial of plain-write commands, must be equal to final file size

Returns JSON with information where file is written to:

{
    "info": [
        {
            "id": "a5c12c102bdaed8ee80168cb41606295eaf5512ba04045fac5dd0dc65c2f54f13566090025c05f14cdfdf9b1e39ce835c6f3262a4aedba31f8b6d07ed299b23b",
            "csum": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
            "filename": "/tmp/blob/data-0.0",
            "size": 37,
            "offset-within-data-file": 13717,
            "mtime": {
                "time": "2013-10-23 MSK 14:43:25.000000",
                "time-raw": "1382525005.0"
            },
            "server": "127.0.0.1:1025"
        }
    ],
    "time": "1382525005"
}
thevoid/elliptics.txt · Last modified: 2013/10/23 21:02 by elessar