seqeron 0.18.0
Loading...
Searching...
No Matches
SnapshotListener.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <filesystem>
5#include <span>
6#include <vector>
7
9
18{
19 public:
25 virtual std::uint32_t formatVersion() const = 0;
26
35 virtual std::vector<std::uint32_t> supportedFormatVersions() const
36 {
37 return { formatVersion() };
38 }
39
52 virtual std::int32_t onSnapshot(std::span<std::uint8_t> buffer, std::int32_t recordIndex) = 0;
53
63 virtual void onRestore(std::span<const std::uint8_t> record, std::int32_t recordIndex,
64 std::uint32_t formatVersion) = 0;
65
66 protected:
67 ~SnapshotListener() = default;
68};
69
76{
78 std::filesystem::path directory;
79};
80
81} // namespace org::limitless::seqeron::app
What a source that takes part in snapshot rounds serializes, and restores from (doc/snapshot....
Definition SnapshotListener.hpp:18
virtual std::vector< std::uint32_t > supportedFormatVersions() const
Lists the formats onRestore reads.
Definition SnapshotListener.hpp:35
virtual std::int32_t onSnapshot(std::span< std::uint8_t > buffer, std::int32_t recordIndex)=0
Encodes the next record of this instance's state as of the round's cut — every frame up to the Snapsh...
virtual std::uint32_t formatVersion() const =0
Names the record format onSnapshot writes, carried in SnapshotEnd::formatVersion and opaque to seqero...
virtual void onRestore(std::span< const std::uint8_t > record, std::int32_t recordIndex, std::uint32_t formatVersion)=0
Decodes the next record of the snapshot this instance restores from, in the order onSnapshot encoded ...
Definition ClusterError.hpp:5
What takes a façade into snapshot rounds: the listener, which must outlive the façade,...
Definition SnapshotListener.hpp:76
std::filesystem::path directory
Definition SnapshotListener.hpp:78
SnapshotListener & listener
Definition SnapshotListener.hpp:77