Skip to main content

dynomite/proto/memcache/
mod.rs

1//! Memcached text-protocol parser, helpers, and repair stubs.
2//!
3//! The Memcached datastore exposes a small ASCII command grammar. The
4//! engine consumes it with a single byte-driven state machine for
5//! requests ([`parser::memcache_parse_req`]) and another for
6//! responses ([`parser::memcache_parse_rsp`]). Surrounding helpers
7//! cover command classification, multi-key fragmentation, response
8//! coalescing, and the placeholder repair surface.
9//!
10//! # Examples
11//!
12//! ```
13//! use dynomite::msg::{Msg, MsgType};
14//! use dynomite::proto::memcache;
15//!
16//! let mut req = Msg::new(0, MsgType::Unknown, true);
17//! let r = memcache::memcache_parse_req(&mut req, b"get user:42\r\n");
18//! assert_eq!(r, dynomite::msg::MsgParseResult::Ok);
19//! assert_eq!(req.ty(), MsgType::ReqMcGet);
20//! assert_eq!(req.keys()[0].key(), b"user:42");
21//! ```
22
23pub mod coalesce;
24pub mod commands;
25pub mod fragment;
26pub mod multikey;
27pub mod parser;
28pub mod repair;
29pub mod verify;
30
31pub use self::coalesce::{memcache_post_coalesce, memcache_pre_coalesce};
32pub use self::commands::{
33    memcache_arithmetic, memcache_cas, memcache_delete, memcache_retrieval, memcache_storage,
34    memcache_touch,
35};
36pub use self::fragment::{memcache_fragment, FragmentDispatcher, FragmentOutcome};
37pub use self::multikey::memcache_is_multikey_request;
38pub use self::parser::{memcache_parse_req, memcache_parse_rsp};
39pub use self::repair::{
40    memcache_clear_repair_md_for_key, memcache_make_repair_query, memcache_reconcile_responses,
41    memcache_rewrite_query, memcache_rewrite_query_with_timestamp_md,
42};
43pub use self::verify::memcache_verify_request;