Yaron Minsky avatar Yaron Minsky committed da7f04f

small tweaks

Comments (0)

Files changed (6)

-Hello World for Core
-====================
+Core and Async Hello World
+==========================
 
 A simple hello-world project for Core.  The intent is to show you how
 to get started building OCaml projects using OPAM, Core and
-OCamlbuild.  To use this, first get OPAM, and install the "core"
-package.  Also, it's probably doing this:
+OCamlbuild.
 
-    $ opam switch ocaml-4.00.1+short-types
+Before getting started with this code, you should follow the
+instructions in the PREREQUISITES.
 
-to get better error messages from the compiler when using Core.  (As
-of 4.01, this compiler variant should be obsolete.)
-
-You can build all the pieces of this project by running:
+Once that's done, you can build all the pieces of this project by
+running:
 
     $ ./build_all.sh
 
 Hello World
 -----------
 
+This is a very simple exercise that shows you how to make a basic
+command-line application using Core's `Command` module.
+
 This executable is `hello_world.native` (or `hello_world.byte`), and
 here's an example of it in action.
 

broker_protocol.ml

   ~bin_query:Unit.bin_t
   ~bin_response:Dump.bin_t
 
-
 let shutdown_rpc = Rpc.Rpc.create
   ~name:"shutdown"
   ~version:0
   ~bin_query:Unit.bin_t
   ~bin_response:Unit.bin_t
-
 (* First, we build the implementations *)
 
 let publish_impl (dir,_) msg =
+  Log.Global.sexp ~level:`Debug msg
+    (Message.sexp_of_t);
   return (Directory.publish dir msg)
 
 let subscribe_impl (dir,_) topic ~aborted =
 
 eval `opam config -env`
 
-for TARGET in $*
-do
-  ocamlbuild -use-ocamlfind $TARGET -cflags "-w @A-4-33-23" -cflags -short-paths
-done
+ocamlbuild -j 4 -use-ocamlfind -cflags "-w @A-4-33-23" -cflags -short-paths $*
 
 
     )
 
 let start_server ~env ?(stop=Deferred.never ()) ~implementations ~port () =
-  Log.Global.info "starting server on %d" port;
+  Log.Global.info "Starting server on %d" port;
   let implementations =
     Rpc.Implementations.create_exn ~implementations
       ~on_unknown_rpc:(`Call (fun ~rpc_tag ~version ->
         Log.Global.info "Unexpected RPC, tag %s, version %d" rpc_tag version))
   in
-  Log.Global.info "About to start TCP server";
   Tcp.Server.create
     ~on_handler_error:(`Call (fun _ exn -> Log.Global.sexp exn Exn.sexp_of_t))
     (Tcp.on_port port)
         ~implementations
     )
   >>= fun server ->
-  Log.Global.info "TCP server started, waiting for close";
+  Log.Global.info "Server started, waiting for close";
   Deferred.any
     [ (stop >>= fun () -> Tcp.Server.close server)
     ; Tcp.Server.close_finished server ]
    query whose implementation blocks.
 *)
 let hello_impl () hello =
+  Log.Global.info "received hello query (%s)" hello;
   Clock.after (sec 0.1)
   >>= fun () -> return (hello ^ " World!")
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.