File SolidSyslogBlockDevice.h¶
FileList > Core > Interface > SolidSyslogBlockDevice.h
Go to the source code of this file
The block-device role: block-indexed storage (Acquire / Dispose / Exists / Read / Append / WriteAt / Size / GetBlockSize) beneath a BlockStore. More...
#include "ExternC.h"#include <stdbool.h>#include <stddef.h>
Public Functions¶
| Type | Name |
|---|---|
| bool | SolidSyslogBlockDevice_Acquire (struct SolidSyslogBlockDevice * device, size_t blockIndex) Make blockIndex ready for fresh writes, leaving it empty (file drivers create-or-truncate, flash drivers erase). |
| bool | SolidSyslogBlockDevice_Append (struct SolidSyslogBlockDevice * device, size_t blockIndex, const void * buf, size_t count) Write count bytes frombuf at the current end ofblockIndex , growing it. |
| bool | SolidSyslogBlockDevice_Dispose (struct SolidSyslogBlockDevice * device, size_t blockIndex) Release blockIndex , freeing its storage (file drivers delete the backing file). |
| bool | SolidSyslogBlockDevice_Exists (struct SolidSyslogBlockDevice * device, size_t blockIndex) |
| size_t | SolidSyslogBlockDevice_GetBlockSize (struct SolidSyslogBlockDevice * device) The device-wide per-block capacity in bytes: how large each block may grow. |
| bool | SolidSyslogBlockDevice_Read (struct SolidSyslogBlockDevice * device, size_t blockIndex, size_t offset, void * buf, size_t count) Read count bytes fromblockIndex starting atoffset into caller-ownedbuf . |
| size_t | SolidSyslogBlockDevice_Size (struct SolidSyslogBlockDevice * device, size_t blockIndex) Current occupancy of blockIndex in bytes: how far Append has filled it, and the offset at which the next Append lands. |
| bool | SolidSyslogBlockDevice_WriteAt (struct SolidSyslogBlockDevice * device, size_t blockIndex, size_t offset, const void * buf, size_t count) Overwrite count bytes atoffset withinblockIndex frombuf , in place. |
Detailed Description¶
These calls dispatch to the injected device's vtable, so behaviour is that device's.
Public Functions Documentation¶
function SolidSyslogBlockDevice_Acquire¶
Make blockIndex ready for fresh writes, leaving it empty (file drivers create-or-truncate, flash drivers erase).
Not for a block whose content is to be kept: use Exists + Size to detect and resume a populated block.
Return value:
falsethe block could not be made ready; the caller does not write to it.
function SolidSyslogBlockDevice_Append¶
Write count bytes frombuf at the current end ofblockIndex , growing it.
bool SolidSyslogBlockDevice_Append (
struct SolidSyslogBlockDevice * device,
size_t blockIndex,
const void * buf,
size_t count
)
Records are laid down with Append; the offset is implicit. Contrast WriteAt.
Return value:
falsethe bytes were not stored.
function SolidSyslogBlockDevice_Dispose¶
Release blockIndex , freeing its storage (file drivers delete the backing file).
Return value:
falsethe block could not be released; the caller does not treat it as gone (a stale block must be Disposed before it is Acquired again for reuse).
function SolidSyslogBlockDevice_Exists¶
Return value:
trueblockIndexis present (Acquired and not yet Disposed). Drives crash recovery: a BlockStore scans the index space with Exists to find the run of blocks left by a previous run before deciding where to resume.
function SolidSyslogBlockDevice_GetBlockSize¶
The device-wide per-block capacity in bytes: how large each block may grow.
Distinct from Size(blockIndex), the current occupancy of one block. The device is the single source of truth; a BlockStore reads this at construction rather than taking a separately configured size. Fixed for the device's lifetime.
function SolidSyslogBlockDevice_Read¶
Read count bytes fromblockIndex starting atoffset into caller-ownedbuf .
bool SolidSyslogBlockDevice_Read (
struct SolidSyslogBlockDevice * device,
size_t blockIndex,
size_t offset,
void * buf,
size_t count
)
Return value:
falsenothing usable was read (missing block or short read);bufis undefined.
function SolidSyslogBlockDevice_Size¶
Current occupancy of blockIndex in bytes: how far Append has filled it, and the offset at which the next Append lands.
Contrast GetBlockSize (the fixed capacity).
Return value:
0the block is empty or absent.
function SolidSyslogBlockDevice_WriteAt¶
Overwrite count bytes atoffset withinblockIndex frombuf , in place.
bool SolidSyslogBlockDevice_WriteAt (
struct SolidSyslogBlockDevice * device,
size_t blockIndex,
size_t offset,
const void * buf,
size_t count
)
Used to patch bytes already present (e.g. flip a stored record's sent flag), not to extend the block. Contrast Append.
Return value:
falsethe bytes were not stored.
The documentation for this class was generated from the following file Core/Interface/SolidSyslogBlockDevice.h