amos 9d633e9e67 Batch 15 (20261023-C-hwe-scale-15): 320 HWE-derived repair tasks
One user-space repair task per eligible HWE debug-diag / compile-deploy base
ID: 320 admitted (C 218, C++ 97, build scripts 5), 1 skipped by the content
filter. Each ships a public spec with a check-to-basis table, at least two
defects with single-fix fixtures, a symptom-masking fixture and an alternative
correct implementation. Claude re-checked all 320: structure, the HWE quality
items and trace6 Docker calibration receipts against current digests
(320/320 USABLE). Difficulty is unmeasured. Known follow-up: 212 tasks use 120
ad-hoc family names; the next batch maps them to the canonical list.
The batch's 1,256-line progress log stays in its factory report and the
36-local branch batch15-hwe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 01:55:56 +08:00

85 lines
2.3 KiB
C++

#ifndef RETAINED_TOPIC_HPP
#define RETAINED_TOPIC_HPP
#include <cstdint>
#include <memory>
#include <string>
#include <vector>
namespace retained {
constexpr int invalid = -22;
constexpr int missing = -2;
constexpr int exists = -17;
constexpr int full = -28;
struct Policy {
int durability = 0;
int depth = 1;
};
struct Sample {
int writer = 0;
std::uint64_t generation = 0;
std::uint64_t sequence = 0;
std::uint64_t order = 0;
std::int32_t value = 0;
int historical = 0;
};
struct WriterView {
int topic = 0;
int durability = 0;
int depth = 0;
std::uint64_t generation = 0;
std::uint64_t published = 0;
std::uint64_t cached = 0;
};
struct ReaderView {
int topic = 0;
int durability = 0;
int capacity = 0;
std::uint64_t pending = 0;
std::uint64_t dropped = 0;
std::uint64_t delivered = 0;
};
struct TopicView {
std::uint64_t writers = 0;
std::uint64_t readers = 0;
std::uint64_t cached = 0;
std::uint64_t pending = 0;
};
struct Summary {
std::uint64_t writers = 0;
std::uint64_t readers = 0;
std::uint64_t cached = 0;
std::uint64_t pending = 0;
std::uint64_t publications = 0;
std::uint64_t generations = 0;
};
bool valid_policy(const Policy &policy);
int profile_policy(const std::string &name, Policy &out);
int parse_policy(const std::string &text, Policy &out);
std::string format_policy(const Policy &policy);
class Broker {
public:
Broker();
~Broker();
Broker(const Broker &) = delete;
Broker &operator=(const Broker &) = delete;
int open_writer(int id, int topic, const Policy &policy);
int open_profile(int id, int topic, const std::string &profile);
int close_writer(int id);
int publish(int id, std::int32_t value, Sample &out);
int open_reader(int id, int topic, int durability, int capacity);
int close_reader(int id);
int resize_reader(int id, int capacity);
int set_history(int id, int depth);
int take(int id, int maximum, std::vector<Sample> &out);
int peek(int id, std::vector<Sample> &out) const;
int writer_view(int id, WriterView &out) const;
int reader_view(int id, ReaderView &out) const;
int topic_view(int topic, TopicView &out) const;
Summary summary() const;
void clear();
private:
struct State;
std::unique_ptr<State> state_;
};
}
#endif