Module protocol

Module protocol 

Source
Expand description

RESP Protocol Implementation

This module provides a complete implementation of the Redis Serialization Protocol (RESP).

§Overview

RESP is a simple, binary-safe protocol used by Redis for client-server communication. It supports several data types and is designed to be easy to parse and serialize.

§Modules

  • types: Defines the RespValue enum and serialization
  • parser: Zero-copy parser for incoming RESP data

§Example

use flashkv::protocol::{RespValue, RespParser, parse_message};
use bytes::Bytes;

// Parsing incoming data
let data = b"*2\r\n$3\r\nGET\r\n$4\r\nname\r\n";
let (value, consumed) = parse_message(data).unwrap().unwrap();

// Creating responses
let response = RespValue::bulk_string(Bytes::from("Ariz"));
let bytes = response.serialize();

Re-exports§

pub use parser::parse_message;
pub use parser::ParseError;
pub use parser::ParseResult;
pub use parser::RespParser;
pub use types::RespValue;

Modules§

parser
Zero-Copy RESP Protocol Parser
types
RESP (Redis Serialization Protocol) Data Types