1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! Repair-message construction.
//!
//! Reproduces `redis_make_repair_query` from the reference engine.
//! The full implementation depends on per-response argument parsing
//! that the Stage 9 pipeline supplies; the data-shape side
//! (read-repair toggle, repairable-command catalog) lands here so
//! the rest of the engine can check eligibility today.
use crate;
use ;
/// True when the reference engine flags the request type as
/// "repairable" via `proto_cmd_info[ty].is_repairable`.
/// Build a repair message for the response set held in `rspmgr`.
///
/// Returns [`RepairOutcome::NoOp`] when read repairs are disabled,
/// when the originating request is not repairable, or when no
/// outdated response was found. Returns
/// [`RepairOutcome::Rewritten`] with a freshly built repair message
/// otherwise.
///
/// The "build a repair message" arm depends on each response's
/// post-parsed argument list, which the Stage 9 dispatcher
/// populates on every response mbuf. The data-shape side is in
/// place; the per-response argument parsing lands once Stage 9
/// exercises the workflow.
///
/// # Examples
///
/// ```
/// use dynomite::msg::{Msg, MsgType, ResponseMgr};
/// use dynomite::proto::redis::redis_make_repair_query;
///
/// let req = Msg::new(0, MsgType::ReqRedisGet, true);
/// let mgr = ResponseMgr::new(&req, 3, None);
/// let outcome = redis_make_repair_query(&mgr).unwrap();
/// matches!(outcome, dynomite::proto::redis::RepairOutcome::NoOp);
/// ```