Fix: removed useless key from relay_index
[lttng-tools.git] / src / bin / lttng-relayd / index.h
1 /*
2 * Copyright (C) 2013 - Julien Desfossez <jdesfossez@efficios.com>
3 * David Goulet <dgoulet@efficios.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License, version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 51
16 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19 #ifndef _RELAY_INDEX_H
20 #define _RELAY_INDEX_H
21
22 #include <inttypes.h>
23 #include <pthread.h>
24
25 #include <common/hashtable/hashtable.h>
26 #include <common/index/index.h>
27
28 struct relay_index {
29 /* FD on which to write the index data. */
30 int fd;
31 /*
32 * When destroying this object, this fd is checked and if valid, close it
33 * so this is basically a lazy close of the previous fd corresponding to
34 * the same stream id. This is used for the rotate file feature.
35 */
36 int to_close_fd;
37
38 /* Index packet data. This is the data that is written on disk. */
39 struct ctf_packet_index index_data;
40
41 /* key1 = stream_id, key2 = net_seq_num */
42 struct lttng_ht_node_two_u64 index_n;
43 struct rcu_head rcu_node;
44 pthread_mutex_t mutex;
45 };
46
47 struct relay_index *relay_index_create(uint64_t stream_id,
48 uint64_t net_seq_num);
49 struct relay_index *relay_index_find(uint64_t stream_id, uint64_t net_seq_num);
50 void relay_index_add(struct relay_index *index, struct relay_index **_index);
51 int relay_index_write(int fd, struct relay_index *index);
52 void relay_index_free(struct relay_index *index);
53 void relay_index_free_safe(struct relay_index *index);
54 void relay_index_delete(struct relay_index *index);
55 void relay_index_destroy_by_stream_id(uint64_t stream_id);
56
57 #endif /* _RELAY_INDEX_H */
This page took 0.042576 seconds and 4 git commands to generate.