JsonBackend.h

// SPDX-License-Identifier: MIT

char *elosCompleteStoragePath(const char *const path, size_t sizelimit, const char *countStr, const char *const date, bool *hasCount)
[source]

Assembles the complete storage path replacing “%date%”, “%host%” and “%count%”

Parameters:
  • path (const char *const) – The path template to assemble

  • sizelimit (size_t) – The maximum length for the assembled path

  • countStr (const char*) – The string that should replace “%count%” in the assembled path

  • date (const char *const) – The string that should replace “%date%” in the assembled path

  • hasCount (bool*) – Return parameter to tell if the path template or count was appendend to the end of the assembled path

Returns:

The fully assembled path string

defaulting to STORAGE_LOCATION when allocation for the path fails, or when NULL was passed as path template

Return type:

char*

safuResultE_t elosJsonBackendShutdown(elosStorageBackend_t *backend)
[source]

Shutdown the logging system and free all related resources.

Parameters:
  • backend (elosStorageBackend_t*) – The Storage Backend instance itself.

Returns:

SAFU_RESULT_OK – on success. SAFU_RESULT_FAILURE – on failure.

Return type:

safuResultE_t

safuResultE_t elosJsonBackendStart(elosStorageBackend_t *backend)
[source]

Initialize the file backed storage of JSON serialized event objects. The elosStorageBackend_t.backendData shall be initialized with a pointer to a elosJsonBackend_t instance. elosJsonBackend_t.storageFileWrite and elosJsonBackend_t.storageFileRead shall contain valid file descriptors to the target file for writing/reading purposes. In write mode, the file shall be opened for appending and synchronous writing, to ensure a write is carried out through the kernel caches.

Parameters:
  • backend (elosStorageBackend_t*) – The Storage Backend instance itself.

Returns:

SAFU_RESULT_OK – on success. SAFU_RESULT_FAILURE – on failure.

Return type:

safuResultE_t