X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Frotate.h;h=2812130806cfdbbe2c55a5935a0d90d56915cfbe;hp=e2c0829bc5bf3b7384392c4cc33f175be3ea0c69;hb=9c9d917cfe2e6a9f35ef82cb64e442451210716f;hpb=5c408ad8ef08a226c018702aca969536f36ac4e5 diff --git a/src/bin/lttng-sessiond/rotate.h b/src/bin/lttng-sessiond/rotate.h index e2c0829bc..281213080 100644 --- a/src/bin/lttng-sessiond/rotate.h +++ b/src/bin/lttng-sessiond/rotate.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2017 - Julien Desfossez + * Copyright (C) 2018 - Jérémie Galarneau * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License, version 2 only, as @@ -19,43 +20,19 @@ #define ROTATE_H #include "rotation-thread.h" +#include -/* - * Key in channel_pending_rotate_ht to map a channel to a - * struct rotation_channel_info. - */ -struct rotation_channel_key { - uint64_t key; - enum lttng_domain_type domain; -}; - -/* - * Added in channel_pending_rotate_ht everytime we start the rotation of a - * channel. The consumer notifies the rotation thread with the channel_key to - * inform a rotation is complete, we use that information to lookup the related - * session from channel_pending_rotate_ht. - */ -struct rotation_channel_info { - uint64_t session_id; - struct rotation_channel_key channel_key; - struct cds_lfht_node rotate_channels_ht_node; -}; - -extern struct cds_lfht *channel_pending_rotate_ht; - -unsigned long hash_channel_key(struct rotation_channel_key *key); - -/* session lock must be held by this function's caller. */ -int rename_complete_chunk(struct ltt_session *session, time_t ts); +int rename_active_chunk(struct ltt_session *session); +int rename_completed_chunk(struct ltt_session *session, time_t ts); /* - * When we start the rotation of a channel, we add its information in - * channel_pending_rotate_ht. This is called in the context of - * thread_manage_client when the client asks for a rotation, in the context - * of the sessiond_timer thread when periodic rotations are enabled and from - * the rotation_thread when size-based rotations are enabled. + * Subscribe/unsubscribe the notification_channel from the rotation_thread to + * session usage notifications to perform size-based rotations. */ -int rotate_add_channel_pending(uint64_t key, enum lttng_domain_type domain, - struct ltt_session *session); +int subscribe_session_consumed_size_rotation(struct ltt_session *session, + uint64_t size, + struct notification_thread_handle *notification_thread_handle); +int unsubscribe_session_consumed_size_rotation(struct ltt_session *session, + struct notification_thread_handle *notification_thread_handle); #endif /* ROTATE_H */