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