Skip to content

Commit

Permalink
Add more docs and README
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent-lau committed Aug 16, 2024
1 parent 3cf5ac7 commit 8383191
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
4 changes: 4 additions & 0 deletions tools/cfgtool.mli
Original file line number Diff line number Diff line change
@@ -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. *)
1 change: 1 addition & 0 deletions tools/cmapctl.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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].
Expand Down
7 changes: 7 additions & 0 deletions tools/quorumtool.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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. *)

0 comments on commit 8383191

Please sign in to comment.