Expanded comments to made endpoint and persistance easier to understand

This commit is contained in:
Niklas Jensen
2026-01-24 14:31:47 +01:00
committed by nikguin04
parent 476c49f474
commit a4e900fb65
2 changed files with 4 additions and 1 deletions
@@ -15,8 +15,9 @@
template <class T>
class FSPersistencePB {
public:
// Formats are passed as referenced const (local variable) we want to read from, and a reference (proto) we write to
using ProtoStateReader = std::function<void(const T&, T&)>;
// Formats are passed as referenced const (new object), and a reference to local variable we either want to read from or write to
// Formats are passed as referenced const (new object) we read from, and a reference to the local variable we write to
using ProtoStateUpdater = std::function<StateUpdateResult(const T&, T&)>;
FSPersistencePB(ProtoStateReader stateReader, ProtoStateUpdater stateUpdater,
@@ -24,8 +24,10 @@ template <class T, class ProtoT>
class StatefulProtoEndpoint {
public:
/** Converts internal state to protobuf message for responses */
// Formats are passed as referenced const (local variable) we want to read from, and a reference (proto) we write to
using ProtoStateReader = std::function<void(const T&, ProtoT&)>;
/** Converts incoming protobuf message to internal state */
// Formats are passed as referenced const (new object) we read from, and a reference to the local variable we write to
using ProtoStateUpdater = std::function<StateUpdateResult(const ProtoT&, T&)>;
/** Extracts the specific proto type from Request oneof */
using RequestExtractor = std::function<bool(const api_Request&, ProtoT&)>;