1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3 
4 #include "journal-importer.h"
5 #include "managed-journal-file.h"
6 
7 typedef struct RemoteServer RemoteServer;
8 
9 typedef struct Writer {
10         ManagedJournalFile *journal;
11         JournalMetrics metrics;
12 
13         MMapCache *mmap;
14         RemoteServer *server;
15         char *hashmap_key;
16 
17         uint64_t seqnum;
18 
19         unsigned n_ref;
20 } Writer;
21 
22 Writer* writer_new(RemoteServer* server);
23 Writer* writer_ref(Writer *w);
24 Writer* writer_unref(Writer *w);
25 
26 DEFINE_TRIVIAL_CLEANUP_FUNC(Writer*, writer_unref);
27 
28 int writer_write(Writer *s,
29                  const struct iovec_wrapper *iovw,
30                  const dual_timestamp *ts,
31                  const sd_id128_t *boot_id,
32                  JournalFileFlags file_flags);
33 
34 typedef enum JournalWriteSplitMode {
35         JOURNAL_WRITE_SPLIT_NONE,
36         JOURNAL_WRITE_SPLIT_HOST,
37         _JOURNAL_WRITE_SPLIT_MAX,
38         _JOURNAL_WRITE_SPLIT_INVALID = -EINVAL,
39 } JournalWriteSplitMode;
40