]>
Commit | Line | Data |
---|---|---|
fdfccdbc ZJS |
1 | /*** |
2 | This file is part of systemd. | |
3 | ||
4 | Copyright 2014 Zbigniew Jędrzejewski-Szmek | |
5 | ||
6 | systemd is free software; you can redistribute it and/or modify it | |
7 | under the terms of the GNU Lesser General Public License as published by | |
8 | the Free Software Foundation; either version 2.1 of the License, or | |
9 | (at your option) any later version. | |
10 | ||
11 | systemd is distributed in the hope that it will be useful, but | |
12 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | Lesser General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU Lesser General Public License | |
17 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
18 | ***/ | |
19 | ||
20 | #pragma once | |
21 | ||
fdfccdbc ZJS |
22 | |
23 | #include "journal-file.h" | |
24 | ||
9ff48d09 ZJS |
25 | typedef struct RemoteServer RemoteServer; |
26 | ||
fdfccdbc ZJS |
27 | struct iovec_wrapper { |
28 | struct iovec *iovec; | |
29 | size_t size_bytes; | |
30 | size_t count; | |
31 | }; | |
32 | ||
33 | int iovw_put(struct iovec_wrapper *iovw, void* data, size_t len); | |
34 | void iovw_free_contents(struct iovec_wrapper *iovw); | |
35 | size_t iovw_size(struct iovec_wrapper *iovw); | |
92b10cbc | 36 | void iovw_rebase(struct iovec_wrapper *iovw, char *old, char *new); |
fdfccdbc ZJS |
37 | |
38 | typedef struct Writer { | |
39 | JournalFile *journal; | |
40 | JournalMetrics metrics; | |
9ff48d09 | 41 | |
fdfccdbc | 42 | MMapCache *mmap; |
9ff48d09 ZJS |
43 | RemoteServer *server; |
44 | char *hashmap_key; | |
45 | ||
fdfccdbc | 46 | uint64_t seqnum; |
9ff48d09 ZJS |
47 | |
48 | int n_ref; | |
fdfccdbc ZJS |
49 | } Writer; |
50 | ||
9ff48d09 ZJS |
51 | Writer* writer_new(RemoteServer* server); |
52 | Writer* writer_free(Writer *w); | |
53 | ||
54 | Writer* writer_ref(Writer *w); | |
55 | Writer* writer_unref(Writer *w); | |
56 | ||
57 | DEFINE_TRIVIAL_CLEANUP_FUNC(Writer*, writer_unref); | |
58 | #define _cleanup_writer_unref_ _cleanup_(writer_unrefp) | |
59 | ||
fdfccdbc ZJS |
60 | int writer_write(Writer *s, |
61 | struct iovec_wrapper *iovw, | |
62 | dual_timestamp *ts, | |
63 | bool compress, | |
64 | bool seal); | |
8201af08 ZJS |
65 | |
66 | typedef enum JournalWriteSplitMode { | |
67 | JOURNAL_WRITE_SPLIT_NONE, | |
68 | JOURNAL_WRITE_SPLIT_HOST, | |
69 | _JOURNAL_WRITE_SPLIT_MAX, | |
70 | _JOURNAL_WRITE_SPLIT_INVALID = -1 | |
71 | } JournalWriteSplitMode; |