dynomite/proto/memcache/verify.rs
1//! Memcached request verification helper.
2//!
3//! In the reference engine, `memcache_verify_request` always returns
4//! `DN_OK`: there are no Memcached-specific structural checks beyond
5//! what the parser already enforces. The Rust port keeps the same
6//! shape so callers can treat the Redis and Memcached helpers
7//! uniformly.
8
9use crate::msg::Msg;
10
11/// Always succeeds.
12///
13/// # Examples
14///
15/// ```
16/// use dynomite::msg::{Msg, MsgType};
17/// use dynomite::proto::memcache::memcache_verify_request;
18///
19/// let m = Msg::new(0, MsgType::ReqMcSet, true);
20/// assert!(memcache_verify_request(&m).is_ok());
21/// ```
22pub fn memcache_verify_request(_r: &Msg) -> Result<(), VerifyError> {
23 Ok(())
24}
25
26/// Errors verification can produce. The Memcached path never
27/// rejects a parsed request, but the type is exported for parity
28/// with the Redis surface.
29#[derive(Copy, Clone, Debug, Eq, PartialEq, thiserror::Error)]
30#[non_exhaustive]
31pub enum VerifyError {
32 /// Reserved variant. Memcached has no live failure modes.
33 #[error("memcache verify: reserved")]
34 Reserved,
35}