]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/journal-remote/journal-remote-write.h
tree-wide: place #pragma once at the same place everywhere
[thirdparty/systemd.git] / src / journal-remote / journal-remote-write.h
CommitLineData
0ef6f454
LP
1#pragma once
2
fdfccdbc
ZJS
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
fdfccdbc
ZJS
22#include "journal-file.h"
23
9ff48d09
ZJS
24typedef struct RemoteServer RemoteServer;
25
fdfccdbc
ZJS
26struct iovec_wrapper {
27 struct iovec *iovec;
28 size_t size_bytes;
29 size_t count;
30};
31
32int iovw_put(struct iovec_wrapper *iovw, void* data, size_t len);
33void iovw_free_contents(struct iovec_wrapper *iovw);
34size_t iovw_size(struct iovec_wrapper *iovw);
92b10cbc 35void iovw_rebase(struct iovec_wrapper *iovw, char *old, char *new);
fdfccdbc
ZJS
36
37typedef struct Writer {
38 JournalFile *journal;
39 JournalMetrics metrics;
9ff48d09 40
fdfccdbc 41 MMapCache *mmap;
9ff48d09
ZJS
42 RemoteServer *server;
43 char *hashmap_key;
44
fdfccdbc 45 uint64_t seqnum;
9ff48d09
ZJS
46
47 int n_ref;
fdfccdbc
ZJS
48} Writer;
49
9ff48d09
ZJS
50Writer* writer_new(RemoteServer* server);
51Writer* writer_free(Writer *w);
52
53Writer* writer_ref(Writer *w);
54Writer* writer_unref(Writer *w);
55
56DEFINE_TRIVIAL_CLEANUP_FUNC(Writer*, writer_unref);
57#define _cleanup_writer_unref_ _cleanup_(writer_unrefp)
58
fdfccdbc
ZJS
59int writer_write(Writer *s,
60 struct iovec_wrapper *iovw,
61 dual_timestamp *ts,
62 bool compress,
63 bool seal);
8201af08
ZJS
64
65typedef enum JournalWriteSplitMode {
66 JOURNAL_WRITE_SPLIT_NONE,
67 JOURNAL_WRITE_SPLIT_HOST,
68 _JOURNAL_WRITE_SPLIT_MAX,
69 _JOURNAL_WRITE_SPLIT_INVALID = -1
70} JournalWriteSplitMode;