Skip to content

Commit e424f75

Browse files
committed
Add mlis for observer_helpers and observer_skeleton
Signed-off-by: Steven Woods <[email protected]>
1 parent 80bd494 commit e424f75

File tree

3 files changed

+273
-1
lines changed

3 files changed

+273
-1
lines changed
Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
val queue_name : string
2+
3+
val default_path : string
4+
5+
module Errors : sig
6+
type error =
7+
| Internal_error of string
8+
| Unimplemented of string
9+
| Unknown_error
10+
11+
val typ_of_error : error Rpc.Types.typ
12+
13+
val error : error Rpc.Types.def
14+
end
15+
16+
exception Observer_error of Errors.error
17+
18+
type debug_info = string
19+
20+
(** ObserverAPI contains the declarations for the RPCs which are sent to
21+
Observer modules when the corresponding function is called on the Observer
22+
see ocaml/libs/tracing/ and ocaml/xapi/xapi_observer.ml *)
23+
module ObserverAPI : functor (R : Idl.RPC) -> sig
24+
val description : Idl.Interface.description
25+
26+
val implementation : R.implementation
27+
28+
val create :
29+
( debug_info
30+
-> string
31+
-> string
32+
-> (string * string) list
33+
-> string list
34+
-> bool
35+
-> (unit, Errors.error) R.comp
36+
)
37+
R.res
38+
(** [create dbg uuid name attributes endpoints enabled] is for when the
39+
Observer is created. [uuid] is the Observer which has been created and
40+
the parameters following are the fields the Observer was created with. *)
41+
42+
val destroy : (debug_info -> string -> (unit, Errors.error) R.comp) R.res
43+
(** [destroy dbg uuid] is for when the Observer is destroyed. [uuid]
44+
is the Observer which has been destroyed.*)
45+
46+
val set_enabled :
47+
(debug_info -> string -> bool -> (unit, Errors.error) R.comp) R.res
48+
(** [set_enabled dbg uuid enabled] is for when the Observer's enabled
49+
field is set to [enabled]. *)
50+
51+
val set_attributes :
52+
( debug_info
53+
-> string
54+
-> (string * string) list
55+
-> (unit, Errors.error) R.comp
56+
)
57+
R.res
58+
(** [set_attributes dbg uuid attributes] is for when the Observer's
59+
attributes field is set to [attributes]. *)
60+
61+
val set_endpoints :
62+
(debug_info -> string -> string list -> (unit, Errors.error) R.comp) R.res
63+
(** [set_endpoints dbg uuid endpoints] is for when the Observer's endpoints
64+
field is set to [endpoints]. *)
65+
66+
val init : (debug_info -> (unit, Errors.error) R.comp) R.res
67+
(** [init dbg] is for when tracing is first initialised *)
68+
69+
val set_trace_log_dir :
70+
(debug_info -> string -> (unit, Errors.error) R.comp) R.res
71+
(** [set_trace_log_dir dbg dir] is for when the destination of the
72+
trace logs is set to [dir]. *)
73+
74+
val set_export_interval :
75+
(debug_info -> float -> (unit, Errors.error) R.comp) R.res
76+
(** [set_export_interval dbg interval] is for when the interval between trace
77+
exports is set to [interval]. *)
78+
79+
val set_max_spans : (debug_info -> int -> (unit, Errors.error) R.comp) R.res
80+
(** [set_max_spans dbg spans] is for when the max number of spans is
81+
set to [spans]. *)
82+
83+
val set_max_traces : (debug_info -> int -> (unit, Errors.error) R.comp) R.res
84+
(** [set_max_traces dbg traces] is for when the max number of traces is
85+
set to [traces]. *)
86+
87+
val set_max_file_size :
88+
(debug_info -> int -> (unit, Errors.error) R.comp) R.res
89+
(** [set_max_file_size dbg file_size] is for when the max size of a trace file
90+
is set to [file_size]. *)
91+
92+
val set_host_id : (debug_info -> string -> (unit, Errors.error) R.comp) R.res
93+
(** [set_host_id dbg host_id] is for when the host to be traced is
94+
set to [host_id]. *)
95+
96+
val set_compress_tracing_files :
97+
(debug_info -> bool -> (unit, Errors.error) R.comp) R.res
98+
(** [set_compress_tracing_files dbg enabled] is for when the compression of
99+
tracing files is enabled/disabled according to [enabled]. *)
100+
end
101+
102+
(** A Server_impl module will define how the Server responds to ObserverAPI calls *)
103+
module type Server_impl = sig
104+
type context = unit
105+
106+
val create :
107+
context
108+
-> dbg:debug_info
109+
-> uuid:string
110+
-> name_label:string
111+
-> attributes:(string * string) list
112+
-> endpoints:string list
113+
-> enabled:bool
114+
-> unit
115+
116+
val destroy : context -> dbg:debug_info -> uuid:string -> unit
117+
118+
val set_enabled :
119+
context -> dbg:debug_info -> uuid:string -> enabled:bool -> unit
120+
121+
val set_attributes :
122+
context
123+
-> dbg:debug_info
124+
-> uuid:string
125+
-> attributes:(string * string) list
126+
-> unit
127+
128+
val set_endpoints :
129+
context -> dbg:debug_info -> uuid:string -> endpoints:string list -> unit
130+
131+
val init : context -> dbg:debug_info -> unit
132+
133+
val set_trace_log_dir : context -> dbg:debug_info -> dir:string -> unit
134+
135+
val set_export_interval : context -> dbg:debug_info -> interval:float -> unit
136+
137+
val set_max_spans : context -> dbg:debug_info -> spans:int -> unit
138+
139+
val set_max_traces : context -> dbg:debug_info -> traces:int -> unit
140+
141+
val set_max_file_size : context -> dbg:debug_info -> file_size:int -> unit
142+
143+
val set_host_id : context -> dbg:debug_info -> host_id:string -> unit
144+
145+
val set_compress_tracing_files :
146+
context -> dbg:debug_info -> enabled:bool -> unit
147+
end
148+
149+
(** A Server for receiving ObserverAPI calls *)
150+
module Server : functor (_ : Server_impl) () -> sig
151+
module S : sig
152+
val create :
153+
( debug_info
154+
-> string
155+
-> string
156+
-> (string * string) list
157+
-> string list
158+
-> bool
159+
-> unit
160+
)
161+
-> unit
162+
163+
val destroy : (debug_info -> string -> unit) -> unit
164+
165+
val set_enabled : (debug_info -> string -> bool -> unit) -> unit
166+
167+
val set_attributes :
168+
(debug_info -> string -> (string * string) list -> unit) -> unit
169+
170+
val set_endpoints : (debug_info -> string -> string list -> unit) -> unit
171+
172+
val init : (debug_info -> unit) -> unit
173+
174+
val set_trace_log_dir : (debug_info -> string -> unit) -> unit
175+
176+
val set_export_interval : (debug_info -> float -> unit) -> unit
177+
178+
val set_max_spans : (debug_info -> int -> unit) -> unit
179+
180+
val set_max_traces : (debug_info -> int -> unit) -> unit
181+
182+
val set_max_file_size : (debug_info -> int -> unit) -> unit
183+
184+
val set_host_id : (debug_info -> string -> unit) -> unit
185+
186+
val set_compress_tracing_files : (debug_info -> bool -> unit) -> unit
187+
end
188+
189+
val process : Rpc.call -> Rpc.response
190+
end
191+
192+
(** A client for sending ObserverAPI calls to the above queue_name *)
193+
module Client : sig
194+
val create :
195+
debug_info
196+
-> string
197+
-> string
198+
-> (string * string) list
199+
-> string list
200+
-> bool
201+
-> unit
202+
203+
val destroy : debug_info -> string -> unit
204+
205+
val set_enabled : debug_info -> string -> bool -> unit
206+
207+
val set_attributes : debug_info -> string -> (string * string) list -> unit
208+
209+
val set_endpoints : debug_info -> string -> string list -> unit
210+
211+
val init : debug_info -> unit
212+
213+
val set_trace_log_dir : debug_info -> string -> unit
214+
215+
val set_export_interval : debug_info -> float -> unit
216+
217+
val set_max_spans : debug_info -> int -> unit
218+
219+
val set_max_traces : debug_info -> int -> unit
220+
221+
val set_max_file_size : debug_info -> int -> unit
222+
223+
val set_host_id : debug_info -> string -> unit
224+
225+
val set_compress_tracing_files : debug_info -> bool -> unit
226+
end
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
(** This module provides dummy implementations for each Observer function.
2+
These are intended to be used to fill in the functions that the module will
3+
not ever use, as they will raise an Unimplemented error if called *)
4+
module Observer : sig
5+
type context = unit
6+
7+
val create :
8+
context
9+
-> dbg:string
10+
-> uuid:string
11+
-> name_label:string
12+
-> attributes:(string * string) list
13+
-> endpoints:string list
14+
-> enabled:bool
15+
-> unit
16+
17+
val destroy : context -> dbg:string -> uuid:string -> unit
18+
19+
val set_enabled : context -> dbg:string -> uuid:string -> enabled:bool -> unit
20+
21+
val set_attributes :
22+
context
23+
-> dbg:string
24+
-> uuid:string
25+
-> attributes:(string * string) list
26+
-> unit
27+
28+
val set_endpoints :
29+
context -> dbg:string -> uuid:string -> endpoints:string list -> unit
30+
31+
val init : context -> dbg:string -> unit
32+
33+
val set_trace_log_dir : context -> dbg:string -> dir:string -> unit
34+
35+
val set_export_interval : context -> dbg:string -> interval:float -> unit
36+
37+
val set_max_spans : context -> dbg:string -> spans:int -> unit
38+
39+
val set_max_traces : context -> dbg:string -> traces:int -> unit
40+
41+
val set_max_file_size : context -> dbg:string -> file_size:int -> unit
42+
43+
val set_host_id : context -> dbg:string -> host_id:string -> unit
44+
45+
val set_compress_tracing_files : context -> dbg:string -> enabled:bool -> unit
46+
end

quality-gate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ verify-cert () {
2525
}
2626

2727
mli-files () {
28-
N=469
28+
N=467
2929
X="ocaml/tests"
3030
X+="|ocaml/quicktest"
3131
X+="|ocaml/message-switch/core_test"

0 commit comments

Comments
 (0)