Skip to content

File SolidSyslogBlockStore.h

FileList > Core > Interface > SolidSyslogBlockStore.h

Go to the source code of this file

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. More...

  • #include <stddef.h>
  • #include "ExternC.h"

Classes

Type Name
struct SolidSyslogBlockStoreConfig
Wiring for SolidSyslogBlockStore_Create.

Public Types

Type Name
enum SolidSyslogDiscardPolicy
What happens once MaxBlocks are full.
typedef void(* SolidSyslogStoreFullCallback
Fired once when a Halt-policy store first fills.
typedef void(* SolidSyslogStoreThresholdCallback
Edge-triggered: fires once when used-bytes rises from below the threshold to at-or-above (re-armed when it drops back below).
typedef size_t(* SolidSyslogStoreThresholdFunction
Returns the capacity threshold in bytes; 0 disables.

Public Functions

Type Name
struct SolidSyslogStore * SolidSyslogBlockStore_Create (const struct SolidSyslogBlockStoreConfig * config)
Create a store from config , resuming from any records already on the device.
void SolidSyslogBlockStore_Destroy (struct SolidSyslogStore * base)
Release the pool slot; does not destroy the injected BlockDevice or SecurityPolicy.

Detailed Description

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.

MaxBlocks caps retention; DiscardPolicy governs the overflow once every block is full — Oldest evicts the oldest block to keep accepting writes, Newest refuses the incoming record, Halt refuses it, latches (IsHalted stops Service), and fires OnStoreFull once. An optional capacity-threshold function (queried each Write) drives an edge-triggered OnThresholdCrossed callback for early back-pressure signalling. Mind the recursion gotcha: under a PassthroughBuffer, SolidSyslog_Log sends inline, so logging from the threshold callback re-enters Write — drive the logger from a returning Buffer or gate the Log instead.

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

enum SolidSyslogDiscardPolicy

What happens once MaxBlocks are full.

enum SolidSyslogDiscardPolicy {
    SOLIDSYSLOG_DISCARD_POLICY_OLDEST,
    SOLIDSYSLOG_DISCARD_POLICY_NEWEST,
    SOLIDSYSLOG_DISCARD_POLICY_HALT
};

Oldest keeps accepting writes, evicting the oldest block to make room; Newest refuses the incoming record; Halt refuses it, latches (IsHalted, Service stops), and fires OnStoreFull once on entry.


typedef SolidSyslogStoreFullCallback

Fired once when a Halt-policy store first fills.

typedef void(* SolidSyslogStoreFullCallback) (void *context);


typedef SolidSyslogStoreThresholdCallback

Edge-triggered: fires once when used-bytes rises from below the threshold to at-or-above (re-armed when it drops back below).

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

Gotcha under SolidSyslogPassthroughBuffer, where SolidSyslog_Log sends inline: logging from this callback recurses into the store's Write. Gate the Log, or drive the logger from a returning Buffer (e.g. SolidSyslogPosixMessageQueueBuffer).


typedef SolidSyslogStoreThresholdFunction

Returns the capacity threshold in bytes; 0 disables.

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

Queried on every Write.


Public Functions Documentation

function SolidSyslogBlockStore_Create

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

struct SolidSyslogStore * SolidSyslogBlockStore_Create (
    const struct SolidSyslogBlockStoreConfig * config
) 

A NULL config, an exhausted pool, or a failed inner allocation falls back to the shared NullStore. A block too small for one worst-case record is grown to fit and reported as a WARNING, not a failure.


function 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