raft 0.1.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
raft::Persister Struct Referenceabstract

The interface for persisting the Raft server's state. More...

#include <persister.hpp>

Public Member Functions

virtual tl::expected< void, Error > saveState (std::vector< std::byte > state) noexcept=0
 
virtual tl::expected< std::vector< std::byte >, Error > loadState () noexcept=0
 

Detailed Description

The interface for persisting the Raft server's state.

Member Function Documentation

◆ loadState()

virtual tl::expected< std::vector< std::byte >, Error > raft::Persister::loadState ( )
pure virtualnoexcept

Loads the server's persistent state from storage. This method is called during server initialization to restore previous state.

Returns
The serialized state data if available, or NoPersistedState if no state exists.

◆ saveState()

virtual tl::expected< void, Error > raft::Persister::saveState ( std::vector< std::byte >  state)
pure virtualnoexcept

Saves the server's persistent state to storage. This method is called whenever the server's state changes and needs to be persisted.

Parameters
stateThe serialized state data to persist.
Returns
Success or a persistence error.

The documentation for this struct was generated from the following file: