Move to kernel style SPDX license identifiers
[lttng-tools.git] / src / common / consumer / consumer-stream.h
1 /*
2 * Copyright (C) 2013 David Goulet <dgoulet@efficios.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 */
7
8 #ifndef LTTNG_CONSUMER_STREAM_H
9 #define LTTNG_CONSUMER_STREAM_H
10
11 #include "consumer.h"
12
13 /*
14 * Close stream's file descriptors and, if needed, close stream also on the
15 * relayd side.
16 *
17 * The stream lock MUST be acquired.
18 * The consumer data lock MUST be acquired.
19 */
20 void consumer_stream_close(struct lttng_consumer_stream *stream);
21
22 /*
23 * Close stream on the relayd side. This call can destroy a relayd if the
24 * conditions are met.
25 *
26 * A RCU read side lock MUST be acquired if the relayd object was looked up in
27 * a hash table before calling this.
28 */
29 void consumer_stream_relayd_close(struct lttng_consumer_stream *stream,
30 struct consumer_relayd_sock_pair *relayd);
31
32 /*
33 * Delete the stream from all possible hash tables.
34 *
35 * The consumer data lock MUST be acquired.
36 */
37 void consumer_stream_delete(struct lttng_consumer_stream *stream,
38 struct lttng_ht *ht);
39
40 /*
41 * Free the given stream within a RCU call.
42 */
43 void consumer_stream_free(struct lttng_consumer_stream *stream);
44
45 /*
46 * Destroy a stream completely. This will delete, close and free the stream.
47 * Once return, the stream is NO longer usable. Its channel may get destroyed
48 * if conditions are met.
49 *
50 * This MUST be called WITHOUT the consumer data and stream lock acquired.
51 */
52 void consumer_stream_destroy(struct lttng_consumer_stream *stream,
53 struct lttng_ht *ht);
54
55 /*
56 * Destroy the stream's buffers on the tracer side. This is also called in a
57 * stream destroy.
58 */
59 void consumer_stream_destroy_buffers(struct lttng_consumer_stream *stream);
60
61 /*
62 * Write index of a specific stream either on the relayd or local disk.
63 */
64 int consumer_stream_write_index(struct lttng_consumer_stream *stream,
65 struct ctf_packet_index *index);
66
67 int consumer_stream_sync_metadata(struct lttng_consumer_local_data *ctx,
68 uint64_t session_id);
69
70 /*
71 * Create the output files of a local stream.
72 *
73 * This must be called with the channel's and the stream's lock held.
74 */
75 int consumer_stream_create_output_files(struct lttng_consumer_stream *stream,
76 bool create_index);
77
78 /*
79 * Rotate the output files of a local stream. This will change the
80 * active output files of both the binary and index in accordance
81 * with the stream's configuration (stream file count).
82 *
83 * This must be called with the channel's and the stream's lock held.
84 */
85 int consumer_stream_rotate_output_files(struct lttng_consumer_stream *stream);
86
87 /*
88 * Indicates whether or not a stream is logically deleted. A deleted stream
89 * should no longer be used; its existence is only garanteed by the RCU lock
90 * held by the caller.
91 *
92 * This function must be called with the RCU read side lock held.
93 */
94 bool consumer_stream_is_deleted(struct lttng_consumer_stream *stream);
95
96 #endif /* LTTNG_CONSUMER_STREAM_H */
This page took 0.031605 seconds and 5 git commands to generate.