2 * Copyright (C) 2013 - David Goulet <dgoulet@efficios.com>
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.
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
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.
18 #ifndef LTTNG_CONSUMER_STREAM_H
19 #define LTTNG_CONSUMER_STREAM_H
24 * Create a consumer stream.
26 * The channel lock MUST be acquired.
28 struct lttng_consumer_stream
*consumer_stream_create(
29 struct lttng_consumer_channel
*channel
,
32 enum lttng_consumer_stream_state state
,
33 const char *channel_name
,
40 enum consumer_channel_type type
,
41 unsigned int monitor
);
44 * Close stream's file descriptors and, if needed, close stream also on the
47 * The stream lock MUST be acquired.
48 * The consumer data lock MUST be acquired.
50 void consumer_stream_close(struct lttng_consumer_stream
*stream
);
53 * Close stream on the relayd side. This call can destroy a relayd if the
56 * A RCU read side lock MUST be acquired if the relayd object was looked up in
57 * a hash table before calling this.
59 void consumer_stream_relayd_close(struct lttng_consumer_stream
*stream
,
60 struct consumer_relayd_sock_pair
*relayd
);
63 * Delete the stream from all possible hash tables.
65 * The consumer data lock MUST be acquired.
67 void consumer_stream_delete(struct lttng_consumer_stream
*stream
,
71 * Free the given stream within a RCU call.
73 void consumer_stream_free(struct lttng_consumer_stream
*stream
);
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.
80 * This MUST be called WITHOUT the consumer data and stream lock acquired.
82 void consumer_stream_destroy(struct lttng_consumer_stream
*stream
,
86 * Destroy the stream's buffers on the tracer side. This is also called in a
89 void consumer_stream_destroy_buffers(struct lttng_consumer_stream
*stream
);
92 * Write index of a specific stream either on the relayd or local disk.
94 int consumer_stream_write_index(struct lttng_consumer_stream
*stream
,
95 struct ctf_packet_index
*index
);
97 int consumer_stream_sync_metadata(struct lttng_consumer_local_data
*ctx
,
101 * Enable metadata bucketization. This must only be enabled if the tracer
102 * provides a reliable metadata `coherent` flag.
104 * This must be called on initialization before any subbuffer is consumed.
106 int consumer_stream_enable_metadata_bucketization(
107 struct lttng_consumer_stream
*stream
);
109 #endif /* LTTNG_CONSUMER_STREAM_H */