- * True until the relay has finished the rotation of all the streams.
- */
- bool rotate_pending_relay;
- /* Current status of a rotation. */
- enum lttng_rotation_status rotation_status;
- /*
- * Number of channels waiting for a rotation.
- * When this number reaches 0, we can handle the rename of the chunk
- * folder and inform the client that the rotate is finished.
- */
- unsigned int nr_chan_rotate_pending;
+ * The current archive id corresponds to the number of session rotations
+ * that have occurred for this session. The archive id
+ * is used to tag the "generation" of a stream. This tag allows the
+ * consumer and relay daemons to track when a given stream was created
+ * during the lifetime of a session.
+ *
+ * For instance, if a stream is created after a session rotation was
+ * launched, the consumer and relay daemons must not check its position
+ * to determine if that specific session rotation was completed. It is
+ * implicitly "completed" since the stream appeared _after_ the session
+ * rotation was initiated.
+ */
+ uint64_t current_archive_id;
+ /*
+ * Rotation is considered pending between the time it is launched up
+ * until the moment when the data has been writen at the destination
+ * and the trace archive has been renamed.
+ *
+ * When tracing locally, only 'rotation_pending_local' is used since
+ * no remote checks are needed. However, when tracing to a relay daemon,
+ * a second check is needed to ensure that the data has been
+ * commited at the remote destination.
+ */
+ bool rotation_pending_local;
+ bool rotation_pending_relay;
+ /* Current state of a rotation. */
+ enum lttng_rotation_state rotation_state;