100 tasks from the HWE arm-linux code-gen pool (outside the lk/man/pth range given to batch 22), each with at least one independent contract-edge defect and plain public docs. Claude reviewed 100/100 USABLE against current digests; no ID or source overlap with main or batch 22. Difficulty is unmeasured. progress.md records the wrap-up: all Codex sessions and Qwen schedulers stopped for the user's rollout, Qwen results so far (57 HARD of 373), and what is left on each batch branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
65 lines
1.9 KiB
C++
65 lines
1.9 KiB
C++
#include "model_internal.hpp"
|
|
|
|
namespace ps {
|
|
void append_record(Impl &state, int kind, int device, int actor,
|
|
std::uint64_t token, std::uint64_t generation) {
|
|
Record record;
|
|
record.sequence = state.next_record++;
|
|
record.kind = kind;
|
|
record.device = device;
|
|
record.actor = actor;
|
|
record.token = token;
|
|
record.generation = generation;
|
|
state.records.push_back(record);
|
|
if (state.records.size() > 128) {
|
|
state.records.pop_front();
|
|
}
|
|
}
|
|
|
|
void publish(Impl &state, int device, bool removed) {
|
|
auto &entry = state.devices[device];
|
|
++entry.generation;
|
|
append_record(state, 1, device, -1, 0, entry.generation);
|
|
auto listeners = entry.listeners;
|
|
for (int actor : listeners) {
|
|
auto &watch = state.actors[actor].view;
|
|
++watch.wakes;
|
|
watch.pending = entry.generation;
|
|
append_record(state, 2, device, actor, watch.token, entry.generation);
|
|
if (removed) {
|
|
watch.phase = GONE;
|
|
watch.ready = 0;
|
|
unsubscribe(state, actor);
|
|
}
|
|
}
|
|
}
|
|
|
|
int Model::journal(std::uint64_t cursor, int limit, std::vector<Record> &out,
|
|
std::uint64_t &next) const {
|
|
if (limit < 0 || limit > 32) {
|
|
return -22;
|
|
}
|
|
std::uint64_t oldest = state->records.empty() ? state->next_record : state->records.front().sequence;
|
|
std::uint64_t start = cursor == 0 ? oldest : cursor;
|
|
if (start < oldest) {
|
|
return -75;
|
|
}
|
|
if (start > state->next_record) {
|
|
return -22;
|
|
}
|
|
std::vector<Record> result;
|
|
for (const auto &record : state->records) {
|
|
if (record.sequence < start) {
|
|
continue;
|
|
}
|
|
if (static_cast<int>(result.size()) == limit) {
|
|
break;
|
|
}
|
|
result.push_back(record);
|
|
}
|
|
next = start + result.size();
|
|
out = result;
|
|
return 0;
|
|
}
|
|
}
|