Fix: consumerd: live client receives incomplete metadata
[lttng-tools.git] / src / common / consumer / consumer-stream.h
1 /*
2 * Copyright (C) 2013 - David Goulet <dgoulet@efficios.com>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License, version 2 only, as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 51
15 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 */
17
18 #ifndef LTTNG_CONSUMER_STREAM_H
19 #define LTTNG_CONSUMER_STREAM_H
20
21 #include "consumer.h"
22
23 /*
24 * Create a consumer stream.
25 *
26 * The channel lock MUST be acquired.
27 */
28 struct lttng_consumer_stream *consumer_stream_create(
29 struct lttng_consumer_channel *channel,
30 uint64_t channel_key,
31 uint64_t stream_key,
32 enum lttng_consumer_stream_state state,
33 const char *channel_name,
34 uid_t uid,
35 gid_t gid,
36 uint64_t relayd_id,
37 uint64_t session_id,
38 int cpu,
39 int *alloc_ret,
40 enum consumer_channel_type type,
41 unsigned int monitor);
42
43 /*
44 * Close stream's file descriptors and, if needed, close stream also on the
45 * relayd side.
46 *
47 * The stream lock MUST be acquired.
48 * The consumer data lock MUST be acquired.
49 */
50 void consumer_stream_close(struct lttng_consumer_stream *stream);
51
52 /*
53 * Close stream on the relayd side. This call can destroy a relayd if the
54 * conditions are met.
55 *
56 * A RCU read side lock MUST be acquired if the relayd object was looked up in
57 * a hash table before calling this.
58 */
59 void consumer_stream_relayd_close(struct lttng_consumer_stream *stream,
60 struct consumer_relayd_sock_pair *relayd);
61
62 /*
63 * Delete the stream from all possible hash tables.
64 *
65 * The consumer data lock MUST be acquired.
66 */
67 void consumer_stream_delete(struct lttng_consumer_stream *stream,
68 struct lttng_ht *ht);
69
70 /*
71 * Free the given stream within a RCU call.
72 */
73 void consumer_stream_free(struct lttng_consumer_stream *stream);
74
75 /*
76 * Destroy a stream completely. This will delete, close and free the stream.
77 * Once return, the stream is NO longer usable. Its channel may get destroyed
78 * if conditions are met.
79 *
80 * This MUST be called WITHOUT the consumer data and stream lock acquired.
81 */
82 void consumer_stream_destroy(struct lttng_consumer_stream *stream,
83 struct lttng_ht *ht);
84
85 /*
86 * Destroy the stream's buffers on the tracer side. This is also called in a
87 * stream destroy.
88 */
89 void consumer_stream_destroy_buffers(struct lttng_consumer_stream *stream);
90
91 /*
92 * Write index of a specific stream either on the relayd or local disk.
93 */
94 int consumer_stream_write_index(struct lttng_consumer_stream *stream,
95 struct ctf_packet_index *index);
96
97 int consumer_stream_sync_metadata(struct lttng_consumer_local_data *ctx,
98 uint64_t session_id);
99
100 /*
101 * Enable metadata bucketization. This must only be enabled if the tracer
102 * provides a reliable metadata `coherent` flag.
103 *
104 * This must be called on initialization before any subbuffer is consumed.
105 */
106 int consumer_stream_enable_metadata_bucketization(
107 struct lttng_consumer_stream *stream);
108
109 #endif /* LTTNG_CONSUMER_STREAM_H */
This page took 0.033471 seconds and 5 git commands to generate.