Skip to content
This repository
tag: v962
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 77 lines (50 sloc) 2.451 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
(*
Copyright © 2011 MLstate

This file is part of OPA.

OPA is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License, version 3, as published by
the Free Software Foundation.

OPA is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
more details.

You should have received a copy of the GNU Affero General Public License
along with OPA. If not, see <http://www.gnu.org/licenses/>.
*)
(** This module provides a mapping between database paths (Badop.path) and
servers. It holds the [cluster_map], which guides this mapping and should be
shared among all db nodes. *)
(**
What you have here is a temporary place-holder until a real locator is
implemented. Features wanted:

- adding servers before completing initialisation (until a fixed number is
reached -- like db4). This requires some network communication (directly or
via a monitor ?)
- dynamic cluster_map with update/add/remove...
- cluster_map synchronisation
*)

type 'a t
type key

val create : flat_replication:int -> 'a list -> 'a t

(** Functions used to apply operations on the locator structure. They are all
asynchronous (run in parallel using the scheduler) *)

val iter: 'a t -> ('a -> unit Cps.t) -> unit Cps.t

val sequential_iter : 'a t -> ('a -> unit Cps.t) -> unit

val map: 'a t -> ('a -> 'b Cps.t) -> 'b t Cps.t

val mapi: 'a t -> (key -> 'a -> 'b Cps.t) -> 'b t Cps.t

val reduce: 'a t -> ('acc -> 'b -> 'acc) -> 'acc -> ('a -> 'b Cps.t) -> 'acc Cps.t

val map_reduce: 'a t -> ('acc -> 'b -> 'c * 'acc) -> 'acc -> ('a -> 'b Cps.t) -> ('c t * 'acc) Cps.t

val at_path: 'a t -> Path.t -> (key -> 'a -> 'b Cps.t) -> 'b Cps.t

val mapi_path: 'a t -> Path.t -> (key -> 'a -> 'a Cps.t) -> 'a t Cps.t

(** Functions to manipulate the locator structure. Keys are obtained from
[mapi], [mapi_path], etc. and can be used to get the corresponding
element from another locator. *)

val get_key: 'a t -> key -> 'a

val set_key: 'a t -> key -> 'a -> 'a t

val push_key: 'a t -> key -> 'a -> unit (* imperative ! *)

val to_list: 'a t -> 'a list



(*
val map_path: 'a t -> Path.t -> ('a -> 'a Cps.t) -> 'a t Cps.t

val get: 'a t -> Path.t -> 'a

val geti: 'a t -> Path.t -> 'a
*)
Something went wrong with that request. Please try again.