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

Re: [MirageOS-devel] Custom KV_RO Implementation



This is spot on.  When I develop Mirage code, putting it into the functor is basically the last thing I do.  Start with Unix, but don't let Unix get too deep into your code, and *then* abstract away the pieces as Thomas describes.

Also, don't be afraid of proposing breaking changes to interfaces such as KV_RO -- we've made a number of such changes (most recently for the IPv6 introduction), so I expect the same will be needed for a Redis backend to KV_RO as well!

-anil

On 19 Dec 2014, at 12:36, Thomas Gazagnaire <thomas@xxxxxxxxxxxxxx> wrote:

I really think you are doing things in the wrong order. The way I see the process:

1. Write some normal OCaml code on Unix, we test and debug it with the normal Unix tools.
2. Abstract the system dependencies as parameters of the functor. Usually everything related to input/output. It's better to keep that in mind while doing 1. though, otherwise it can causes some pain. Now you know what module type you need to depend on.
3. Take an existing example in mirage-skeleton and modify the body of unikernel.ml to call your code. Now you know what shape the generated will have.
4. create the new impl in mirage.ml to make it more easily configurable. Use knowledge you gathered from 2. and 3. to do so.

Doing things in reverse order won't work very well :-)

Thomas

Once again I would advise 
On 19 Dec 2014, at 20:23, Brian Brietzke <bbrietzke@xxxxxxxxx> wrote:

Thanks Luke.  I kept looking at impl as most of the other code in mirage.ml seemed to be using that.  I switched it over to implementation and solved at least part of the problem.  On the other hand, the KV_RO constructor was done out of frustration and experimentation.  There will be constructor options ( host, port, etc ) but it shouldn't be another KV_RO.

Thomas, I have a basic working ( well compilable ) implementation up now.  The size and read functions just return errors based on the name parameter, but that is enough to get some basics.  I'll expand it out further as things progress.

I'm assuming the 'Symbol not found: _camlRediskv error' is part of the referring module issue listed above?  Can I create a different folder, use oasis to create a new library project and just 'opam pin' to handling the non-module referring?

On Fri, Dec 19, 2014 at 10:58 AM, Thomas Gazagnaire <thomas@xxxxxxxxxxxxxx> wrote:
Hi,

First, thanks for your effort!

So I don't know if "mirage configure" actually supports your case of referring to another module from within config.ml

No it doen't (yet), but we had some ideas to make it work (see http://lists.xenproject.org/archives/html/mirageos-devel/2014-11/msg00078.html)

What I would like to start off with is a new implementation of the KV_RO module but using Redis instead of crunch or the file system.  

I think I need three things:  one is the actual implementation module that implements the KV_RO interface / module, one module that provides the packages and libraries you need ( the Impl module? ) and then another for tie those together.

This is indeed what is needed to have a fully supported backend. Before that, I think the first step (the harder one) is to get your implementation working on Linux. Just write complete https://github.com/bbrietzke/sad_butter/blob/redis_kv/src/rediskv.ml to make it work locally for you (compile it as a normal OCaml project, using ocamlbuild for instance), but everytime you want to do a syscall (network or disk access) call a function from a parameter of your functor instead of the one provided by the Unix module.

Once this is working fine locally for you, test it manually be applying different implementations for the functor arguments. Then extend unikernel.ml to use your functor. And finally we can discuss on how to integrate it properly in the mirage tool :p

Best,
Thomas



I think I'm struggling with the part of tying things together and making them work.  

I started with the crunch kv_ro example since it was close enough to what I want to do.  I have a module named Kv that provides the libraries/packages/configure roughed out and had ( and will add it back ) a module for the redis kv_ro.

I've had functors and just normal functions that try to create the modules based on the what is done for crunch ( impl kv_ro host (module Kv/KvRoRedis/etc )) and I'm told that impl cannot be found.  When i try to use Kv or KvRoRedis directly, i receive an unbound constructor error.

Code can be found at:

Any help or guidance would be appreciated.

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

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


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

_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
http://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®.