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

Re: [MirageOS-devel] Problem when writing Twitter API library that can be used on Mirage

Hi, Dr Leonard

Thank you for the suggestions.

I design my library using functor and start to appreciate how functor helps to abstract design and easily target different backend (Unix, Xen).Â

I still have two questions which are related to OS dependency.

1. How could I know if a library has any OS dependency? Do I need to read their source code, or there is a easier way I donât know?

2. Is there any good crypto library (e.g. generating nonce, calculating HMAC_SHA1) that can be used on Mirage? I am using Cryptokit on my unix machine. It seems like I cannot use it in Mirage. Reason is here (https://github.com/msimon/cryptokit/blob/master/src/cryptokit.mli#L233). You may realize this problem is actually the reason I asked my first question.Â

Thank you!

Runhang Li
University of California, Los Angeles

On Fri, May 15, 2015 at 9:39 AM, Thomas Leonard <talex5@xxxxxxxxx> wrote:

On 15 May 2015 at 07:48, Runhang Li <marklrh@xxxxxxxxx> wrote:
> Hi,

Hi Runhang,

> I am writing a better Twitter API library because it is impossible for one
> to use current Twitter library (https://github.com/yoshihiro503/ocamltter/)
> if he wants to make a Mirage unikernel.
> I have two questions.
> 1. What exactly are the limitation for the libraries I can use when writing
> code? Based on what I know, I feel like I cannot use any library that is
> OS-dependent? For example, can I use Lwt_unix.sleep?

Correct; you cannot use Unix, Lwt_unix, etc. In Mirage, you can use
OS.Time.sleep instead of Lwt_unix.sleep.

Sometimes an existing library can be modified easily (e.g. by moving
non-Unix code into a separate "core" module), so it might be worth
trying that first.

You should also try to avoid using C libraries where possible. e.g.
you'd want to replace curl with cohttp here.

> 2. Since the unikernel needs to make HTTPS request, I'd like to try out
> OCaml-TLS. Is there any recommendation for a good example that can
> illustrate how to use that? What aspects should I be careful of when using
> it?

There are some examples in the tls repository:


I think there will be more information soon, as I see various
TLS-related releases being prepared.

> All questions and suggestions would be very welcomed.

Dr Thomas Leonard http://roscidus.com/blog/
GPG: DA98 25AE CAD0 8975 7CDA BD8E 0713 3F96 CA74 D8BA

MirageOS-devel mailing list



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