Skip to main content

dmsg_process

Function dmsg_process 

Source
pub fn dmsg_process(dmsg: &Dmsg) -> DmsgDispatch
Expand description

Stage 7 dispatcher: classify a parsed Dmsg as control-plane traffic the cluster layer should consume directly, or data-plane traffic that should continue through the protocol stack.

Stage 10 will extend this with the gossip-message decoders. For now, only the message-shape side of the dispatch is in place.

ยงExamples

use dynomite::proto::dnode::{dmsg_process, Dmsg, DmsgDispatch, DmsgType};

let mut d = Dmsg::new();
d.ty = DmsgType::CryptoHandshake;
assert_eq!(dmsg_process(&d), DmsgDispatch::Bypass);

// Gossip variants other than SYN / SYN_REPLY fall through.
d.ty = DmsgType::GossipShutdown;
assert_eq!(dmsg_process(&d), DmsgDispatch::Forward);

d.ty = DmsgType::Req;
assert_eq!(dmsg_process(&d), DmsgDispatch::Forward);