diff --git a/README.md b/README.md index 1fe9dd1..6762f3f 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,22 @@ OCaml bindings to for libcorosync, currently including libquorum, libvotequorum, libcfg and libcmap. Operations require Corosync to be running. + + +## Installation + +This library is published on opam, so one can do + +``` +opam install corosync +``` + +to install the library + +## Get started + +To get started, make sure you have Corosync configured and running on your cluster. +If you are new to corosync, start by experimenting some of the builtin Corosync +cmd tools such as `corosync-cmapctl`, `corosync-quorumtool` etc. Then look at the +tools library to see what high level functions are provided by this binding. +`bin/main.ml` also provides some example code that can be run to test things out. diff --git a/tools/cfgtool.mli b/tools/cfgtool.mli index 176d304..3b08f41 100644 --- a/tools/cfgtool.mli +++ b/tools/cfgtool.mli @@ -1,8 +1,12 @@ open Corosync_lib val local_get : unit -> (int, Corotypes.CsError.t) result +(** [local_get ()] returns the nodeid of the node on which this function is called. *) val reload_config : unit -> (unit, Corotypes.CsError.t) result +(** [realod_config ()] will ask corosync to reload config on the current node. *) val get_node_addrs : int -> (Cfg.cfg_node_address list, Corotypes.CsError.t) result +(** [get_node_addrs nodeid] returns the addresses of the node with id [nodeid]. +Note that Corosync 3 supports multiple homing, so there could be multiple addresses for one node. *) diff --git a/tools/cmapctl.mli b/tools/cmapctl.mli index 836106e..de303e0 100644 --- a/tools/cmapctl.mli +++ b/tools/cmapctl.mli @@ -8,6 +8,7 @@ and supply that type into this function. The type information for cmap can be retrieved by doing a corosync-cmapctl call and examining the types. *) val set : string -> 'a CmapValue.value -> (unit, Corotypes.CsError.t) result +(** [set key value] sets the cmap in memory database [key] to [value] *) val get_prefix : string -> ((string * string) list, Corotypes.CsError.t) result (** [get_prefix prefix] will return a list of (k,v) where k has a prefix of [prefix]. diff --git a/tools/quorumtool.mli b/tools/quorumtool.mli index 18311a7..5210d0e 100644 --- a/tools/quorumtool.mli +++ b/tools/quorumtool.mli @@ -19,12 +19,19 @@ module ViewList : sig end val is_quorate : unit -> (bool, CsError.t) result +(** [is_quorate () returns whether the current cluster is quorate ]*) val using_votequorum : unit -> bool +(** [using_votequorum ()] returns whether votequorum is used in the current cluster *) val votequorum_info : int -> (Votequorum.vinfo, CsError.t) result +(** [votequorum_info nodeid] returns the votequoruminfo for the node with [nodeid] *) val my_votequorum_info : unit -> (Votequorum.vinfo, CsError.t) result +(** [my_votequorum_info ()] returns the votequoruminfo for the node on which this +function is called *) val quorum_members : name_format -> (ViewList.view_list_entry list, CsError.t) result +(** [quorum_members format] returns the members and their information in the current +quorum as a list. The format can either be an ip address or the host name. *)