X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fconsumer%2Fconsumer-stream.h;h=c9af63cd83841c10a542e015aba3d6c3eb5fd69d;hp=0e1827c4a55382a4eabffdb78c832249317461de;hb=503fefca8a1b82cfafccaa096e900c41bf4570f6;hpb=ab5be9fa2eb5ba9600a82cd18fd3cfcbac69169a diff --git a/src/common/consumer/consumer-stream.h b/src/common/consumer/consumer-stream.h index 0e1827c4a..c9af63cd8 100644 --- a/src/common/consumer/consumer-stream.h +++ b/src/common/consumer/consumer-stream.h @@ -10,6 +10,30 @@ #include "consumer.h" +enum consumer_stream_open_packet_status { + CONSUMER_STREAM_OPEN_PACKET_STATUS_OPENED, + CONSUMER_STREAM_OPEN_PACKET_STATUS_NO_SPACE, + CONSUMER_STREAM_OPEN_PACKET_STATUS_ERROR, +}; + +/* + * Create a consumer stream. + * + * The channel lock MUST be acquired. + */ +struct lttng_consumer_stream *consumer_stream_create( + struct lttng_consumer_channel *channel, + uint64_t channel_key, + uint64_t stream_key, + const char *channel_name, + uint64_t relayd_id, + uint64_t session_id, + struct lttng_trace_chunk *trace_chunk, + int cpu, + int *alloc_ret, + enum consumer_channel_type type, + unsigned int monitor); + /* * Close stream's file descriptors and, if needed, close stream also on the * relayd side. @@ -93,4 +117,53 @@ int consumer_stream_rotate_output_files(struct lttng_consumer_stream *stream); */ bool consumer_stream_is_deleted(struct lttng_consumer_stream *stream); +/* + * Enable metadata bucketization. This must only be enabled if the tracer + * provides a reliable metadata `coherent` flag. + * + * This must be called on initialization before any subbuffer is consumed. + */ +int consumer_stream_enable_metadata_bucketization( + struct lttng_consumer_stream *stream); + +/* + * Set the version of a metadata stream (i.e. following a metadata + * regeneration). + * + * Changing the version of a metadata stream will cause any bucketized metadata + * to be discarded and will mark the metadata stream for future `reset`. + */ +void consumer_stream_metadata_set_version( + struct lttng_consumer_stream *stream, uint64_t new_version); + +/* + * Set the version of a metadata stream (i.e. following a metadata + * regeneration). + * + * Changing the version of a metadata stream will cause any bucketized metadata + * to be discarded and will mark the metadata stream for future `reset`. + */ +void consumer_stream_metadata_set_version( + struct lttng_consumer_stream *stream, uint64_t new_version); + +/* + * Attempt to open a packet in a stream. + * + * This function must be called with the stream and channel locks held. + */ +enum consumer_stream_open_packet_status consumer_stream_open_packet( + struct lttng_consumer_stream *stream); + +/* + * Flush a stream's buffer. + * + * producer_active: if true, causes a flush to occur only if there is + * content present in the current sub-buffer. If false, forces a flush to take + * place (otherwise known as "flush_empty"). + * + * This function must be called with the stream and channel locks held. + */ +int consumer_stream_flush_buffer(struct lttng_consumer_stream *stream, + bool producer_active); + #endif /* LTTNG_CONSUMER_STREAM_H */