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