Skip to main content

dmsg_process

Function dmsg_process 

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

Classify a parsed Dmsg as control-plane traffic the cluster layer should consume directly (Bypass), or data-plane traffic that should continue through the protocol stack (Forward).

This decides the message-shape routing only; decoding the forwarded gossip variants into cluster events is done by the cluster layer, not here.

ยง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);