Move to kernel style SPDX license identifiers
[lttng-tools.git] / src / common / consumer / consumer-stream.h
CommitLineData
51230d70 1/*
ab5be9fa 2 * Copyright (C) 2013 David Goulet <dgoulet@efficios.com>
51230d70 3 *
ab5be9fa 4 * SPDX-License-Identifier: GPL-2.0-only
51230d70 5 *
51230d70
DG
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 */
20void 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 */
29void 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 */
37void 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 */
43void 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 */
52void consumer_stream_destroy(struct lttng_consumer_stream *stream,
53 struct lttng_ht *ht);
54
10a50311
JD
55/*
56 * Destroy the stream's buffers on the tracer side. This is also called in a
57 * stream destroy.
58 */
59void consumer_stream_destroy_buffers(struct lttng_consumer_stream *stream);
60
1c20f0e2
JD
61/*
62 * Write index of a specific stream either on the relayd or local disk.
63 */
64int consumer_stream_write_index(struct lttng_consumer_stream *stream,
50adc264 65 struct ctf_packet_index *index);
1c20f0e2 66
94d49140
JD
67int consumer_stream_sync_metadata(struct lttng_consumer_local_data *ctx,
68 uint64_t session_id);
69
d2956687 70/*
c35f9726 71 * Create the output files of a local stream.
d2956687
JG
72 *
73 * This must be called with the channel's and the stream's lock held.
74 */
75int 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 */
85int consumer_stream_rotate_output_files(struct lttng_consumer_stream *stream);
86
cdb72e4e
JG
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 */
94bool consumer_stream_is_deleted(struct lttng_consumer_stream *stream);
95
51230d70 96#endif /* LTTNG_CONSUMER_STREAM_H */
This page took 0.04439 seconds and 4 git commands to generate.