-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathrocks_intf.ml
113 lines (82 loc) · 4.08 KB
/
rocks_intf.ml
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
open Rocks_options
type bigarray = (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
module type ITERATOR = sig
module ReadOptions : module type of ReadOptions
exception InvalidIterator
type db
type t
val get_pointer : t -> unit Ctypes.ptr
val create : ?opts:ReadOptions.t -> db -> t
val with_t : ?opts:ReadOptions.t -> db -> f:(t -> 'a) -> 'a
val is_valid : t -> bool
val seek_to_first : t -> unit
val seek_to_last : t -> unit
val seek : ?pos:int -> ?len:int -> t -> bigarray -> unit
val seek_string : ?pos:int -> ?len:int -> t -> string -> unit
val next : t -> unit
val prev : t -> unit
val get_key_string : t -> string
(** returned buffer is only valid as long as [t] is not modified *)
val get_key : t -> bigarray
val get_value_string : t -> string
(** returned buffer is only valid as long as [t] is not modified *)
val get_value : t -> bigarray
val get_error : t -> string option
end
module type TRANSACTION = sig
type t
type db
type iter
module ReadOptions : module type of ReadOptions
module WriteOptions : module type of WriteOptions
module TransactionOptions : module type of TransactionOptions
module Snapshot : module type of Snapshot
val txnbegin : ?wopts:WriteOptions.t ->
?txnopts:TransactionOptions.t -> db -> t
val txnbegin_no_gc : ?wopts:WriteOptions.t ->
?txnopts:TransactionOptions.t -> db -> t
val commit : t -> unit
val rollback : t -> unit
val destroy : t -> unit
val with_t : db -> (t -> unit) -> unit
val get : ?pos:int -> ?len:int -> ?opts:ReadOptions.t -> t -> bigarray -> bigarray option
val get_string : ?pos:int -> ?len:int -> ?opts:ReadOptions.t -> t -> string -> string option
val put : ?key_pos:int -> ?key_len:int -> ?value_pos:int -> ?value_len:int -> ?opts:WriteOptions.t -> t -> bigarray -> bigarray -> unit
val put_string : ?key_pos:int -> ?key_len:int -> ?value_pos:int -> ?value_len:int -> ?opts:WriteOptions.t -> t -> string -> string -> unit
val delete : ?pos:int -> ?len:int -> ?opts:WriteOptions.t -> t -> bigarray -> unit
val delete_string : ?pos:int -> ?len:int -> ?opts:WriteOptions.t -> t -> string -> unit
val get_snapshot : t -> Snapshot.t
val free_snapshot : Snapshot.t -> unit
val create_iterator: ?opts:ReadOptions.t -> t -> iter
val with_iterator: ?opts:ReadOptions.t -> t -> f:(iter -> 'a) -> 'a
end
module type ROCKS = sig
module Options : module type of Options
module ReadOptions : module type of ReadOptions
module WriteOptions : module type of WriteOptions
module FlushOptions : module type of FlushOptions
module Cache : module type of Cache
module BlockBasedTableOptions : module type of BlockBasedTableOptions
module Snapshot : module type of Snapshot
module TransactionDbOptions : module type of TransactionDbOptions
type t
type batch
val get_pointer : t -> unit Ctypes.ptr
val open_db : ?opts:Options.t -> string -> t
val open_db_for_read_only : ?opts:Options.t -> string -> bool -> t
val open_transactiondb : ?opts:Options.t -> ?txnopts:TransactionDbOptions.t -> string -> t
val with_db : ?opts:Options.t -> string -> f:(t -> 'a) -> 'a
val close : t -> unit
val get : ?pos:int -> ?len:int -> ?opts:ReadOptions.t -> t -> bigarray -> bigarray option
val get_string : ?pos:int -> ?len:int -> ?opts:ReadOptions.t -> t -> string -> string option
val put : ?key_pos:int -> ?key_len:int -> ?value_pos:int -> ?value_len:int -> ?opts:WriteOptions.t -> t -> bigarray -> bigarray -> unit
val put_string : ?key_pos:int -> ?key_len:int -> ?value_pos:int -> ?value_len:int -> ?opts:WriteOptions.t -> t -> string -> string -> unit
val delete : ?pos:int -> ?len:int -> ?opts:WriteOptions.t -> t -> bigarray -> unit
val delete_string : ?pos:int -> ?len:int -> ?opts:WriteOptions.t -> t -> string -> unit
val write : ?opts:WriteOptions.t -> t -> batch -> unit
val flush : ?opts:FlushOptions.t -> t -> unit
val create_snapshot : t -> Snapshot.t
val release_snapshot : t -> Snapshot.t -> unit
val checkpoint_create : t -> string -> int -> unit
val property_value : t -> string -> string option
end