Implement M6.7 bounded environmental interval scheduling
This commit is contained in:
@@ -65,6 +65,9 @@ class EnvironmentalCommunity {
|
||||
[[nodiscard]] EnvironmentalProgress progress() const noexcept {
|
||||
return progress_;
|
||||
}
|
||||
[[nodiscard]] std::uint64_t tick_microseconds() const noexcept {
|
||||
return config_.tick_microseconds;
|
||||
}
|
||||
|
||||
private:
|
||||
struct State {
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
#include "evo/processes/environmental_community.hpp"
|
||||
#include <optional>
|
||||
|
||||
namespace evo::processes {
|
||||
inline constexpr std::size_t max_environment_interval = 64;
|
||||
struct EnvironmentalInterval {
|
||||
world::WorldIdentity identity{};
|
||||
std::uint64_t begin{}, end{}, tick_microseconds{};
|
||||
std::span<const EnvironmentalInput> inputs;
|
||||
};
|
||||
enum class EnvironmentalIntervalError : std::uint8_t {
|
||||
identity,
|
||||
quantum,
|
||||
stale,
|
||||
range,
|
||||
backlog,
|
||||
input_count
|
||||
};
|
||||
struct EnvironmentalIntervalFailure {
|
||||
std::uint64_t tick{};
|
||||
CommunityError cause{};
|
||||
auto operator<=>(const EnvironmentalIntervalFailure&) const = default;
|
||||
};
|
||||
// Successful admission may still return a failed tick after a committed prefix.
|
||||
// Only reports[0..committed) are meaningful. See ENVIRONMENTAL_SCHEDULING.md.
|
||||
struct EnvironmentalIntervalResult {
|
||||
std::size_t committed{};
|
||||
std::uint64_t last_tick{};
|
||||
std::array<EnvironmentalReport, max_environment_interval> reports{};
|
||||
std::optional<EnvironmentalIntervalFailure> failure;
|
||||
};
|
||||
[[nodiscard]] std::expected<EnvironmentalIntervalResult, EnvironmentalIntervalError>
|
||||
schedule_environment(EnvironmentalCommunity& community, const EnvironmentalInterval& interval);
|
||||
} // namespace evo::processes
|
||||
Reference in New Issue
Block a user