Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 77 lines (50 sloc) 2.451 kb
fccc685 Initial open-source release
MLstate authored
1 (*
2 Copyright © 2011 MLstate
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18 (** This module provides a mapping between database paths (Badop.path) and
19 servers. It holds the [cluster_map], which guides this mapping and should be
20 shared among all db nodes. *)
21 (**
22 What you have here is a temporary place-holder until a real locator is
23 implemented. Features wanted:
24
25 - adding servers before completing initialisation (until a fixed number is
26 reached -- like db4). This requires some network communication (directly or
27 via a monitor ?)
28 - dynamic cluster_map with update/add/remove...
29 - cluster_map synchronisation
30 *)
31
32 type 'a t
33 type key
34
35 val create : flat_replication:int -> 'a list -> 'a t
36
37 (** Functions used to apply operations on the locator structure. They are all
38 asynchronous (run in parallel using the scheduler) *)
39
40 val iter: 'a t -> ('a -> unit Cps.t) -> unit Cps.t
41
42 val sequential_iter : 'a t -> ('a -> unit Cps.t) -> unit
43
44 val map: 'a t -> ('a -> 'b Cps.t) -> 'b t Cps.t
45
46 val mapi: 'a t -> (key -> 'a -> 'b Cps.t) -> 'b t Cps.t
47
48 val reduce: 'a t -> ('acc -> 'b -> 'acc) -> 'acc -> ('a -> 'b Cps.t) -> 'acc Cps.t
49
50 val map_reduce: 'a t -> ('acc -> 'b -> 'c * 'acc) -> 'acc -> ('a -> 'b Cps.t) -> ('c t * 'acc) Cps.t
51
52 val at_path: 'a t -> Path.t -> (key -> 'a -> 'b Cps.t) -> 'b Cps.t
53
54 val mapi_path: 'a t -> Path.t -> (key -> 'a -> 'a Cps.t) -> 'a t Cps.t
55
56 (** Functions to manipulate the locator structure. Keys are obtained from
57 [mapi], [mapi_path], etc. and can be used to get the corresponding
58 element from another locator. *)
59
60 val get_key: 'a t -> key -> 'a
61
62 val set_key: 'a t -> key -> 'a -> 'a t
63
64 val push_key: 'a t -> key -> 'a -> unit (* imperative ! *)
65
66 val to_list: 'a t -> 'a list
67
68
69
70 (*
71 val map_path: 'a t -> Path.t -> ('a -> 'a Cps.t) -> 'a t Cps.t
72
73 val get: 'a t -> Path.t -> 'a
74
75 val geti: 'a t -> Path.t -> 'a
76 *)
Something went wrong with that request. Please try again.