autodisc: make it possible to interrupt auto source discovery
[babeltrace.git] / src / autodisc / autodisc.h
CommitLineData
97010665
SM
1#ifndef AUTODISC_AUTODISC_H
2#define AUTODISC_AUTODISC_H
73760435
SM
3
4/*
5 * Copyright (c) 2019 EfficiOS Inc. and Linux Foundation
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
24 */
25
26#include <glib.h>
27
28#include <babeltrace2/babeltrace.h>
29
3dae1685
SM
30#define __BT_IN_BABELTRACE_H
31#include <babeltrace2/func-status.h>
32#undef __BT_IN_BABELTRACE_H
33
73760435
SM
34struct auto_source_discovery {
35 /* Array of `struct auto_source_discovery_result *`. */
36 GPtrArray *results;
37};
38
39/* Value type of the `auto_source_discovery::results` array. */
40
41struct auto_source_discovery_result {
42 /*
43 * `plugin_name` and `source_cc_name` are borrowed from the plugin and source
44 * component class (which outlive this structure).
45 */
46 const char *plugin_name;
47 const char *source_cc_name;
48
49 /*
50 * `group` is owned by this structure.
51 *
52 * May be NULL, to mean "no group".
53 */
54 gchar *group;
55
56 /* Array of input strings. */
57 bt_value *inputs;
1ead9076
SM
58
59 /*
60 * Array of integers: indices of the original inputs that contributed
61 * to this result.
62 */
63 bt_value *original_input_indices;
73760435
SM
64};
65
3dae1685
SM
66typedef enum auto_source_discovery_status {
67 AUTO_SOURCE_DISCOVERY_STATUS_OK = __BT_FUNC_STATUS_OK,
68 AUTO_SOURCE_DISCOVERY_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
69 AUTO_SOURCE_DISCOVERY_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
70 AUTO_SOURCE_DISCOVERY_STATUS_INTERRUPTED = __BT_FUNC_STATUS_INTERRUPTED,
71} auto_source_discovery_status;
72
73760435
SM
73int auto_source_discovery_init(struct auto_source_discovery *auto_disc);
74void auto_source_discovery_fini(struct auto_source_discovery *auto_disc);
75
76/*
77 * Given `inputs` a list of strings, query source component classes to discover
78 * which source components should be instantiated to deal with these inputs.
73760435
SM
79 */
80
3dae1685 81auto_source_discovery_status auto_discover_source_components(
73760435 82 const bt_value *inputs,
97010665
SM
83 const bt_plugin **plugins,
84 size_t plugin_count,
85 const char *component_class_restrict,
73760435 86 enum bt_logging_level log_level,
3dae1685
SM
87 struct auto_source_discovery *auto_disc,
88 const bt_interrupter *interrupter);
73760435 89
97010665 90#endif /* AUTODISC_AUTODISC_H */
This page took 0.029001 seconds and 4 git commands to generate.