|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [MirageOS-devel] Binary Irmin slices
I'm trying to sync an Irmin repository from some js_of_ocaml to a
native Mirage server. It was working with JSON briefly, except that my
repository grew enough that to_json now results in a StackOverflow, so
I'm trying the binary protocol instead. However, reading the data back
seems to fail. I'm guessing a bit how the Tc API works, but this is
what I tried:
open Lwt
module Store = Irmin.Basic(Irmin_mem.Make)(Irmin.Contents.String)
let config = Irmin_mem.config ()
let task s = Irmin.Task.create ~date:0L ~owner:"User" s
let main =
Store.create config task >>= fun t ->
let t = t "test" in
Store.update t ["key"] "value" >>= fun () ->
Store.head t >>= function
| None -> assert false
| Some head ->
Store.export t ~min:[] ~max:[head] >>= fun slice ->
let buf = Cstruct.create (Store.Private.Slice.size_of slice) in
let rest = Store.Private.Slice.write slice buf in
assert (Cstruct.len rest = 0);
let _slice2 = Store.Private.Slice.read (Mstruct.of_cstruct buf) in
return ()
let () =
Lwt_main.run main
I was expecting _slice2 to be the same as slice, but instead I get an
error during the read (even in native code):
Fatal error: exception Ir_hash.Invalid("lueB+ïï1d|EïïïOïï<ïïkey")
Should this work, or have I misunderstood the API?
Thanks,
--
Dr Thomas Leonard http://roscidus.com/blog/
GPG: DA98 25AE CAD0 8975 7CDA BD8E 0713 3F96 CA74 D8BA
_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |