Line data Source code
1 : /* SPDX-FileCopyrightText: Copyright 2026 Cozens Software Solutions Limited
2 : * SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0 OR LicenseRef-PolyForm-Internal-Use-1.0.0 OR LicenseRef-COSOSO-Commercial
3 : */
4 :
5 : #ifndef SOLIDSYSLOGBLOCKSTOREPRIVATE_H
6 : #define SOLIDSYSLOGBLOCKSTOREPRIVATE_H
7 :
8 : #include <stdbool.h>
9 : #include <stdint.h>
10 :
11 : #include "SolidSyslogBlockStore.h"
12 : #include "SolidSyslogBlockStoreErrors.h"
13 : #include "SolidSyslogError.h"
14 : #include "SolidSyslogPrival.h"
15 : #include "SolidSyslogStoreDefinition.h"
16 :
17 : struct SolidSyslogRecordStore;
18 : struct SolidSyslogBlockSequence;
19 : struct SolidSyslogBlockStoreConfig;
20 :
21 : struct SolidSyslogBlockStore
22 : {
23 : struct SolidSyslogStore Base;
24 : struct SolidSyslogRecordStore* RecordStore;
25 : struct SolidSyslogBlockSequence* BlockSequence;
26 : /* A report stands for the current run of discarded records; the next record
27 : * that reads cleanly ends the run. */
28 : bool LossReported;
29 : /* Each reports a run of records lost to the discard policy: refused while
30 : * the store is full, ended by the next record kept; or evicted unsent, ended
31 : * by the next rotation that evicts nothing unsent. */
32 : bool RefusalReported;
33 : bool EvictionReported;
34 : /* A report stands for a run of records the policy would not seal; the next
35 : * record kept ends the run. */
36 : bool SealFailureReported;
37 : };
38 :
39 : /* SolidSyslogBlockStore_Initialise wires the vtable + composes the inner pool slots that the
40 : * caller already acquired. The caller (Static.c) acquires the inner slots
41 : * itself so it can route to NullStore_Get() if either Create returns NULL
42 : * without ever having to undo a partial SolidSyslogBlockStore_Initialise. */
43 : void SolidSyslogBlockStore_Initialise(
44 : struct SolidSyslogStore* base,
45 : struct SolidSyslogRecordStore* recordStore,
46 : struct SolidSyslogBlockSequence* blockSequence
47 : );
48 : void SolidSyslogBlockStore_Cleanup(struct SolidSyslogStore* base);
49 :
50 6644 : static inline void BlockStore_Report(
51 : enum SolidSyslogSeverity severity,
52 : uint16_t category,
53 : enum SolidSyslogBlockStoreErrors code
54 : )
55 : {
56 6644 : SolidSyslog_Error(severity, &SolidSyslogBlockStoreErrorSource, category, (int32_t) code);
57 6644 : }
58 :
59 : #endif /* SOLIDSYSLOGBLOCKSTOREPRIVATE_H */
|