Giter VIP home page Giter VIP logo

ezjsonm's Introduction

MirageOS logo
Build Unikernels in OCaml

OCaml-CI Build Status docs


MirageOS is a library operating system that constructs secure, performant and resource-efficient unikernels.

About

MirageOS is a library operating system that constructs unikernels for secure, high-performance network applications across various cloud computing and mobile platforms. Developers can write code on a traditional OS such as Linux or macOS. They can then compile their code into a fully-standalone, specialised unikernel that runs under the Xen or KVM hypervisors and lightweight hypervisors like FreeBSD's BHyve, OpenBSD's VMM. These unikernels can deploy on public clouds, like Amazon's Elastic Compute Cloud and Google Compute Engine, or private deployments.

The most up-to-date documentation can be found at the homepage. The site is a self-hosted unikernel. Simpler skeleton applications are also available online. MirageOS unikernels repositories are also available here or there.

This repository

This repository contains the mirage command-line tool to create and deploy applications with MirageOS. This tool wraps the specialised configuration and build steps required to build MirageOS on all the supported targets.

Local install

You will need the following:

  • a working OCaml compiler (4.08.0 or higher).
  • the Opam source package manager (2.1.0 or higher).
  • an x86_64 or armel Linux host to compile Xen kernels, or FreeBSD, OpenBSD or MacOS X for the solo5 and userlevel versions.

Then run:

$ opam install mirage
$ mirage --version

This should display at least version 4.0.0.

Using mirage

There are multiple stages to using mirage:

  • write config.ml to describe the components of your applications;
  • call mirage configure to generate the necessary code and metadata;
  • optionally call make depends to install external dependencies and download Opam packages in the current dune workspace.
  • call dune build to build a unikernel.

You can find documentation, walkthroughs and tutorials over on the MirageOS website. The install instructions are a good place to begin!

ezjsonm's People

Contributors

avsm avatar craigfe avatar dinosaure avatar djs55 avatar gasche avatar hhugo avatar ivg avatar jaredly avatar raboof avatar rgrinberg avatar sagotch avatar samoht avatar yallop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ezjsonm's Issues

Fix compilation on trunk

#=== ERROR while installing ezjsonm.0.4.2 =====================================#
# opam-version 1.2.2
# os           linux
# command      make
# path         /home/travis/.opam/4.03.0+trunk/build/ezjsonm.0.4.2
# compiler     4.03.0+trunk
# exit-code    2
# env-file     /home/travis/.opam/4.03.0+trunk/build/ezjsonm.0.4.2/ezjsonm-14774-876af6.env
# stdout-file  /home/travis/.opam/4.03.0+trunk/build/ezjsonm.0.4.2/ezjsonm-14774-876af6.out
# stderr-file  /home/travis/.opam/4.03.0+trunk/build/ezjsonm.0.4.2/ezjsonm-14774-876af6.err
### stdout ###
# [...]
# Error: Multiple definition of the extension constructor name Parse_error.
#        Names must be unique in a given structure or signature.
# Command exited with code 2.
# + /home/travis/.opam/4.03.0+trunk/bin/ocamlopt.opt unix.cmxa -I /home/travis/.opam/4.03.0+trunk/lib/ocaml/ocamlbuild /home/travis/.opam/4.03.0+trunk/lib/ocaml/ocamlbuild/ocamlbuildlib.cmxa myocamlbuild.ml /home/travis/.opam/4.03.0+trunk/lib/ocaml/ocamlbuild/ocamlbuild.cmx -o myocamlbuild
# File "myocamlbuild.ml", line 518, characters 43-62:
# Warning 3: deprecated: Ocamlbuild_plugin.String.uncapitalize
# Use String.uncapitalize_ascii instead.
# File "myocamlbuild.ml", line 531, characters 51-70:
# Warning 3: deprecated: Ocamlbuild_plugin.String.uncapitalize
# Use String.uncapitalize_ascii instead.
### stderr ###
# [...]
# Warning 3: deprecated: String.uncapitalize
# Use String.uncapitalize_ascii instead.
# File "setup.ml", line 5847, characters 11-28:
# Warning 3: deprecated: String.capitalize
# Use String.capitalize_ascii instead.
# File "setup.ml", line 5848, characters 11-30:
# Warning 3: deprecated: String.uncapitalize
# Use String.uncapitalize_ascii instead.
# E: Failure("Command ''/home/travis/.opam/4.03.0+trunk/bin/ocamlbuild' lib/ezjsonm.cma lib/ezjsonm.cmxa lib/ezjsonm.a lib/ezjsonm.cmxs -tag debug' terminated with error code 10")
# make: *** [build] Error 1

Stack-overflow in json_of_src when built with JSOO (with potential fix)

AFAIK JSOO optimizes only self-tail-calls so Ezjsonm.value_from_string fails on biggish values with stack-overflow (at least at 20 KB json for me on chrome & firefox)

I have an imperative implementation here that fixes the problem for my case (one self-tail-call actually):
https://github.com/tqtezos/TZComet/pull/8/files

It's way longer & messier, and could have some subtle bug I haven't hit yet.
And fixes a problem only in the JSOO case.

Is a PR for this something that you'd be interested in?

Ezjsonm.t is overly restrictive and not compliant with the spec

#31 raises a valid question but doesn't go far enough. :)

Trying to parse Ezjsonm.from_string "1" should not throw any errors at all, it should return Float 1.0.

