Skip to content

File SolidSyslogBuffer.h

FileList > Core > Interface > SolidSyslogBuffer.h

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

Detailed Description

The buffer role: producer Write / consumer Read that decouples SolidSyslog_Log from Service.

These calls dispatch to the injected buffer's vtable, so behaviour - notably whether Write blocks or returns at once - is that buffer's.

Public Functions Documentation

SolidSyslogBuffer_IsFull

Whether Log has outrun Service: true when the last record written found no room - the buffer evicted to make some, or refused it - and nothing has been taken out since.

bool SolidSyslogBuffer_IsFull (
    struct SolidSyslogBuffer * buffer
) 

A write that fits as it stands, or a Read that takes a record, clears it. Service asks before retrying a record it holds, to apply the discard policy to the head of the whole queue rather than only to the records the buffer holds. A record no empty buffer could hold is a configuration fault, not fullness, and does not set it.


SolidSyslogBuffer_Read

Consumer side, called by SolidSyslog_Service to drain the buffer.

bool SolidSyslogBuffer_Read (
    struct SolidSyslogBuffer * buffer,
    void * data,
    size_t maxSize,
    size_t * bytesRead
) 

Returns true with one record copied into data (up to maxSize) and its length in bytesRead; returns false when nothing was delivered, which the drain loop reads as "empty, stop". bytesRead is always set (0 on false). A head record too large for maxSize also returns false and is left un-dequeued (the drain stalls at it) - this cannot arise under correct configuration, so an implementation reports it via SolidSyslog_Error under the buffer-backend-failed category rather than failing silently.


SolidSyslogBuffer_Write

Producer side: hand one formatted record to the buffer.

void SolidSyslogBuffer_Write (
    struct SolidSyslogBuffer * buffer,
    const void * data,
    size_t size
) 

data is copied as needed and need not outlive the call. Write returns nothing: whether it blocks (PassthroughBuffer sends inline) or returns at once (CircularBuffer enqueues) is the buffer's choice. A queueing buffer that is full applies its discard policy - evicting its oldest records under Oldest, refusing this one under Newest or Halt - and reports the first loss of each run through the error handler.



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