Debian Codegraph @

src/journal/journald-sync.h

raw
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include "journald-forward.h"
5 #include "list.h"
6
7 /* Encapsulates the synchronization request data we need to keep per STDOUT stream. Primarily a byte counter
8 * to count down. */
9 typedef struct StreamSyncReq {
10 SyncReq *req;
11 StdoutStream *stream;
12
13 uint64_t pending_siocinq; /* The SIOCINQ counter when the sync was initiated */
14
15 LIST_FIELDS(StreamSyncReq, by_sync_req);
16 LIST_FIELDS(StreamSyncReq, by_stdout_stream);
17 } StreamSyncReq;
18
19 /* Encapsulates a synchronization request */
20 typedef struct SyncReq {
21 Manager *manager;
22 sd_varlink *link;
23
24 bool offline; /* if true, we'll offline the journal files after sync is complete */
25
26 usec_t realtime; /* CLOCK_REALTIME timestamp when synchronization request was initiated (for syncing on AF_UNIX/SOCK_DGRAM) */
27 usec_t boottime; /* CLOCK_BOOTTIME timestamp when synchronization request was initiated (for syncing on /dev/kmsg) */
28
29 sd_event_source *idle_event_source;
30
31 uint32_t pending_rqlen; /* The rqlen counter on the stream AF_UNIX socket when the sync was initiated */
32 LIST_FIELDS(SyncReq, pending_rqlen);
33
34 LIST_HEAD(StreamSyncReq, stream_sync_reqs);
35
36 unsigned realtime_prioq_idx;
37 unsigned boottime_prioq_idx;
38 } SyncReq;
39
40 StreamSyncReq *stream_sync_req_free(StreamSyncReq *ssr);
41 DEFINE_TRIVIAL_CLEANUP_FUNC(StreamSyncReq*, stream_sync_req_free);
42 void stream_sync_req_advance_revalidate(StreamSyncReq *ssr, size_t p);
43
44 int sync_req_new(Manager *m, sd_varlink *link, SyncReq **ret);
45 SyncReq* sync_req_free(SyncReq *req);
46 DEFINE_TRIVIAL_CLEANUP_FUNC(SyncReq*, sync_req_free);
47
48 bool sync_req_revalidate(SyncReq *req);
49 void sync_req_revalidate_by_timestamp(Manager *m);
50
51 void manager_notify_stream(Manager *m, StdoutStream *stream);