According to https://www.json.org/json-en.html , the start symbol of the grammar is "element" which is "whitespace? value whitespace?". This means bare primitive values like 1 or "hello world" are valid JSON.

That's also how most JSON libraries for other languages behave.

Another problem with the current approach is that if you are destructuring a JSON value, you cannot use to_string to to print a a value.

Ezjsonm doesn't satisfy sexplib interface

Sexplib expects very specific naming conventions to be able to further build up sexp-converters for other types. As such, it would be great if you could add aliases called sexp_of_t and t_of_sexp for the to_sexp and of_sexp functions, respectively.

update sexplib upper bound on opam-repository

ezjsonm appears to build with sexplib 113.24.00, but the upper bound on opam-repository is 113.01.00 . Is there a runtime problem? If not, can the upper bound on opam-repository be updated to 113.25.00 ?

Encoding of non-UTF-8 `String _ values, fail earlier?

Encoded arbitrary strings can fail to be parsed back:

# let teeshow s = Printf.printf "-> %S\n%!" s; s;;
val teeshow : string -> string = <fun>
# let x = Ezjsonm.(value_from_string (value_to_string (`String "\xbe") |> teeshow));;
-> "\"\190\""
Exception:
Ezjsonm.Parse_error (`Null,
 "JSON.of_buffer illegal bytes in character stream (BE)").

In value_to_src `String _ Ezjsonm.values are passed directly to Jsonm.encode e (`Lexeme l).

The Jsonm documentation says:

Only the UTF-8 encoding scheme is supported. The strings of encoded `Name and `String lexemes are assumed to be immutable and must be UTF-8 encoded, this is not checked by the module.

Should Ezjsonm fail earlier, at encoding time?

Assertion failure when parsing a number

Testing with OCaml 4.04.2 and ezjsonm 0.5.0 from opam:

─utop # Ezjsonm.from_string "1";;
Exception: Assert_failure ("lib/ezjsonm.ml", 58, 59).

I know (ez)jsonm requires a wrapping array/object but an assertion failure seems worth reporting.

Retrieving optional fields

Wouldn't it make sense to have a variation on 'find' that returns an option instead of raising an error when no element is found?

Missing online documentation.

  • I like to have the possibility to read documentation without having to generate it.
  • Github pages are perfect for this purpose.
  • Ezjsonm does not provide any known online documentation.

So, I started to add a rule to Makefile to generate documention and push it to gh-pages, and ended with a script (https://github.com/sagotch/ghpup), because the Makefile rule was a mess...

You can see it "in action" on my fork, where I used it to generate github pages for Ezjsonm (https://github.com/sagotch/ezjsonm/blob/master/Makefile#L54).

If you want to merge the script into mirage/ezjsonm, it would be with great pleasure. If you do not, gh-pages branch still is a good idea. :)

Design of accessors functions

The accessor functions raise exceptions when their preconditions are not met. What is your take on an additional interface, maybe in a submodule Opt or similar, which returns option values instead? I believe this would facilitate using Option.bind quite nicely and monadic error handling. Given the dynamic nature of JSON values, error handling somewhat cumbersome and this could help to make it smoother.

Jsoo + Ezjsonm: "Too much recursion" in Firefox console when reading/writing Json-list

I found this issue by using Cow in a Jsoo compiled program to read a json-list of data; and now found that the failure also appears when running the following with Firefox:

Array.(`A (to_list (make 1000 (`O [("bar", `String "baz")]))))
|> Ezjsonm.to_string 

The problem doesn't seem to appear with Chromium. Guess it might as well be an issue with Firefox not handling recursion properly...

missing lwt constraint in the opam file

Building with Lwt support fails with "Error: Unbound module Lwt.Infix"
To reproduce:

 > ./configure --enable-lwt
 > make

Output is:

ocaml setup.ml -build 
Finished, 1 target (0 cached) in 00:00:00.
File "_tags", line 28, characters 22-34:
Warning: the tag "pkg_alcotest" is not used in any flag or dependency declaration, so it will have no effect; it may be a typo. Otherwise you can use `mark_tag_used` in your myocamlbuild.ml to disable this warning.
File "_tags", line 37, characters 23-35:
Warning: the tag "pkg_alcotest" is not used in any flag or dependency declaration, so it will have no effect; it may be a typo. Otherwise you can use `mark_tag_used` in your myocamlbuild.ml to disable this warning.
+ /Users/juan.chanco/.opam/4.02.3/bin/ocamlfind ocamlc -c -g -annot -bin-annot -I lib -package hex -package jsonm -package lwt -package sexplib -package uutf -I lib -o lib/ezjsonm_lwt.cmo lib/ezjsonm_lwt.ml
File "lib/ezjsonm_lwt.ml", line 17, characters 5-14:
Error: Unbound module Lwt.Infix
Command exited with code 2.
Compilation unsuccessful after building 12 targets (0 cached) in 00:00:00.
E: Failure("Command ''/Users/juan.chanco/.opam/4.02.3/bin/ocamlbuild' lib/ezjsonm.cma lib/ezjsonm.cmxa lib/ezjsonm.a lib/ezjsonm.cmxs lib/ezjsonm-lwt.cma lib/ezjsonm-lwt.cmxa lib/ezjsonm-lwt.a lib/ezjsonm-lwt.cmxs -tag debug' terminated with error code 10")
make: *** [build] Error 1

Alternately, installing with opam fails similarly:

> opam install lwt ezjsonm

screen shot 2015-11-03 at 11 02 11 am

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.