6#ifndef OPENCBDC_TX_SRC_RAFT_SERIALIZATION_H_
7#define OPENCBDC_TX_SRC_RAFT_SERIALIZATION_H_
11#include <libnuraft/buffer.hxx>
26 explicit operator bool()
const final;
46 auto write(
const void* data,
size_t len) ->
bool final;
54 auto read(
void* data,
size_t len) ->
bool final;
57 nuraft::buffer& m_buf;
Implements serializer for nuraft::buffer.
auto end_of_buffer() const -> bool final
Returns whether the cursor is currently at the end of the buffer.
void reset() final
Resets the cursor to the start of the buffer.
auto read(void *data, size_t len) -> bool final
Reads the given number of bytes from the current cursor in the buffer into the given destination.
auto write(const void *data, size_t len) -> bool final
Writes the given raw bytes to the buffer from the current position of the cursor.
void advance_cursor(size_t len) final
Moves the cursor inside the buffer forward by the given number of bytes.
nuraft_serializer(nuraft::buffer &buf)
Constructor.
Interface for serializing objects into and out of raw bytes representations.