Skip to content
Browse files

[feature] Badop_light: Added interface files.

  • Loading branch information...
1 parent 7e07d58 commit 5cdcd011656b8c1a01fe56dcc7cdbe59580c8213 @nrs135 nrs135 committed with Louis Gesbert Jun 14, 2011
View
62 database/badop_light.mli
@@ -0,0 +1,62 @@
+(*
+ 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/>.
+*)
+type 'a answer = [ `Absent | `Answer of 'a | `Linkto of Badop.path ]
+type database = {
+ session : Session_light.t;
+ file : string;
+ mutable node_config : Badop.Node_property.config;
+}
+type transaction = { db : database; tr : Transaction_light.t; }
+val ( |> ) : 'a -> ('a -> 'b) -> 'b
+val open_database : Badop.options -> (database -> 'a) -> 'a
+val close_database : database -> (unit -> 'a) -> 'a
+val status : database -> (Badop.status -> 'a) -> 'a
+module Tr :
+ sig
+ val start : database -> (transaction -> 'a) -> 'a
+ val start_at_revision : database -> 'a -> (transaction -> 'b) -> 'b
+ val prepare : transaction -> (transaction * bool -> unit) -> unit
+ val commit : transaction -> (bool -> 'a) -> 'a
+ val abort : transaction -> (unit -> 'a) -> 'a
+ end
+type revision = Revision.t
+type 'a read_op = ('a, revision) Badop.generic_read_op
+val read :
+ transaction ->
+ Badop.path ->
+ (Badop_lib.Dialog.query, Revision.t) Badop.generic_read_op ->
+ ([> `Absent
+ | `Answer of (Badop_lib.Dialog.response, Revision.t) Badop.generic_read_op ] ->
+ 'a) ->
+ 'a
+type 'a write_op = ('a, transaction, revision) Badop.generic_write_op
+val write :
+ transaction ->
+ Path.t ->
+ (Badop_lib.Dialog.query, transaction, 'a) Badop.generic_write_op ->
+ ((Badop_lib.Dialog.response, transaction, 'a) Badop.generic_write_op -> 'b) -> 'b
+val write_list :
+ transaction ->
+ (Path.t * (Badop_lib.Dialog.query, transaction, 'a) Badop.generic_write_op) list ->
+ (transaction -> unit) -> unit
+val node_properties : database -> Badop.Node_property.config -> (unit -> 'a) -> 'a
+module Debug :
+ sig
+ val revision_to_string : Revision.t -> string
+ val path_to_string : Path.t -> string
+ end
View
25 database/light/encode_light.mli
@@ -0,0 +1,25 @@
+(*
+ 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/>.
+*)
+val encode_key : Keys.t -> string
+val decode_key : string -> int -> int * Keys.t
+val encode_path : Path.t -> string
+val decode_path : string -> int -> int * Path.t
+val encode_dataimpl : DataImpl.data -> string
+val decode_dataimpl : string -> int -> int * DataImpl.data
+val encode_datas : Datas.ns -> string
+val decode_datas : string -> int -> int * Datas.ns
View
42 database/light/io_light.mli
@@ -0,0 +1,42 @@
+(*
+ 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/>.
+*)
+val version : string
+type mode = Create | Append | ReadOnly
+type t = {
+ location : string;
+ mode : mode;
+ mutable dbm : Dbm.t option;
+ mutable link_count : int;
+ mutable has_lock : bool;
+}
+val dbtbl : (string, t) Hashtbl.t
+val is_open : t -> bool
+val is_closed : t -> bool
+val really_remove_lock_file : t -> unit
+val close : t -> unit
+val make_lock_file : t -> unit
+val remove_lock_file : t -> unit
+val read_lock_file : t -> (string * int) option
+val check_other_used : t -> unit
+val reopen : t -> unit
+val make : mode -> string -> t
+val get_timestamp : t -> Time.t
+val get_location : t -> string
+val get_dbm : t -> Dbm.t option
+val get_link_count : t -> int
+val get_has_lock : t -> bool
View
66 database/light/session_light.mli
@@ -0,0 +1,66 @@
+(*
+ 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/>.
+*)
+type tr_FIFO = (Transaction_light.t * (Transaction_light.t * bool -> unit)) Queue.t
+val is_empty_FIFO : 'a Queue.t -> bool
+val create_FIFO : unit -> 'a Queue.t
+val add_FIFO : 'a -> 'b -> ('a * 'b) Queue.t -> unit
+val take_FIFO : 'a Queue.t -> 'a
+type lock = (Transaction_light.t * Db_light.t) option
+type t = {
+ mutable trans_num : int;
+ mutable db_ref : Db_light.t;
+ with_dot : bool;
+ is_weak : bool;
+ file_manager : Io_light.t;
+ mutable session_lock : lock;
+ waiting_FIFO : tr_FIFO;
+}
+exception Open of (t option * string)
+exception DiskError of string
+val write_trans : Dbm.t -> Transaction_light.t -> unit
+val disk_writing : t -> Transaction_light.t -> unit
+val get_timestamp : t -> Time.t
+val position : string -> string
+val init_db : Io_light.mode -> string -> t
+val make : ?dot:'a -> ?weak:'b -> string -> t
+val close_db : ?donothing:bool -> t -> unit
+val restart_db_from_last : t -> Db_light.t
+val restart_db : ?dot:'a -> ?weak:'b -> ?restore:'c -> ?openat_rev:'d -> string -> t
+val open_db_aux : ?dot:'a -> ?weak:'b -> ?rev:'c -> ?restore:'d -> string -> t * bool
+val open_db : ?dot:'a -> ?weak:'b -> ?rev:'c -> ?restore:'d -> string -> t * bool
+val is_empty : t -> bool
+val get_rev : t -> Revision.t
+val is_closed_db : t -> bool
+val new_trans : ?read_only:bool * 'a -> t -> Transaction_light.t
+val abort_of_unprepared : t -> Transaction_light.t -> unit
+val _prepare_commit : Db_light.t -> Transaction_light.t -> Db_light.t
+val prepare_commit : t -> Transaction_light.t -> (Transaction_light.t * bool -> unit) -> (Transaction_light.t * (Transaction_light.t * bool -> unit)) option
+val try_prepare_commit : t -> Transaction_light.t -> (Transaction_light.t * bool -> unit) -> (Transaction_light.t * (Transaction_light.t * bool -> unit)) option
+val pop_trans_k : t -> (Transaction_light.t * (Transaction_light.t * bool -> unit)) option
+val try_trans_prepare : t -> Transaction_light.t -> (Transaction_light.t * bool -> unit) -> unit
+val pop_trans_prepare : t -> unit
+val abort_or_rollback : t -> Transaction_light.t -> unit
+val really_commit : t -> Transaction_light.t -> bool
+val get : 'a -> Transaction_light.t -> Path.t -> DataImpl.t
+val get_children : 'a -> Transaction_light.t -> Keys.t option * int -> Path.t -> Path.t list
+val stat : Transaction_light.t -> Path.t -> Path.t * Revision.t option * [> `Data | `Link | `Unset ]
+val full_search : Transaction_light.t -> string list -> Path.t -> Keys.t list
+val set : Transaction_light.t -> Path.t -> DataImpl.t -> Transaction_light.t
+val remove : Transaction_light.t -> Path.t -> Transaction_light.t
+val set_link : Transaction_light.t -> Path.t -> Path.t -> Transaction_light.t
+val set_copy : 'a -> Transaction_light.t -> Path.t -> Path.t * 'b -> Transaction_light.t
View
59 database/light/transaction_light.mli
@@ -0,0 +1,59 @@
+(*
+ 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/>.
+*)
+type query = Set of Datas.t | Remove of Path.t
+val string_of_query : query -> string
+val string_of_query_list : query list -> string
+val string_of_query_map : (Path.t * query) list -> string
+type t = {
+ tr_num : int;
+ tr_db : Db_light.t;
+ tr_query_map : (Path.t * query) list;
+ tr_remove_list : Path.t list;
+ tr_index_set : (Path.t * DataImpl.t) list;
+ tr_index_remove : (Path.t * DataImpl.t) list;
+ tr_op_counter : int;
+}
+val get_num : t -> int
+val get_db : t -> Db_light.t
+val get_query_map : t -> (Path.t * query) list
+val full_search : t -> string list -> Path.t -> Keys.t list
+exception Data_not_found
+val find_data_in_query_list : query list -> DataImpl.t
+exception Removed
+val get_query_at : t -> Path.t -> (Path.t * query) list
+val find_set_data_in_query_list : query list -> DataImpl.t option
+val stat : t -> Path.t -> Path.t * Revision.t option * [> `Data | `Link | `Unset ]
+val get : t -> Path.t -> DataImpl.t
+val virtual_get_children : t -> Path.t -> Path.t list
+val get_children : t -> Keys.t option * int -> Path.t -> Path.t list
+val trans_operation_counter_limit : int
+val add_to_query_map : t -> Path.t -> query -> t
+val rm_all_with_prefix : Path.t -> Path.t list -> Path.t list
+val remove_from_query_map : (Path.t * 'a) list -> Path.t -> (Path.t * 'a) list
+val set_link : t -> Path.t -> Path.t -> t
+val set_copy : t -> Path.t -> Path.t * 'a -> t
+val set : t -> Path.t -> DataImpl.t -> t
+val check_remove : t -> Path.t -> bool
+val remove : t -> Path.t -> t
+val init : Db_light.t -> ?read_only:'a -> int -> t
+val update_uid_list : ('a * 'b) list -> 'a -> 'b -> ('a * 'b) list
+val update_node_list : ('a * 'b) list -> 'a -> 'b -> ('a * 'b) list
+val execute_query_map : t -> Db_light.t -> t * Db_light.t
+val execute_remove_list : t -> Db_light.t -> t * Db_light.t
+val modified : t -> bool
+val commit : t -> Db_light.t -> Db_light.t

0 comments on commit 5cdcd01

Please sign in to comment.
Something went wrong with that request. Please try again.