Skip to content
«interface»SolidSyslogStoreBlockStoreCore«interface»SolidSyslogBlockDevice«interface»SolidSyslogSecurityPolicy0..1

File SolidSyslogBlockStore.h

FileList > Core > Interface > SolidSyslogBlockStore.h

  • #include <stddef.h>
  • #include "SolidSyslogDiscardPolicy.h"
  • #include "SolidSyslogExternC.h"

Classes

Type Name
struct SolidSyslogBlockStoreConfig
Wiring for SolidSyslogBlockStore_Create.

Detailed Description

A store-and-forward Store backed by a BlockDevice: records are appended to the current write block, and once a block fills the write rolls to the next, giving durable retention across a restart.

Create resumes from whatever records are already on the device (scanning the read block, honouring any per-record integrity trailer from the injected SecurityPolicy) so a reboot keeps unsent records queued. A block missing from the set, as a filesystem check can leave after a power loss, costs only its own records: the blocks around it are kept and delivered in order, and nothing is written into the gap while it lies among them. A block the read has finished with - each of its records delivered, rejected or given up as damaged - is removed from the device as the read moves on from it.

MaxBlocks caps retention; the injected discard policy governs the overflow once every block is full - Oldest evicts the oldest block to keep accepting writes, Newest and Halt refuse the incoming record, and under Halt the logger stops at that refusal. An optional capacity-threshold function (queried each Write) gives early warning that the store is filling: each crossing raises SOLIDSYSLOG_CAT_STORE_THRESHOLD_CROSSED and then calls the edge-triggered OnThresholdCrossed callback, where one is set. Both happen on whichever task calls into the store - normally the one that calls SolidSyslog_Service - and inside SolidSyslogBlockStore_Create, on the creating task, when the resumed store is already at or above the threshold.

The first block device operation that fails freezes the store, as SOLIDSYSLOG_CAT_STORE_FROZEN describes - opening the device at Create included, so a volume has to be mounted before the store is created. A read that runs past the end of a block's data, as a power cut mid-append leaves, is damaged data rather than a failed device, and does not freeze it.

Internally each pool slot composes an inner RecordStore over a BlockSequence, both drawn from sibling pools; a block too small for one worst-case record is grown to fit and reported as a WARNING rather than failing Create.

Public Types Documentation

SolidSyslogStoreThresholdCallback

Edge-triggered: fires once when used-bytes rises from below the threshold to at-or-above (re-armed when it drops back below), after the crossing is raised as SOLIDSYSLOG_CAT_STORE_THRESHOLD_CROSSED.

typedef void(* SolidSyslogStoreThresholdCallback) (void *context);

Runs on whichever task calls into the store - normally the one that calls SolidSyslog_Service - and inside SolidSyslogBlockStore_Create when the resumed store is already at or above the threshold.


SolidSyslogStoreThresholdFunction

Returns the capacity threshold in bytes; 0 disables.

typedef size_t(* SolidSyslogStoreThresholdFunction) (void *context);

Queried on every Write.


Public Functions Documentation

SolidSyslogBlockStore_Create

Create a store from config , resuming from any records already on the device.

struct SolidSyslogStore * SolidSyslogBlockStore_Create (
    const struct SolidSyslogBlockStoreConfig * config
) 

Each of these is reported at CRITICAL and falls back to the shared NullStore: a NULL config or BlockDevice, a BlockDevice with too few blocks, an exhausted pool, a failed inner allocation, and a SecurityPolicy whose trailer is wider than SOLIDSYSLOG_MAX_INTEGRITY_SIZE, since storing records without it would leave them unprotected. A block too small for one worst-case record is grown to fit and reported as a WARNING, not a failure.


SolidSyslogBlockStore_Destroy

Release the pool slot; does not destroy the injected BlockDevice or SecurityPolicy.

void SolidSyslogBlockStore_Destroy (
    struct SolidSyslogStore * base
) 



The documentation for this class was generated from the following file Core/Interface/SolidSyslogBlockStore.h