Remove extern "C" from internal headers
[lttng-tools.git] / src / common / trace-chunk-registry.h
CommitLineData
2c5ff4e4 1/*
ab5be9fa 2 * Copyright (C) 2019 Jérémie Galarneau <jeremie.galarneau@efficios.com>
2c5ff4e4 3 *
ab5be9fa 4 * SPDX-License-Identifier: LGPL-2.1-only
2c5ff4e4 5 *
2c5ff4e4
JG
6 */
7
8#ifndef LTTNG_TRACE_CHUNK_REGISTRY_H
9#define LTTNG_TRACE_CHUNK_REGISTRY_H
10
11#include <stddef.h>
12#include <stdint.h>
13#include <stdbool.h>
14#include <common/macros.h>
15#include <common/trace-chunk.h>
16
17struct lttng_trace_chunk_registry;
18
19/*
20 * Create an lttng_trace_chunk registry.
21 *
22 * A trace chunk registry maintains an association between a
23 * (session_id, chunk_id) tuple and a trace chunk object. The chunk_id can
24 * be "unset" in the case of an anonymous trace chunk.
25 *
26 * Note that a trace chunk registry holds no ownership of its trace
27 * chunks. Trace chunks are unpublished when their last reference is released.
28 * See the documentation of lttng_trace_chunk.
29 *
30 * Returns a trace chunk registry on success, NULL on error.
31 *
32 * Note that a trace chunk registry may only be accessed by an RCU thread.
33 */
2c5ff4e4
JG
34struct lttng_trace_chunk_registry *lttng_trace_chunk_registry_create(void);
35
36/*
37 * Destroy an lttng trace chunk registry. The registry must be emptied
38 * (i.e. all references to the trace chunks it contains must be released) before
39 * it is destroyed.
40 */
2c5ff4e4
JG
41void lttng_trace_chunk_registry_destroy(
42 struct lttng_trace_chunk_registry *registry);
43
44/*
45 * Publish a trace chunk for a given session id.
46 * A reference is acquired on behalf of the caller.
47 *
48 * The trace chunk that is returned is the published version of the trace
49 * chunk. The chunk provided should be discarded on success and it's
50 * published version used in its place.
51 *
52 * See the documentation of lttng_trace_chunk for more information on
53 * the usage of the various parameters.
54 *
55 * Returns an lttng_trace_chunk on success, NULL on error.
56 */
2c5ff4e4
JG
57struct lttng_trace_chunk *lttng_trace_chunk_registry_publish_chunk(
58 struct lttng_trace_chunk_registry *registry,
59 uint64_t session_id, struct lttng_trace_chunk *chunk);
60
61/*
62 * Look-up a trace chunk by session_id and chunk_id.
63 * A reference is acquired on behalf of the caller.
64 *
65 * Returns an lttng_trace_chunk on success, NULL if the chunk does not exist.
66 */
2c5ff4e4
JG
67struct lttng_trace_chunk *
68lttng_trace_chunk_registry_find_chunk(
69 const struct lttng_trace_chunk_registry *registry,
70 uint64_t session_id, uint64_t chunk_id);
71
6b584c2e
JG
72/*
73 * Query the existence of a trace chunk by session_id and chunk_id.
74 *
75 * Returns 0 on success, a negative value on error.
76 */
6b584c2e
JG
77int lttng_trace_chunk_registry_chunk_exists(
78 const struct lttng_trace_chunk_registry *registry,
79 uint64_t session_id, uint64_t chunk_id, bool *chunk_exists);
80
2c5ff4e4
JG
81/*
82 * Look-up an anonymous trace chunk by session_id.
83 * A reference is acquired on behalf of the caller.
84 *
85 * Returns an lttng_trace_chunk on success, NULL if the chunk does not exist.
86 */
2c5ff4e4
JG
87struct lttng_trace_chunk *
88lttng_trace_chunk_registry_find_anonymous_chunk(
89 const struct lttng_trace_chunk_registry *registry,
90 uint64_t session_id);
91
e10aec8f 92unsigned int lttng_trace_chunk_registry_put_each_chunk(
8ced4811 93 const struct lttng_trace_chunk_registry *registry);
e10aec8f 94
2c5ff4e4 95#endif /* LTTNG_TRACE_CHUNK_REGISTRY_H */
This page took 0.036866 seconds and 4 git commands to generate.