X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=plugins%2Fctf%2Ffs-sink%2Fwriter.h;h=34f54ae71bd57967fbf51625f475bc1c9eda6c2e;hb=4cdfc5e86b64137d96c31495cbdea99801714c2b;hp=1765a9617762c9647bea4e3afbd388def1735c69;hpb=d8866baa7f1ae173ac9d9fac0ad55cb28f883cbf;p=babeltrace.git diff --git a/plugins/ctf/fs-sink/writer.h b/plugins/ctf/fs-sink/writer.h index 1765a961..34f54ae7 100644 --- a/plugins/ctf/fs-sink/writer.h +++ b/plugins/ctf/fs-sink/writer.h @@ -29,51 +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 bt_trace and struct fs_writer. */ GHashTable *trace_map; + FILE *err; + bt_message_iterator *input_iterator; + 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 message 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; + const bt_trace *trace; + const bt_trace *writer_trace; + struct writer_component *writer_component; + int static_listener_id; + int trace_static; /* 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; + GHashTable *stream_states; }; BT_HIDDEN -enum bt_component_status writer_output_event(struct writer_component *writer, - struct bt_ctf_event *event); +void writer_close(struct writer_component *writer_component, + struct fs_writer *fs_writer); +BT_HIDDEN +bt_component_status writer_output_event(struct writer_component *writer, + const bt_event *event); +BT_HIDDEN +bt_component_status writer_new_packet(struct writer_component *writer, + const bt_packet *packet); +BT_HIDDEN +bt_component_status writer_close_packet(struct writer_component *writer, + const bt_packet *packet); BT_HIDDEN -enum bt_component_status writer_new_packet(struct writer_component *writer, - struct bt_ctf_packet *packet); +bt_component_status writer_stream_begin(struct writer_component *writer, + const bt_stream *stream); BT_HIDDEN -enum bt_component_status writer_close_packet(struct writer_component *writer, - struct bt_ctf_packet *packet); +bt_component_status writer_stream_end(struct writer_component *writer, + const bt_stream *stream); BT_HIDDEN -enum bt_component_status writer_component_init( - struct bt_private_component *component, struct bt_value *params, +bt_component_status writer_component_init( + bt_self_component *component, bt_value *params, void *init_method_data); BT_HIDDEN -enum bt_component_status writer_run(struct bt_private_component *component); +bt_component_status writer_run(bt_self_component *component); BT_HIDDEN void writer_component_port_connected( - struct bt_private_component *component, + bt_self_component *component, struct bt_private_port *self_port, - struct bt_port *other_port); + const bt_port *other_port); BT_HIDDEN -void writer_component_finalize(struct bt_private_component *component); +void writer_component_finalize(bt_self_component *component); #endif /* BABELTRACE_PLUGIN_WRITER_H */