Cleanup: remove private babeltrace.h
[babeltrace.git] / src / plugins / ctf / fs-sink / fs-sink-trace.h
1 #ifndef BABELTRACE_PLUGIN_CTF_FS_SINK_FS_SINK_TRACE_H
2 #define BABELTRACE_PLUGIN_CTF_FS_SINK_FS_SINK_TRACE_H
3
4 /*
5 * Copyright 2019 Philippe Proulx <pproulx@efficios.com>
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 "common/macros.h"
27 #include <babeltrace2/babeltrace.h>
28 #include "ctfser/ctfser.h"
29 #include <glib.h>
30 #include <stdbool.h>
31 #include <stdint.h>
32
33 #include "fs-sink-ctf-meta.h"
34
35 struct fs_sink_comp;
36
37 struct fs_sink_trace {
38 struct fs_sink_comp *fs_sink;
39
40 /* Owned by this */
41 struct fs_sink_ctf_trace_class *tc;
42
43 /*
44 * Weak reference: this object does not own it, and `tc` above
45 * does not own its trace IR trace class either. Instead, we add
46 * a "trace destruction" listener (in create_trace()) so that
47 * this object gets destroyed when the trace object is
48 * destroyed.
49 *
50 * Otherwise (with a strong reference), we would keep this trace
51 * object alive until the upstream message iterator ends. This
52 * could "leak" resources (memory, file descriptors) associated
53 * to traces and streams which otherwise would not exist.
54 */
55 const bt_trace *ir_trace;
56
57 uint64_t ir_trace_destruction_listener_id;
58
59 /* Trace's directory */
60 GString *path;
61
62 /* `metadata` file path */
63 GString *metadata_path;
64
65 /*
66 * Hash table of `const bt_stream *` (weak) to
67 * `struct fs_sink_stream *` (owned by hash table).
68 */
69 GHashTable *streams;
70 };
71
72 BT_HIDDEN
73 struct fs_sink_trace *fs_sink_trace_create(struct fs_sink_comp *fs_sink,
74 const bt_trace *ir_trace);
75
76 BT_HIDDEN
77 void fs_sink_trace_destroy(struct fs_sink_trace *trace);
78
79 #endif /* BABELTRACE_PLUGIN_CTF_FS_SINK_FS_SINK_TRACE_H */
This page took 0.031773 seconds and 4 git commands to generate.