Wire preserved update control, health evidence and record publication
Rust development slice / linux (push) Failing after 7s
Rust development slice / linux (push) Failing after 7s
This commit is contained in:
@@ -306,7 +306,13 @@ impl<V: Ed25519Verifier> ClientSync<V> {
|
||||
merge_helper(&mut attempts, h)?;
|
||||
}
|
||||
ensure!(attempts.len() <= 256, "SYNC_ATTEMPT_CAPACITY_NO_COMPACTION");
|
||||
let ids = pending_ids(&tx)?;
|
||||
let mut ids = pending_ids(&tx)?;
|
||||
if let Some(update) = inflight.first() {
|
||||
let grant = Uuid::parse_str(&update.grant_id)?;
|
||||
ids.extend(crate::update_health_inventory::pending_ids(&tx, grant)?);
|
||||
ids.sort();
|
||||
ids.dedup();
|
||||
}
|
||||
ensure!(ids.len() <= 256, "SYNC_RECEIPT_CAPACITY");
|
||||
let next: i64 = tx.query_row(
|
||||
"UPDATE counter SET seq=seq+1 WHERE id=1 RETURNING seq",
|
||||
@@ -562,6 +568,19 @@ impl<V: Ed25519Verifier> ClientSync<V> {
|
||||
"UPDATE reconcile_requests SET response=?2 WHERE id=?1 AND response IS NULL",
|
||||
params![decision.request_id.to_string(), response.encode_to_vec()],
|
||||
)?;
|
||||
for local in prepared
|
||||
.request
|
||||
.attempts
|
||||
.iter()
|
||||
.filter(|a| !a.update_handoff_bytes.is_empty())
|
||||
{
|
||||
crate::update_health_inventory::acknowledge_signed(
|
||||
&tx,
|
||||
Uuid::parse_str(&local.grant_id)?,
|
||||
&decision,
|
||||
response,
|
||||
)?;
|
||||
}
|
||||
tx.execute("UPDATE reconcile_meta SET last_decision=?1,pending_request=NULL,helper_id=?2,helper_checkpoint=?3,fault=COALESCE(fault,?4),high_sequence=?5 WHERE id=1",
|
||||
params![decision.decision_id.to_string(),decision.helper_journal_id.map(|id|id.to_string()),decision.helper_checkpoint,fault,seq])?;
|
||||
tx.commit()?;
|
||||
@@ -692,6 +711,7 @@ pub fn initialize(db: &Connection) -> Result<()> {
|
||||
CREATE TABLE IF NOT EXISTS reconcile_results(id TEXT PRIMARY KEY,job TEXT NOT NULL,attempt TEXT NOT NULL,revision INTEGER NOT NULL,envelope BLOB NOT NULL);
|
||||
CREATE TABLE IF NOT EXISTS reconcile_receipts(id TEXT PRIMARY KEY,decision_id TEXT NOT NULL);
|
||||
CREATE TABLE IF NOT EXISTS reconcile_outcomes(job TEXT NOT NULL,attempt TEXT NOT NULL,outcome BLOB NOT NULL,decision_id TEXT NOT NULL,PRIMARY KEY(job,attempt));")?;
|
||||
crate::update_health_inventory::initialize(db)?;
|
||||
db.execute(
|
||||
"INSERT OR IGNORE INTO reconcile_meta(id,journal_id) VALUES(1,?1)",
|
||||
[Uuid::new_v4().to_string()],
|
||||
|
||||
Reference in New Issue
Block a user