Exporting data from Riak KV in order to let Android read it offline

Luca Favatella luca.favatella at erlang-solutions.com
Tue Nov 29 06:11:56 EST 2016


On 7 November 2016 at 16:07, Luca Favatella
<luca.favatella at erlang-solutions.com> wrote:
>
> Hi All,
>
> What file format easy to read on an Android mobile device would you recommend for representing a snapshot of part of a live Riak KV store? The main aim is minimizing development effort on the Android device while keeping battery consumption reasonable.
>
>
> As Riak KV can be defined as a key-value store with key being any arbitrary byte sequence and value being any [MIME-typed][1] arbitrary byte sequence, I see that any Android-friendly file format / library for reading any such export needs to:
> * Be key-value; and
> * Be able to return the value and its MIME type.
>
> [1]: Even values with siblings [can][2] be represented with MIME type.
> [2]: http://docs.basho.com/riak/kv/2.1.4/developing/api/http/fetch-object/#get-all-siblings-in-one-request
>
> Some of the alternative file formats include:
> * A. SQLite, with columns key (the same as in Riak KV), mime type and value - respectively of types TEXT, TEXT and BLOB;
> * B. Archive (e.g. tar, zip) containing file paths corresponding to exported Riak KV keys, with file content being the Riak KV [HTTP GET response][3] - that includes MIME type and body;
> * C. Archived (because potentially multi-file) LevelDB database, with the key being the Riak KV key and the value being the Riak KV [HTTP GET response][3] - that includes MIME type and body. (Based on a quick search there is some code for LevelDB on Android.)
> Storing the HTTP GET response require the Android application to parse it for extracting the MIME type and the actual value. (I assume there is some HTTP parser Android library).
>
> [3]: http://docs.basho.com/riak/kv/2.1.4/developing/api/http/fetch-object/#simple-example

Hi,

Just an update for letting you know that my current plan is exploiting
the HTTP 1.1 standardized caching semantics (RFC 7234) and an HTTP
cache on Android (initially class `HttpResponseCache`).

The mobile device would send HTTP GET request to a front-end HTTP
service hiding Riak KV (HTTP or PB), and would cache the responses
locally for offline reading.

(This solution requires changes to the functional specifications of
the project I am working on so I had not listed it as an alternative.)

Regards
Luca




More information about the riak-users mailing list