X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=plugins%2Fctf%2Ffs-sink%2Fwriter.h;h=2d40b7e4eb5415923ccf3d64eca6fc298455046a;hb=40f4ba76dd6f9508ca51b6220eaed57632281a07;hp=d34b77f9d64c874183c9aa5195740559827fbf91;hpb=f3168545b6b7501165eb94181b205b0d2afb6b19;p=babeltrace.git diff --git a/plugins/ctf/fs-sink/writer.h b/plugins/ctf/fs-sink/writer.h index d34b77f9..2d40b7e4 100644 --- a/plugins/ctf/fs-sink/writer.h +++ b/plugins/ctf/fs-sink/writer.h @@ -29,62 +29,82 @@ #include #include -#include -#include +#include struct writer_component { GString *base_path; GString *trace_name_base; /* For the directory name suffix. */ int trace_id; - /* Map between struct bt_ctf_trace and struct bt_ctf_writer. */ + /* Map between struct bt_trace and struct fs_writer. */ GHashTable *trace_map; - /* Map between reader and writer stream. */ - GHashTable *stream_map; - /* Map between reader and writer stream class. */ - GHashTable *stream_class_map; FILE *err; struct bt_notification_iterator *input_iterator; - bool processed_first_event; bool error; + bool single_trace; + unsigned int nr_traces; +}; + +enum fs_writer_stream_state { + /* + * We know the stream exists but we have never received a + * stream_begin notification for it. + */ + FS_WRITER_UNKNOWN_STREAM, + /* We know this stream is active (between stream_begin and _end). */ + FS_WRITER_ACTIVE_STREAM, + /* We have received a stream_end for this stream. */ + FS_WRITER_COMPLETED_STREAM, }; struct fs_writer { struct bt_ctf_writer *writer; - struct bt_ctf_trace *writer_trace; + const struct bt_trace *trace; + const struct bt_trace *writer_trace; + struct writer_component *writer_component; int static_listener_id; - unsigned int active_streams; int trace_static; + /* Map between reader and writer stream. */ + GHashTable *stream_map; + /* Map between reader and writer stream class. */ + GHashTable *stream_class_map; + GHashTable *stream_states; }; +BT_HIDDEN +void writer_close(struct writer_component *writer_component, + struct fs_writer *fs_writer); BT_HIDDEN enum bt_component_status writer_output_event(struct writer_component *writer, - struct bt_ctf_event *event); + const struct bt_event *event); BT_HIDDEN enum bt_component_status writer_new_packet(struct writer_component *writer, - struct bt_ctf_packet *packet); + const struct bt_packet *packet); BT_HIDDEN enum bt_component_status writer_close_packet(struct writer_component *writer, - struct bt_ctf_packet *packet); + const struct bt_packet *packet); +BT_HIDDEN +enum bt_component_status writer_stream_begin(struct writer_component *writer, + const struct bt_stream *stream); BT_HIDDEN enum bt_component_status writer_stream_end(struct writer_component *writer, - struct bt_ctf_stream *stream); + const struct bt_stream *stream); BT_HIDDEN enum bt_component_status writer_component_init( - struct bt_private_component *component, struct bt_value *params, + struct bt_self_component *component, struct bt_value *params, void *init_method_data); BT_HIDDEN -enum bt_component_status writer_run(struct bt_private_component *component); +enum bt_component_status writer_run(struct bt_self_component *component); BT_HIDDEN void writer_component_port_connected( - struct bt_private_component *component, + struct bt_self_component *component, struct bt_private_port *self_port, struct bt_port *other_port); BT_HIDDEN -void writer_component_finalize(struct bt_private_component *component); +void writer_component_finalize(struct bt_self_component *component); #endif /* BABELTRACE_PLUGIN_WRITER_H */