syslog-ng source
logqueue-disk.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2016 Balabit
3  * Copyright (c) 2016 Viktor Juhasz <viktor.juhasz@balabit.com>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 as published
7  * by the Free Software Foundation, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  * As an additional exemption you are allowed to compile & link against the
19  * OpenSSL libraries as published by the OpenSSL project. See the file
20  * COPYING for details.
21  *
22  */
23 
24 #ifndef LOGQUEUE_DISK_H_INCLUDED
25 #define LOGQUEUE_DISK_H_INCLUDED
26 
27 #include "logmsg/logmsg.h"
28 #include "logqueue.h"
29 #include "qdisk.h"
31 
32 typedef struct _LogQueueDisk LogQueueDisk;
33 
35 {
36  LogQueue super;
37  QDisk *qdisk; /* disk based queue */
38  /* TODO:
39  * LogQueueDisk should have a separate options class, which should only contain compaction, reliable, etc...
40  * Similarly, QDisk should have a separate options class, which should only contain capacity_bytes,
41  * flow_control_window_bytes, etc...
42  */
43 
44  struct
45  {
46  StatsClusterKey *capacity_sc_key;
47  StatsClusterKey *disk_usage_sc_key;
48  StatsClusterKey *disk_allocated_sc_key;
49 
54 
55  gboolean compaction;
56  gboolean (*start)(LogQueueDisk *s);
57  gboolean (*stop)(LogQueueDisk *s, gboolean *persistent);
58  gboolean (*stop_corrupted)(LogQueueDisk *s);
59 };
60 
62 
63 const gchar *log_queue_disk_get_filename(LogQueue *self);
64 gboolean log_queue_disk_stop(LogQueue *self, gboolean *persistent);
65 gboolean log_queue_disk_start(LogQueue *self);
66 void log_queue_disk_init_instance(LogQueueDisk *self, DiskQueueOptions *options, const gchar *qdisk_file_id,
67  const gchar *filename, const gchar *persist_name, gint stats_level,
68  StatsClusterKeyBuilder *driver_sck_builder,
69  StatsClusterKeyBuilder *queue_sck_builder);
70 void log_queue_disk_restart_corrupted(LogQueueDisk *self);
71 void log_queue_disk_free_method(LogQueueDisk *self);
72 
73 void log_queue_disk_update_disk_related_counters(LogQueueDisk *self);
74 LogMessage *log_queue_disk_read_message(LogQueueDisk *self, LogPathOptions *path_options);
75 LogMessage *log_queue_disk_peek_message(LogQueueDisk *self);
76 void log_queue_disk_drop_message(LogQueueDisk *self, LogMessage *msg, const LogPathOptions *path_options);
77 gboolean log_queue_disk_serialize_msg(LogQueueDisk *self, LogMessage *msg, GString *serialized);
78 gboolean log_queue_disk_deserialize_msg(LogQueueDisk *self, GString *serialized, LogMessage **msg);
79 
80 #endif
LogMessage * log_queue_disk_read_message(LogQueueDisk *self, LogPathOptions *path_options)
Definition: logqueue-disk.c:209
void log_queue_disk_update_disk_related_counters(LogQueueDisk *self)
Definition: logqueue-disk.c:136
gboolean log_queue_disk_deserialize_msg(LogQueueDisk *self, GString *serialized, LogMessage **msg)
Definition: logqueue-disk.c:452
void log_queue_disk_init_instance(LogQueueDisk *self, DiskQueueOptions *options, const gchar *qdisk_file_id, const gchar *filename, const gchar *persist_name, gint stats_level, StatsClusterKeyBuilder *driver_sck_builder, StatsClusterKeyBuilder *queue_sck_builder)
Definition: logqueue-disk.c:390
gboolean log_queue_disk_stop(LogQueue *self, gboolean *persistent)
Definition: logqueue-disk.c:50
LogMessage * log_queue_disk_peek_message(LogQueueDisk *self)
Definition: logqueue-disk.c:242
void log_queue_disk_restart_corrupted(LogQueueDisk *self)
Definition: logqueue-disk.c:347
void log_queue_disk_free_method(LogQueueDisk *self)
Definition: logqueue-disk.c:125
const gchar * log_queue_disk_get_filename(LogQueue *self)
Definition: logqueue-disk.c:86
gboolean log_queue_disk_start(LogQueue *self)
Definition: logqueue-disk.c:66
void log_queue_disk_drop_message(LogQueueDisk *self, LogMessage *msg, const LogPathOptions *path_options)
Definition: logqueue-disk.c:272
QueueType log_queue_disk_type
Definition: logqueue-disk.c:47
gboolean log_queue_disk_serialize_msg(LogQueueDisk *self, LogMessage *msg, GString *serialized)
Definition: logqueue-disk.c:426
const char * QueueType
Definition: logqueue.h:36
Definition: diskq-options.h:33
Definition: stats-counter.h:67
Definition: logqueue-disk.h:35
StatsCounterItem * disk_usage
Definition: logqueue-disk.h:51
gboolean(* stop)(LogQueueDisk *s, gboolean *persistent)
Definition: logqueue-disk.h:57
gboolean compaction
Definition: logqueue-disk.h:55
QDisk * qdisk
Definition: logqueue-disk.h:37
struct _LogQueueDisk::@119 metrics
StatsCounterItem * capacity
Definition: logqueue-disk.h:50
StatsCounterItem * disk_allocated
Definition: logqueue-disk.h:52
StatsClusterKey * disk_allocated_sc_key
Definition: logqueue-disk.h:48
gboolean(* start)(LogQueueDisk *s)
Definition: logqueue-disk.h:56
gboolean(* stop_corrupted)(LogQueueDisk *s)
Definition: logqueue-disk.h:58
StatsClusterKey * capacity_sc_key
Definition: logqueue-disk.h:46
LogQueue super
Definition: logqueue-disk.h:36
StatsClusterKey * disk_usage_sc_key
Definition: logqueue-disk.h:47
LogMessage * msg
Definition: test_rename.c:35
LogPathOptions path_options
Definition: test_wildcard_file_reader.c:62