Skip to main content

dynomite/proto/memcache/
verify.rs

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