Introduce log write buffering
[platform/core/system/dlog.git] / src / logger / reader_pipe.h
1 #pragma once
2
3 #include "reader_common.h"
4
5 #include <log_file.h>
6 #include "log_storage.h"
7 #include "queued_entry_timestamp.h"
8
9 struct writer;
10 struct buf_params;
11
12 struct reader_pipe {
13         struct log_buffer *buf_ptr;
14         log_storage_reader *log_storage_reader_ptr;
15         struct timespec last_read_time;
16         int partial_log_size;
17         char partial_log[sizeof(struct dlogutil_entry_with_msg)];
18         struct log_file file;
19         bool is_dumping;
20         bool monitor;
21         dlogutil_filter_options_s *filter;
22         struct reader common;
23 };
24
25 int reader_pipe_init(struct reader_pipe **reader, log_id_t buf_id, struct logger *server,
26         dlogutil_filter_options_s *filter, struct log_file *file, bool monitor, bool is_dumping);
27 int reader_pipe_init_with_writer(struct reader_pipe **reader, struct writer *writer, struct logger *server,
28         dlogutil_filter_options_s *filter, struct log_file *file, bool monitor, bool is_dumping);
29 int reader_should_buffer(struct reader_pipe *reader, const struct buf_params *buf_params, struct timespec now);
30 int reader_print_out_single_log(struct reader_pipe *reader, const dlogutil_entry_s *dlogutil_entry);
31 int print_out_logs(struct reader_pipe *reader, struct now_t _time);
32 void reader_pipe_free(struct reader_pipe *reader);
33 void reader_pipe_cleanup(struct reader_pipe *const *ptr);