[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MirageOS-devel] Marshal data to a simple FS store?



Hello MirageOS!

I’m working on a simple application that accepts a form post, parses the input, 
and then adds the info into a list of records. Once I have this list of 
records, I’m planning on writing it out to a file using the FS interface, 
here’s the function I’ve written:


    module Main ... (Store:V1_LWT.FS) ... = struct

      (* "rides" is a list of records {name:string; distance:float; 
date:string} *)
      let save_rides store rides =
        let bytestring = Marshal.to_string rides [Marshal.Compat_32] in
        let data = Cstruct.of_string bytestring in
        Store.write store "rides" 0 data    

    end

In my config.ml, I was unsure of how to initialize this storage. I did this:

let store = fat_of_files ~dir:"store" ()

And when I actually attempt to run this, I get:

Error handling ((headers
  ((accept
    
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
   (accept-encoding "gzip, deflate, br") (accept-language "en-US,en;q=0.8")
   (cache-control max-age=0) (connection keep-alive) (content-length 40)
   (content-type application/x-www-form-urlencoded)
   (cookie
    "__utma=111872281.931257022.1477157625.1477157625.1477256296.2; 
__utmz=111872281.1477157625.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)")
   (host localhost:8080) (origin http://localhost:8080)
   (referer http://localhost:8080/) (upgrade-insecure-requests 1)
   (user-agent
    "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, 
like Gecko) Chrome/54.0.2840.71 Safari/537.36")))
 (meth POST) (resource /add) (version HTTP_1_1) (encoding (Fixed 40))): 
Fat.Fs.Make(B)(M).Fs_error(_)

I'm assuming the problem lies in the "Fat.Fs.Make(B)(M).Fs_error(_)" message at 
the end & I've been able to determine that the FS error is 
`Format_not_recognized. I'm assuming that I have to initialize a FAT filesystem 
image to use, but I'm not quite sure where that piece goes.

Thanks so much!

-- Chris
_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.