Skip to main content

move_completed

Function move_completed 

Source
pub fn move_completed(from: &mut MsgQueue, to: &mut MsgQueue, id: MsgId)
Expand description

Drain from of every request whose selected_rsp matches id and forward them to to.

This is the data-shape building block the connection-level req_send_next / req_send_done functions consume; it lets tests exercise the sibling-walk without standing up the full connection FSM.

ยงExamples

use dynomite::msg::{request, Msg, MsgQueue, MsgType};

let mut a = MsgQueue::new();
let mut b = MsgQueue::new();
let mut m = Msg::new(1, MsgType::ReqRedisGet, true);
m.set_selected_rsp(Some(99));
a.push_back(m);
request::move_completed(&mut a, &mut b, 99);
assert!(a.is_empty());
assert_eq!(b.len(), 1);