docs: Add supported versions and fix-backport policy
[lttng-tools.git] / src / common / consumer / consumer-metadata-cache.hpp
CommitLineData
331744e3 1/*
ab5be9fa
MJ
2 * Copyright (C) 2013 Julien Desfossez <jdesfossez@efficios.com>
3 * Copyright (C) 2013 David Goulet <dgoulet@efficios.com>
331744e3 4 *
ab5be9fa 5 * SPDX-License-Identifier: GPL-2.0-only
331744e3 6 *
331744e3
JD
7 */
8
9#ifndef CONSUMER_METADATA_CACHE_H
10#define CONSUMER_METADATA_CACHE_H
11
c9e313bc
SM
12#include <common/consumer/consumer.hpp>
13#include <common/dynamic-buffer.hpp>
331744e3 14
b1316da1
JG
15enum consumer_metadata_cache_write_status {
16 CONSUMER_METADATA_CACHE_WRITE_STATUS_ERROR = -1,
17 /*
18 * New metadata content was appended to the cache successfully.
19 * Previously available content remains valid.
20 */
21 CONSUMER_METADATA_CACHE_WRITE_STATUS_APPENDED_CONTENT = 0,
22 /*
23 * The new content pushed to the cache invalidated the content that
24 * was already present. The contents of the cache should be re-read.
25 */
26 CONSUMER_METADATA_CACHE_WRITE_STATUS_INVALIDATED,
27 /*
28 * A metadata cache write can simply overwrite an already existing
29 * section of the cache (and it should be a write-through with identical
30 * data). From the caller's standpoint, there is no change to the state
31 * of the cache.
32 */
33 CONSUMER_METADATA_CACHE_WRITE_STATUS_NO_CHANGE,
34};
35
331744e3 36struct consumer_metadata_cache {
9eac9828 37 /* Current version of the metadata cache. */
93ec662e 38 uint64_t version;
331744e3 39 /*
9eac9828 40 * Size is the upper-limit of data written inside the buffer.
c585821b 41 * All cached data is contiguous.
331744e3 42 */
9eac9828 43 struct lttng_dynamic_buffer contents;
331744e3
JD
44 /*
45 * Lock to update the metadata cache and push into the ring_buffer
b623cb6a 46 * (lttng_ust_ctl_write_metadata_to_channel).
73811ecc
DG
47 *
48 * This is nested INSIDE the consumer_data lock.
331744e3
JD
49 */
50 pthread_mutex_t lock;
51};
52
b1316da1 53enum consumer_metadata_cache_write_status
a25d34bc 54consumer_metadata_cache_write(struct consumer_metadata_cache *cache,
28f23191
JG
55 unsigned int offset,
56 unsigned int len,
57 uint64_t version,
58 const char *data);
331744e3
JD
59int consumer_metadata_cache_allocate(struct lttng_consumer_channel *channel);
60void consumer_metadata_cache_destroy(struct lttng_consumer_channel *channel);
f40b76ae
JG
61void consumer_wait_metadata_cache_flushed(struct lttng_consumer_channel *channel,
62 uint64_t offset,
63 bool invoked_by_timer);
331744e3
JD
64
65#endif /* CONSUMER_METADATA_CACHE_H */
This page took 0.079131 seconds and 4 git commands to generate.