Yes it is very easy. Please see the disk_ops type in the API.
(** Disk operations: read, write, and sync *)
type 't disk_ops = {
block_size: BLK.sz;
read: BLK.r -> (BLK.t,'t) m;
write: BLK.r -> BLK.t -> (unit,'t) m;
disk_sync: unit -> (unit,'t) m;
}
Also the disk_to_store function, and store_to_map. So if you have a
disk_ops (or store_ops) you can get a map_ops. But really this is a B-tree
library. More work needs to be done to get an efficient KV store, or
filesystem or whatever. But yes, it is already done - I looked at the
Mirage block interface a while ago and it seems reasonable and close to
what disk_ops assumes (which isn't much).
BTW what was confusing about the structure? Did you read the overview?
https://tomjridge.github.io/tjr_btree/Tjr_btree_doc.html
Thanks for your interest!
T
On 5 May 2017 3:50 pm, "Mindy" <[email protected]> wrote:
On 05/04/2017 03:24 AM, Tom Ridge wrote:
> tjr_btree is a B-tree library written in OCaml. The examples include a
> simple on-disk key-value store.
>
> https://github.com/tomjridge/tjr_btree
>
> [snip]
>
Hi Tom,
Thanks for the announcement! I'm trying to navigate the repository to
figure out what alternatives there are to `from_file` and I have to admit
that I'm a bit confused by the structure. Rather than ask specific
questions about finding things here, perhaps I'll ask my question directly:
Is it possible to use this library on top of an arbitrary module
implementing the Mirage_block_lwt.S signature?
-Mindy
_______________________________________________
MirageOS-devel mailing list
[email protected]
https://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel
_______________________________________________
MirageOS-devel mailing list
[email protected]
https://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel