Declare portable primitive checkpoint profile (M11.2c-2b)
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m59s
Foundation / checks (client) (push) Successful in 12m24s
Foundation / checks (network) (push) Successful in 13m51s
Foundation / checks (tsan) (push) Successful in 8m7s
Foundation / checks (checks) (push) Successful in 33m53s
Foundation / checks (postgres) (push) Successful in 46m23s
Foundation / server-image (push) Successful in 24s
Foundation / postgres-tools (push) Successful in 1m36s
Foundation / image (push) Successful in 2m45s

This commit is contained in:
dingo
2026-10-10 05:00:15 -04:00
parent 41237bd289
commit 7b6f722b1b
9 changed files with 215 additions and 22 deletions
+20 -15
View File
@@ -32,9 +32,9 @@ bool valid(const PrimitiveBatch& batch) {
}
return true;
}
void put(std::vector<std::uint8_t>& out, std::uint64_t value, unsigned width) {
void put(std::span<std::uint8_t> out, std::size_t& at, std::uint64_t value, unsigned width) {
for (unsigned i = 0; i < width; ++i) {
out.push_back(static_cast<std::uint8_t>(value & 255U));
out[at++] = static_cast<std::uint8_t>(value & 255U);
value >>= 8U;
}
}
@@ -64,23 +64,28 @@ std::expected<std::vector<std::uint8_t>, PrimitiveBatchError>
encode_primitive_batch(const PrimitiveBatch& batch) {
if (!valid(batch))
return std::unexpected{PrimitiveBatchError::format};
std::vector<std::uint8_t> out;
out.reserve(primitive_batch_header_bytes + batch.births.size() * primitive_birth_bytes);
put(out, magic, 8);
put(out, primitive_batch_format, 4);
put(out, batch.births.size(), 4);
std::vector<std::uint8_t> out(primitive_batch_header_bytes +
batch.births.size() * primitive_birth_bytes);
std::size_t at{};
const auto array = [&](const auto& bytes) {
for (const auto b : bytes)
out[at++] = b;
};
put(out, at, magic, 8);
put(out, at, primitive_batch_format, 4);
put(out, at, batch.births.size(), 4);
const auto& h = batch.header;
for (const auto v : {h.world, h.region, h.frame})
put(out, v, 8);
out.insert(out.end(), h.predecessor.begin(), h.predecessor.end());
out.insert(out.end(), h.predecessor_digest.begin(), h.predecessor_digest.end());
put(out, h.begin_tick, 8);
put(out, h.end_tick, 8);
put(out, 0, 8);
put(out, at, v, 8);
array(h.predecessor);
array(h.predecessor_digest);
put(out, at, h.begin_tick, 8);
put(out, at, h.end_tick, 8);
put(out, at, 0, 8);
for (const auto& b : batch.births) {
out.insert(out.end(), b.request.account.begin(), b.request.account.end());
array(b.request.account);
for (const auto v : {b.request.action, b.identity, b.generation, b.born.value})
put(out, v, 8);
put(out, at, v, 8);
}
return out;
}