[Haskell-cafe] Persisting a Map

Conrad Parker conrad at metadecks.org
Thu Dec 19 03:24:20 UTC 2013

On 19 December 2013 11:58, Andrew Cowie <andrew at operationaldynamics.com>wrote:

> I have a Map. It's a lovely Map, with keys and values and everything.
> It's not _that_ large. Few 10s of MB at most. Unfortunately, I need to
> persist it somewhat reliably.
> I'd somewhat like to avoid having to use an external database (obviously
> a key/value store like Riak would work, but that's a major dependency to
> impose on the system) so I'm wondering if there is a low tech way to do
> this.
> I can control concurrent access to the file (or whatever), and the file
> system is robust. So that part is fine. I just need to externalize the
> map.
> I'm wondering if just using cereal or so would be sufficient (there is a
> Serialize instance, of course), or whether I should be using some
> acid-state thing, or a Haskell binding to gdbm,  or sqlite, or...
> Any suggestions?

Do you need concurrent access to the on-disk map, or will you just load,
modify, then store explicitly?

Do you care about data corruption, eg. if your program/hardware fails
during writing?

I'd probably just use sqlite via something like esqueleto, because it's
easy to inspect the stored data outside of your program.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20131219/28403444/attachment.html>

More information about the Haskell-Cafe mailing list