syslog-ng source
ack_tracker_factory.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 One Identity
3  * Copyright (c) 2020 Laszlo Budai
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * As an additional exemption you are allowed to compile & link against the
20  * OpenSSL libraries as published by the OpenSSL project. See the file
21  * COPYING for details.
22  *
23  */
24 
25 #ifndef ACK_TRACKER_FACTORY_H_INCLUDED
26 #define ACK_TRACKER_FACTORY_H_INCLUDED
27 
28 #include "syslog-ng.h"
29 #include "logsource.h"
30 #include "ack_tracker_types.h"
31 #include "atomic.h"
32 #include "batched_ack_tracker.h"
33 
35 {
38  AckTracker *(*create)(AckTrackerFactory *self, LogSource *source);
39  void (*free_fn)(AckTrackerFactory *self);
40 };
41 
42 static inline AckTracker *
43 ack_tracker_factory_create(AckTrackerFactory *self, LogSource *source)
44 {
45  g_assert(self && self->create);
46  return self->create(self, source);
47 }
48 
49 static inline AckTrackerType
50 ack_tracker_factory_get_type(AckTrackerFactory *self)
51 {
52  g_assert(self);
53  return self->type;
54 }
55 
56 void ack_tracker_factory_init_instance(AckTrackerFactory *self);
57 AckTrackerFactory *ack_tracker_factory_ref(AckTrackerFactory *self);
58 void ack_tracker_factory_unref(AckTrackerFactory *self);
59 
60 AckTrackerFactory *instant_ack_tracker_factory_new(void);
61 AckTrackerFactory *instant_ack_tracker_bookmarkless_factory_new(void);
62 AckTrackerFactory *consecutive_ack_tracker_factory_new(void);
63 AckTrackerFactory *batched_ack_tracker_factory_new(guint timeout, guint batch_size,
65  gpointer user_data);
66 
67 #endif
void ack_tracker_factory_init_instance(AckTrackerFactory *self)
Definition: ack_tracker_factory.c:31
void ack_tracker_factory_unref(AckTrackerFactory *self)
Definition: ack_tracker_factory.c:57
AckTrackerFactory * batched_ack_tracker_factory_new(guint timeout, guint batch_size, BatchedAckTrackerOnBatchAcked cb, gpointer user_data)
Definition: batched_ack_tracker_factory.c:80
AckTrackerFactory * consecutive_ack_tracker_factory_new(void)
Definition: consecutive_ack_tracker_factory.c:58
AckTrackerFactory * ack_tracker_factory_ref(AckTrackerFactory *self)
Definition: ack_tracker_factory.c:37
AckTrackerFactory * instant_ack_tracker_factory_new(void)
Definition: instant_ack_tracker_factory.c:57
AckTrackerFactory * instant_ack_tracker_bookmarkless_factory_new(void)
Definition: instant_ack_tracker_bookmarkless_factory.c:57
AckTrackerType
Definition: ack_tracker_types.h:29
void(* BatchedAckTrackerOnBatchAcked)(GList *ack_records, gpointer user_data)
Definition: batched_ack_tracker.h:30
FILE ** source
Definition: file_reader.c:47
#define self
Definition: rcptid.c:38
Definition: atomic.h:31
Definition: ack_tracker_factory.h:35
void(* free_fn)(AckTrackerFactory *self)
Definition: ack_tracker_factory.h:39
AckTrackerType type
Definition: ack_tracker_factory.h:37
GAtomicCounter ref_cnt
Definition: ack_tracker_factory.h:36