Remove stdbool.h includes from C++ files
[babeltrace.git] / src / plugins / ctf / fs-src / data-stream-file.hpp
1 /*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright (C) 2016 Philippe Proulx <pproulx@efficios.com>
5 */
6
7 #ifndef CTF_FS_DS_FILE_H
8 #define CTF_FS_DS_FILE_H
9
10 #include <glib.h>
11 #include <stdio.h>
12
13 #include <babeltrace2/babeltrace.h>
14
15 #include "common/macros.h"
16
17 #include "../common/msg-iter/msg-iter.hpp"
18 #include "lttng-index.hpp"
19
20 struct ctf_fs_component;
21 struct ctf_fs_file;
22 struct ctf_fs_trace;
23 struct ctf_fs_ds_file;
24 struct ctf_fs_ds_file_group;
25 struct ctf_fs_ds_group_medops_data;
26
27 struct ctf_fs_ds_file_info
28 {
29 /* Owned by this. */
30 GString *path;
31
32 /* Guaranteed to be set, as opposed to the index. */
33 int64_t begin_ns;
34 };
35
36 struct ctf_fs_metadata;
37
38 struct ctf_fs_ds_file
39 {
40 bt_logging_level log_level;
41
42 /* Weak */
43 bt_self_component *self_comp;
44
45 /* Weak */
46 struct ctf_fs_metadata *metadata;
47
48 /* Owned by this */
49 struct ctf_fs_file *file;
50
51 /* Owned by this */
52 bt_stream *stream;
53
54 void *mmap_addr;
55
56 /*
57 * Max length of chunk to mmap() when updating the current mapping.
58 * This value must be page-aligned.
59 */
60 size_t mmap_max_len;
61
62 /* Length of the current mapping. Never exceeds the file's length. */
63 size_t mmap_len;
64
65 /* Offset in the file where the current mapping starts. */
66 off_t mmap_offset_in_file;
67
68 /*
69 * Offset, in the current mapping, of the address to return on the next
70 * request.
71 */
72 off_t request_offset_in_mapping;
73 };
74
75 struct ctf_fs_ds_file *ctf_fs_ds_file_create(struct ctf_fs_trace *ctf_fs_trace, bt_stream *stream,
76 const char *path, bt_logging_level log_level);
77
78 void ctf_fs_ds_file_destroy(struct ctf_fs_ds_file *stream);
79
80 struct ctf_fs_ds_index *ctf_fs_ds_file_build_index(struct ctf_fs_ds_file *ds_file,
81 struct ctf_fs_ds_file_info *ds_file_info,
82 struct ctf_msg_iter *msg_iter);
83
84 struct ctf_fs_ds_index *ctf_fs_ds_index_create(bt_logging_level log_level,
85 bt_self_component *self_comp);
86
87 void ctf_fs_ds_index_destroy(struct ctf_fs_ds_index *index);
88
89 /*
90 * Medium operations to iterate on a single ctf_fs_ds_file.
91 *
92 * The data pointer when using this must be a pointer to the ctf_fs_ds_file.
93 */
94 extern struct ctf_msg_iter_medium_ops ctf_fs_ds_file_medops;
95
96 /*
97 * Medium operations to iterate on the packet of a ctf_fs_ds_group.
98 *
99 * The iteration is done based on the index of the group.
100 *
101 * The data pointer when using these medops must be a pointer to a ctf_fs_ds
102 * group_medops_data structure.
103 */
104 extern struct ctf_msg_iter_medium_ops ctf_fs_ds_group_medops;
105
106 enum ctf_msg_iter_medium_status ctf_fs_ds_group_medops_data_create(
107 struct ctf_fs_ds_file_group *ds_file_group, bt_self_message_iterator *self_msg_iter,
108 bt_logging_level log_level, struct ctf_fs_ds_group_medops_data **out);
109
110 void ctf_fs_ds_group_medops_data_reset(struct ctf_fs_ds_group_medops_data *data);
111
112 void ctf_fs_ds_group_medops_data_destroy(struct ctf_fs_ds_group_medops_data *data);
113
114 #endif /* CTF_FS_DS_FILE_H */
This page took 0.032324 seconds and 4 git commands to generate.