X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbin%2Flttng-relayd%2Fviewer-stream.h;h=a3262e24241d51cd72bda1ee1453bd17e03a27bd;hb=794e2e5f064718252b249e17914c9b2b089d8d0c;hp=cc46db4e2a3545cb283ddb5c3260001bcf82d320;hpb=7591bab11eceedc6a0d1e02fd6f85592267a63b5;p=lttng-tools.git diff --git a/src/bin/lttng-relayd/viewer-stream.h b/src/bin/lttng-relayd/viewer-stream.h index cc46db4e2..a3262e242 100644 --- a/src/bin/lttng-relayd/viewer-stream.h +++ b/src/bin/lttng-relayd/viewer-stream.h @@ -45,24 +45,31 @@ struct relay_stream; */ struct relay_viewer_stream { struct urcu_ref ref; - pthread_mutex_t reflock; /* Back ref to stream. */ struct relay_stream *stream; - /* FD from which to read the stream data. */ - struct stream_fd *stream_fd; - /* FD from which to read the index data. */ - struct stream_fd *index_fd; + struct { + /* FD from which to read the stream data. */ + struct stream_fd *fd; + struct lttng_trace_chunk *trace_chunk; + } stream_file; + /* index file from which to read the index data. */ + struct lttng_index_file *index_file; char *path_name; char *channel_name; uint64_t current_tracefile_id; - /* Free-running counter. */ - uint64_t current_tracefile_seq; - uint64_t last_sent_index; + /* + * Counts the number of sent indexes. The "tag" associated + * with an index to send is the current index_received_seqcount, + * because we increment index_received_seqcount after sending + * each index. This index_received_seqcount counter can also be + * updated when catching up with the producer. + */ + uint64_t index_sent_seqcount; /* Indicates if this stream has been sent to a viewer client. */ bool sent_flag; @@ -74,6 +81,7 @@ struct relay_viewer_stream { }; struct relay_viewer_stream *viewer_stream_create(struct relay_stream *stream, + struct lttng_trace_chunk *viewer_trace_chunk, enum lttng_viewer_seek seek_t); struct relay_viewer_stream *viewer_stream_get_by_id(uint64_t id); @@ -83,5 +91,7 @@ int viewer_stream_rotate(struct relay_viewer_stream *vstream); bool viewer_stream_is_tracefile_seq_readable(struct relay_viewer_stream *vstream, uint64_t seq); void print_viewer_streams(void); +void viewer_stream_close_files(struct relay_viewer_stream *vstream); +void viewer_stream_sync_tracefile_array_tail(struct relay_viewer_stream *vstream); #endif /* _VIEWER_STREAM_H */