syslog-ng source
kafka-source-persist.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2025 Hofi <hofione@gmail.com>
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 2 as published
6  * by the Free Software Foundation, or (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16  *
17  * As an additional exemption you are allowed to compile & link against the
18  * OpenSSL libraries as published by the OpenSSL project. See the file
19  * COPYING for details.
20  *
21  */
22 
23 #ifndef KAFKA_SOURCE_PERSIST_H
24 #define KAFKA_SOURCE_PERSIST_H
25 
26 #include "syslog-ng.h"
27 #include "persist-state.h"
28 #include "kafka-source-driver.h"
29 #pragma GCC diagnostic push
30 #pragma GCC diagnostic ignored "-Wignored-qualifiers"
31 #include <librdkafka/rdkafka.h>
32 #pragma GCC diagnostic pop
33 
34 typedef struct _KafkaSourcePersist KafkaSourcePersist;
35 
36 KafkaSourcePersist *kafka_source_persist_new(KafkaSourceDriver *owner);
37 void kafka_source_persist_ref(KafkaSourcePersist *self);
38 void kafka_source_persist_unref(KafkaSourcePersist *self);
39 gboolean kafka_source_persist_init(KafkaSourcePersist *self,
40  PersistState *state,
41  const gchar *topic,
42  int32_t partition,
43  int64_t override_position,
44  gboolean use_offset_tracker);
45 void kafka_source_persist_invalidate(KafkaSourcePersist *self);
46 gboolean kafka_source_persist_is_ready(KafkaSourcePersist *self);
47 gboolean kafka_source_persist_matching(KafkaSourcePersist *self,
48  const gchar *topic,
49  int32_t partition);
50 /* Lock must be held before calling */
51 gboolean kafka_source_persist_remote_is_valid(KafkaSourcePersist *self);
52 int32_t kafka_source_persist_get_partition(KafkaSourcePersist *self);
53 const gchar *kafka_source_persist_get_topic(KafkaSourcePersist *self);
54 
55 void kafka_source_persist_fill_bookmark(KafkaSourcePersist *self,
56  Bookmark *bookmark,
57  int64_t offset);
58 void kafka_source_persist_load_position(KafkaSourcePersist *self,
59  int64_t *offset);
60 
61 #endif
void kafka_source_persist_invalidate(KafkaSourcePersist *self)
Definition: kafka-source-persist.c:607
gboolean kafka_source_persist_is_ready(KafkaSourcePersist *self)
Definition: kafka-source-persist.c:615
void kafka_source_persist_unref(KafkaSourcePersist *self)
Definition: kafka-source-persist.c:672
int32_t kafka_source_persist_get_partition(KafkaSourcePersist *self)
Definition: kafka-source-persist.c:590
gboolean kafka_source_persist_init(KafkaSourcePersist *self, PersistState *state, const gchar *topic, int32_t partition, int64_t override_position, gboolean use_offset_tracker)
Definition: kafka-source-persist.c:570
gboolean kafka_source_persist_matching(KafkaSourcePersist *self, const gchar *topic, int32_t partition)
Definition: kafka-source-persist.c:624
gboolean kafka_source_persist_remote_is_valid(KafkaSourcePersist *self)
Definition: kafka-source-persist.c:602
void kafka_source_persist_load_position(KafkaSourcePersist *self, int64_t *offset)
Definition: kafka-source-persist.c:483
const gchar * kafka_source_persist_get_topic(KafkaSourcePersist *self)
Definition: kafka-source-persist.c:596
KafkaSourcePersist * kafka_source_persist_new(KafkaSourceDriver *owner)
Definition: kafka-source-persist.c:632
void kafka_source_persist_fill_bookmark(KafkaSourcePersist *self, Bookmark *bookmark, int64_t offset)
Definition: kafka-source-persist.c:465
void kafka_source_persist_ref(KafkaSourcePersist *self)
Definition: kafka-source-persist.c:664
Definition: kafka-source-persist.c:53
gchar topic[MAX_KAFKA_TOPIC_NAME_LEN+1]
Definition: kafka-source-persist.c:61
KafkaSourceDriver * owner
Definition: kafka-source-persist.c:60
int32_t partition
Definition: kafka-source-persist.c:62
gboolean use_offset_tracker
Definition: kafka-source-persist.c:57
struct @95 state