MCEL: Merkle-Chaining Event Ledger 1.0.0.0a (A1)
A post-quantum secure block-chain ledger system
mcel_store_callbacks Struct Reference

The MCEL storage callback table. More...

#include <mcel.h>

Data Fields

void * context
bool(* write )(void *context, const uint8_t *loc, size_t loclen, const uint8_t *data, size_t datalen)
 Write a complete object at a logical location.
bool(* read )(void *context, const uint8_t *loc, size_t loclen, uint8_t *data, size_t datalen, size_t *outread)
 Read a complete object from a logical location.
bool(* append )(void *context, const uint8_t *loc, size_t loclen, const uint8_t *data, size_t datalen, uint64_t *outpos)
 Append bytes to an append-only object.
bool(* size )(void *context, const uint8_t *loc, size_t loclen, uint64_t *outlen)
 Get the size of an object at a logical location.
bool(* flush )(void *context, const uint8_t *loc, size_t loclen)
 Flush any buffered data for a logical location.

Detailed Description

The MCEL storage callback table.

The hosting application owns persistence. MCEL calls these functions to read and write opaque byte strings (blocks, checkpoint bundles, records, indexes).

Field Documentation

◆ append

bool(* append) (void *context, const uint8_t *loc, size_t loclen, const uint8_t *data, size_t datalen, uint64_t *outpos)

Append bytes to an append-only object.

Parameters
contextThe storage context.
loc[const] A pointer to an application-defined location identifier.
loclenThe length of the location identifier in bytes.
data[const] A pointer to the data buffer.
datalenThe data length in bytes.
outposA pointer to the returned append position offset, can be NULL.
Returns
Returns true on success.

◆ context

void* context

The host-defined storage context pointer

◆ flush

bool(* flush) (void *context, const uint8_t *loc, size_t loclen)

Flush any buffered data for a logical location.

Parameters
contextThe storage context.
loc[const] A pointer to an application-defined location identifier.
loclenThe length of the location identifier in bytes.
Returns
Returns true on success.

◆ read

bool(* read) (void *context, const uint8_t *loc, size_t loclen, uint8_t *data, size_t datalen, size_t *outread)

Read a complete object from a logical location.

Parameters
contextThe storage context.
loc[const] A pointer to an application-defined location identifier.
loclenThe length of the location identifier in bytes.
dataA pointer to the output buffer.
datalenThe output buffer length in bytes.
outreadA pointer to the returned number of bytes read.
Returns
Returns true on success.

◆ size

bool(* size) (void *context, const uint8_t *loc, size_t loclen, uint64_t *outlen)

Get the size of an object at a logical location.

Parameters
contextThe storage context.
loc[const] A pointer to an application-defined location identifier.
loclenThe length of the location identifier in bytes.
outlenA pointer to the returned size in bytes.
Returns
Returns true on success.

◆ write

bool(* write) (void *context, const uint8_t *loc, size_t loclen, const uint8_t *data, size_t datalen)

Write a complete object at a logical location.

Parameters
contextThe storage context.
loc[const] A pointer to an application-defined location identifier.
loclenThe length of the location identifier in bytes.
data[const] A pointer to the data buffer.
datalenThe data length in bytes.
Returns
Returns true on success.

The documentation for this struct was generated from the following file:
  • C:/Users/stepp/Documents/Visual Studio 2022/Projects/C/MCEL/MCEL/mcel.h