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>
74 lines
1.7 KiB
C++
74 lines
1.7 KiB
C++
#ifndef MESSAGE_RUNTIME_HPP
|
|
#define MESSAGE_RUNTIME_HPP
|
|
#include <cstdint>
|
|
#include <memory>
|
|
#include <vector>
|
|
namespace notify {
|
|
enum class Code : int {
|
|
ok = 0,
|
|
invalid = -1,
|
|
missing = -2,
|
|
busy = -3,
|
|
full = -4,
|
|
empty = -5,
|
|
denied = -6
|
|
};
|
|
struct Message {
|
|
int id = 0;
|
|
int value = 0;
|
|
};
|
|
struct Event {
|
|
std::uint64_t serial = 0;
|
|
int queue = 0;
|
|
int owner = 0;
|
|
int cookie = 0;
|
|
};
|
|
struct QueueView {
|
|
std::uint64_t epoch = 0;
|
|
int capacity = 0;
|
|
int size = 0;
|
|
int owner = 0;
|
|
int cookie = 0;
|
|
};
|
|
struct Stats {
|
|
std::uint64_t created = 0;
|
|
std::uint64_t closed = 0;
|
|
std::uint64_t sent = 0;
|
|
std::uint64_t received = 0;
|
|
std::uint64_t discarded = 0;
|
|
std::uint64_t armed = 0;
|
|
std::uint64_t canceled = 0;
|
|
std::uint64_t notified = 0;
|
|
std::uint64_t claimed = 0;
|
|
};
|
|
template<class T> struct Result {
|
|
Code code = Code::ok;
|
|
T value{};
|
|
};
|
|
class Runtime {
|
|
public:
|
|
Runtime();
|
|
~Runtime();
|
|
Runtime(const Runtime&) = delete;
|
|
Runtime& operator=(const Runtime&) = delete;
|
|
Code create(int queue, int capacity);
|
|
Code close(int queue);
|
|
Code arm(int queue, int owner, int cookie);
|
|
Code cancel(int queue, int owner);
|
|
Code send(int queue, int id, int value);
|
|
Result<Message> receive(int queue);
|
|
Result<std::vector<Message>> drain(int queue, int limit);
|
|
Result<Message> front(int queue) const;
|
|
Result<Message> at(int queue, int index) const;
|
|
Result<QueueView> snapshot(int queue) const;
|
|
Result<Event> claim(int owner);
|
|
Result<Event> inspect(int owner) const;
|
|
Result<int> pending(int owner) const;
|
|
Stats stats() const;
|
|
private:
|
|
struct Impl;
|
|
std::unique_ptr<Impl> impl_;
|
|
};
|
|
}
|
|
#endif
|