-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathoptions.rs
243 lines (242 loc) · 11.1 KB
/
options.rs
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
// /// Produces a new <code>TypeDBOptions</code> object.
// #[no_mangle]
// pub extern "C" fn options_new() -> *mut Options {
// release(Options::new())
// }
//
// /// Frees the native rust <code>Options</code> object.
// #[no_mangle]
// pub extern "C" fn options_drop(options: *mut Options) {
// free(options);
// }
//
// /// Explicitly enables or disables inference.
// /// Only settable at transaction level and above. Only affects read transactions.
// #[no_mangle]
// pub extern "C" fn options_set_infer(options: *mut Options, infer: bool) {
// borrow_mut(options).infer = Some(infer)
// }
//
// /// Explicitly enables or disables reasoning tracing.
// /// If set to <code>true</code>, reasoning tracing graphs are output in the logging directory.
// /// Should be used with <code>parallel = False</code>.
// #[no_mangle]
// pub extern "C" fn options_set_trace_inference(options: *mut Options, trace_inference: bool) {
// borrow_mut(options).trace_inference = Some(trace_inference);
// }
//
// /// Explicitly enables or disables explanations.
// /// If set to <code>true</code>, enables explanations for queries. Only affects read transactions.
// #[no_mangle]
// pub extern "C" fn options_set_explain(options: *mut Options, explain: bool) {
// borrow_mut(options).explain = Some(explain);
// }
//
// /// Explicitly enables or disables parallel execution.
// /// If set to <code>true</code>, the server uses parallel instead of single-threaded execution.
// #[no_mangle]
// pub extern "C" fn options_set_parallel(options: *mut Options, parallel: bool) {
// borrow_mut(options).parallel = Some(parallel);
// }
//
// /// Explicitly enables or disables prefetching.
// /// If set to <code>true</code>, the first batch of answers is streamed to the driver even without
// /// an explicit request for it.
// #[no_mangle]
// pub extern "C" fn options_set_prefetch(options: *mut Options, prefetch: bool) {
// borrow_mut(options).prefetch = Some(prefetch);
// }
//
// /// Explicitly sets a prefetch size.
// /// If set, specifies a guideline number of answers that the server should send before the driver
// /// issues a fresh request.
// ///
// /// @param prefetchSize Number of answers that the server should send before the driver issues a fresh request
// #[no_mangle]
// pub extern "C" fn options_set_prefetch_size(options: *mut Options, prefetch_size: i32) {
// borrow_mut(options).prefetch_size = Some(prefetch_size);
// }
//
// /// Explicitly sets a session idle timeout.
// /// If set, specifies a timeout that allows the server to close sessions if the driver terminates
// /// or becomes unresponsive.
// #[no_mangle]
// pub extern "C" fn options_set_session_idle_timeout_millis(options: *mut Options, timeout_millis: i64) {
// borrow_mut(options).session_idle_timeout = Some(Duration::from_millis(timeout_millis as u64));
// }
//
// /// Explicitly set a transaction timeout.
// /// If set, specifies a timeout for killing transactions automatically, preventing memory leaks
// /// in unclosed transactions.
// #[no_mangle]
// pub extern "C" fn options_set_transaction_timeout_millis(options: *mut Options, timeout_millis: i64) {
// borrow_mut(options).transaction_timeout = Some(Duration::from_millis(timeout_millis as u64));
// }
//
// /// Explicitly sets schema lock acquire timeout.
// /// If set, specifies how long the driver should wait if opening a session or transaction is blocked
// /// by a schema write lock.
// #[no_mangle]
// pub extern "C" fn options_set_schema_lock_acquire_timeout_millis(options: *mut Options, timeout_millis: i64) {
// borrow_mut(options).schema_lock_acquire_timeout = Some(Duration::from_millis(timeout_millis as u64));
// }
//
// /// Explicitly enables or disables reading data from any replica.
// /// If set to <code>True</code>, enables reading data from any replica, potentially boosting read throughput.
// /// Only settable in TypeDB Cloud.
// #[no_mangle]
// pub extern "C" fn options_set_read_any_replica(options: *mut Options, read_any_replica: bool) {
// borrow_mut(options).read_any_replica = Some(read_any_replica);
// }
//
// /// Returns the value set for the inference in this <code>TypeDBOptions</code> object.
// #[no_mangle]
// pub extern "C" fn options_get_infer(options: *const Options) -> bool {
// borrow(options).infer.unwrap()
// }
//
// /// Returns the value set for reasoning tracing in this <code>TypeDBOptions</code> object.
// /// If set to <code>true</code>, reasoning tracing graphs are output in the logging directory.
// #[no_mangle]
// pub extern "C" fn options_get_trace_inference(options: *const Options) -> bool {
// borrow(options).trace_inference.unwrap()
// }
//
// ///Returns the value set for the explanation in this <code>TypeDBOptions</code> object.
// /// If set to <code>true</code>, explanations for queries are enabled.
// #[no_mangle]
// pub extern "C" fn options_get_explain(options: *const Options) -> bool {
// borrow(options).explain.unwrap()
// }
//
// /// Returns the value set for the parallel execution in this <code>TypeDBOptions</code> object.
// /// If set to <code>true</code>, the server uses parallel instead of single-threaded execution.
// #[no_mangle]
// pub extern "C" fn options_get_parallel(options: *const Options) -> bool {
// borrow(options).parallel.unwrap()
// }
//
// /// Returns the value set for the prefetching in this <code>TypeDBOptions</code> object.
// /// If set to <code>true</code>, the first batch of answers is streamed to the driver even without
// /// an explicit request for it.
// #[no_mangle]
// pub extern "C" fn options_get_prefetch(options: *const Options) -> bool {
// borrow(options).prefetch.unwrap()
// }
//
// /// Returns the value set for the prefetch size in this <code>TypeDBOptions</code> object.
// /// If set, specifies a guideline number of answers that the server should send before the driver
// /// issues a fresh request.
// #[no_mangle]
// pub extern "C" fn options_get_prefetch_size(options: *const Options) -> i32 {
// borrow(options).prefetch_size.unwrap()
// }
//
// /// Returns the value set for the session idle timeout in this <code>TypeDBOptions</code> object.
// /// If set, specifies a timeout that allows the server to close sessions if the driver terminates
// /// or becomes unresponsive.
// #[no_mangle]
// pub extern "C" fn options_get_session_idle_timeout_millis(options: *const Options) -> i64 {
// borrow(options).session_idle_timeout.unwrap().as_millis() as i64
// }
//
// /// Returns the value set for the transaction timeout in this <code>TypeDBOptions</code> object.
// /// If set, specifies a timeout for killing transactions automatically, preventing memory leaks
// /// in unclosed transactions.
// #[no_mangle]
// pub extern "C" fn options_get_transaction_timeout_millis(options: *const Options) -> i64 {
// borrow(options).transaction_timeout.unwrap().as_millis() as i64
// }
//
// /// Returns the value set for the schema lock acquire timeout in this <code>TypeDBOptions</code> object.
// /// If set, specifies how long the driver should wait if opening a session or transaction is blocked
// /// by a schema write lock.
// #[no_mangle]
// pub extern "C" fn options_get_schema_lock_acquire_timeout_millis(options: *const Options) -> i64 {
// borrow(options).schema_lock_acquire_timeout.unwrap().as_millis() as i64
// }
//
// /// Returns the value set for reading data from any replica in this <code>TypeDBOptions</code> object.
// /// If set to <code>True</code>, enables reading data from any replica, potentially boosting read throughput.
// #[no_mangle]
// pub extern "C" fn options_get_read_any_replica(options: *const Options) -> bool {
// borrow(options).read_any_replica.unwrap()
// }
//
// /// Checks whether the option for inference was explicitly set for this <code>TypeDBOptions</code> object.
// #[no_mangle]
// pub extern "C" fn options_has_infer(options: *const Options) -> bool {
// borrow(options).infer.is_some()
// }
//
// /// Checks whether the option for reasoning tracing was explicitly set for this <code>TypeDBOptions</code> object.
// #[no_mangle]
// pub extern "C" fn options_has_trace_inference(options: *const Options) -> bool {
// borrow(options).trace_inference.is_some()
// }
//
// /// Checks whether the option for explanation was explicitly set for this <code>TypeDBOptions</code> object.
// #[no_mangle]
// pub extern "C" fn options_has_explain(options: *const Options) -> bool {
// borrow(options).explain.is_some()
// }
//
// /// Checks whether the option for parallel execution was explicitly set for this <code>TypeDBOptions</code> object.
// #[no_mangle]
// pub extern "C" fn options_has_parallel(options: *const Options) -> bool {
// borrow(options).parallel.is_some()
// }
//
// /// Checks whether the option for prefetching was explicitly set for this <code>TypeDBOptions</code> object.
// #[no_mangle]
// pub extern "C" fn options_has_prefetch(options: *const Options) -> bool {
// borrow(options).prefetch.is_some()
// }
//
// /// Checks whether the option for prefetch size was explicitly set for this <code>TypeDBOptions</code> object.
// #[no_mangle]
// pub extern "C" fn options_has_prefetch_size(options: *const Options) -> bool {
// borrow(options).prefetch_size.is_some()
// }
//
// /// Checks whether the option for the session idle timeout was explicitly set for this <code>TypeDBOptions</code> object.
// #[no_mangle]
// pub extern "C" fn options_has_session_idle_timeout_millis(options: *const Options) -> bool {
// borrow(options).session_idle_timeout.is_some()
// }
//
// /// Checks whether the option for transaction timeout was explicitly set for this <code>TypeDBOptions</code> object.
// #[no_mangle]
// pub extern "C" fn options_has_transaction_timeout_millis(options: *const Options) -> bool {
// borrow(options).transaction_timeout.is_some()
// }
//
// /// Checks whether the option for schema lock acquire timeout was explicitly set for this <code>TypeDBOptions</code> object.
// #[no_mangle]
// pub extern "C" fn options_has_schema_lock_acquire_timeout_millis(options: *const Options) -> bool {
// borrow(options).schema_lock_acquire_timeout.is_some()
// }
//
// /// Checks whether the option for reading data from any replica was explicitly set for this <code>TypeDBOptions</code> object.
// #[no_mangle]
// pub extern "C" fn options_has_read_any_replica(options: *const Options) -> bool {
// borrow(options).read_any_replica.is_some()
// }