redhub

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

README

REDHUB

RedHub

GoDoc Reference FOSSA Status Go Report Card License

RedHub is a high-performance RESP (Redis Serialization Protocol) server framework built in Go. It leverages the RawEpoll model via the gnet library to achieve ultra-high throughput with multi-threaded support while maintaining low CPU resource consumption.

Features

  • Ultra High Performance - Exceeds Redis single-threaded and multi-threaded implementations in benchmarks
  • Fully Multi-threaded - Native support for multiple CPU cores with efficient event loop distribution
  • Low Resource Consumption - Optimized memory usage and CPU efficiency
  • Full RESP Protocol Support - Compatible with Redis protocol (RESP2)
  • Multi-Protocol Support - Supports RESP, Tile38 native, and Telnet protocols
  • Easy to Use - Create Redis-compatible servers with minimal code
  • Production Ready - Robust error handling, connection management, and extensibility

Architecture

RedHub implements an event-driven architecture based on the gnet framework:

┌─────────────────────────────────────────────────────────────┐
│                         Client Connections                  │
└─────────────────────────────┬───────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────┐
│                     Event Loops (gnet)                      │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐        │
│  │ Event Loop 1│  │ Event Loop 2│  │ Event Loop N│        │
│  │ (Thread 1)  │  │ (Thread 2)  │  │ (Thread N)  │        │
│  └──────┬──────┘  └──────┬──────┘  └──────┬──────┘        │
│         │                 │                 │               │
│         └─────────────────┼─────────────────┘               │
│                           │                                  │
│                           ▼                                  │
│                  ┌──────────────┐                           │
│                  │ RedHub Core  │                           │
│                  │   Handler    │                           │
│                  └──────┬───────┘                           │
└───────────────────────────┼──────────────────────────────────┘
                            │
                            ▼
                  ┌─────────────────┐
                  │ Application     │
                  │ Logic & Storage │
                  └─────────────────┘
Threading Model
  • Single-core mode: All connections handled by a single event loop
  • Multi-core mode: Multiple event loops distribute connections using configurable load balancing strategies
  • Connection Buffering: Each connection maintains its own buffer for command accumulation
  • Thread Safety: Uses RWMutex for connection map synchronization

Installation

go get -u github.com/IceFireDB/redhub

Quick Start

Here's a simple example showing how to create a Redis-compatible server with SET, GET, DEL, PING, and QUIT commands:

Example Code
package main

import (
    "log"
    "strings"
    "sync"

    "github.com/IceFireDB/redhub"
    "github.com/IceFireDB/redhub/pkg/resp"
)

func main() {
    var mu sync.RWMutex
    var items = make(map[string][]byte)

    // Create a new RedHub instance
    rh := redhub.NewRedHub(
        // OnOpen: Called when a new connection is established
        func(c *redhub.Conn) (out []byte, action redhub.Action) {
            // Initialize connection-specific data here
            return nil, redhub.None
        },
        // OnClose: Called when a connection is closed
        func(c *redhub.Conn, err error) (action redhub.Action) {
            // Clean up connection-specific data here
            return redhub.None
        },
        // Handler: Called for each parsed command
        func(cmd resp.Command, out []byte) ([]byte, redhub.Action) {
            // Get command name (case-insensitive)
            cmdName := strings.ToLower(string(cmd.Args[0]))

            switch cmdName {
            case "set":
                // SET key value
                if len(cmd.Args) != 3 {
                    return resp.AppendError(out, 
                        "ERR wrong number of arguments for 'set' command"), redhub.None
                }
                mu.Lock()
                items[string(cmd.Args[1])] = cmd.Args[2]
                mu.Unlock()
                return resp.AppendString(out, "OK"), redhub.None

            case "get":
                // GET key
                if len(cmd.Args) != 2 {
                    return resp.AppendError(out, 
                        "ERR wrong number of arguments for 'get' command"), redhub.None
                }
                mu.RLock()
                val, ok := items[string(cmd.Args[1])]
                mu.RUnlock()
                if !ok {
                    return resp.AppendNull(out), redhub.None
                }
                return resp.AppendBulk(out, val), redhub.None

            case "del":
                // DEL key
                if len(cmd.Args) != 2 {
                    return resp.AppendError(out, 
                        "ERR wrong number of arguments for 'del' command"), redhub.None
                }
                mu.Lock()
                _, ok := items[string(cmd.Args[1])]
                delete(items, string(cmd.Args[1]))
                mu.Unlock()
                if !ok {
                    return resp.AppendInt(out, 0), redhub.None
                }
                return resp.AppendInt(out, 1), redhub.None

            case "ping":
                // PING
                return resp.AppendString(out, "PONG"), redhub.None

            case "quit":
                // QUIT
                return resp.AppendString(out, "OK"), redhub.Close

            default:
                // Unknown command
                return resp.AppendError(out, 
                    "ERR unknown command '"+string(cmd.Args[0])+"'"), redhub.None
            }
        },
    )

    // Start the server
    err := redhub.ListenAndServe("tcp://127.0.0.1:6379", redhub.Options{
        Multicore: true,  // Enable multi-core support
    }, rh)
    if err != nil {
        log.Fatal(err)
    }
}
Run the Example
# Navigate to the example directory
cd example/memory_kv

# Run the server
go run server.go

# In another terminal, test with redis-cli
redis-cli -p 6379

# Or test with redis-benchmark
redis-benchmark -h 127.0.0.1 -p 6379 -n 1000000 -t set,get -c 512 -P 1024 -q

Configuration

RedHub provides various configuration options through the Options struct:

type Options struct {
    Multicore        bool              // Enable multi-core support (default: false)
    LockOSThread     bool              // Lock OS thread (default: false)
    ReadBufferCap    int               // Read buffer capacity (default: 64KB)
    LB               gnet.LoadBalancing // Load balancing strategy (default: RoundRobin)
    NumEventLoop     int               // Number of event loops (default: runtime.NumCPU())
    ReusePort        bool              // Enable port reuse (default: false)
    Ticker           bool              // Enable ticker (default: false)
    TCPKeepAlive     time.Duration     // TCP keep-alive interval
    TCPKeepCount     int               // TCP keep-alive count
    TCPKeepInterval  time.Duration     // TCP keep-alive interval
    TCPNoDelay       gnet.TCPSocketOpt // TCP no-delay option
    SocketRecvBuffer int               // Socket receive buffer size
    SocketSendBuffer int               // Socket send buffer size
    EdgeTriggeredIO  bool              // Edge-triggered I/O (default: false)
}
Example Configuration
options := redhub.Options{
    Multicore:        true,              // Enable multi-core
    NumEventLoop:     8,                 // Use 8 event loops
    ReadBufferCap:    64 * 1024,         // 64KB read buffer
    SocketRecvBuffer: 128 * 1024,        // 128KB socket receive buffer
    SocketSendBuffer: 128 * 1024,        // 128KB socket send buffer
    TCPKeepAlive:     30 * time.Second,  // 30s keep-alive
    LB:               gnet.LeastConnections, // Load balancing strategy
}

API Reference

Core Types
Action

Action represents the action to take after an event handler completes.

const (
    None     // No action
    Close    // Close the connection
    Shutdown // Shutdown the server
)
RedHub

RedHub is the main server structure that manages connections and command processing.

Conn

Conn wraps a gnet.Conn and provides additional functionality for connection management.

Command

Command represents a parsed RESP command with raw bytes and arguments.

type Command struct {
    Raw  []byte   // Raw RESP message
    Args [][]byte // Parsed arguments
}
Main Functions
NewRedHub

Creates a new RedHub instance with the specified event handlers.

func NewRedHub(
    onOpened func(c *Conn) (out []byte, action Action),
    onClosed func(c *Conn, err error) (action Action),
    handler func(cmd resp.Command, out []byte) ([]byte, Action),
) *RedHub

Parameters:

  • onOpened: Called when a new connection is established
  • onClosed: Called when a connection is closed
  • handler: Called for each parsed command
ListenAndServe

Starts the RedHub server with the specified address and options.

func ListenAndServe(addr string, options Options, rh *RedHub) error

Parameters:

  • addr: Server address in format "tcp://host:port"
  • options: Server configuration options
  • rh: RedHub instance

RESP Protocol Package

The resp package provides comprehensive support for the Redis Serialization Protocol (RESP).

RESP Types
const (
    Integer = ':'  // Integers (e.g., :1000\r\n)
    String  = '+'  // Simple strings (e.g., +OK\r\n)
    Bulk    = '$'  // Bulk strings (e.g., $6\r\nfoobar\r\n)
    Array   = '*'  // Arrays (e.g., *2\r\n$3\r\nGET\r\n$3\r\nkey\r\n)
    Error   = '-'  // Errors (e.g., -ERR unknown command\r\n)
)
RESP Serialization Functions

The resp package provides functions for serializing various Go types to RESP format:

  • AppendInt(b []byte, n int64) []byte - Append integer
  • AppendString(b []byte, s string) []byte - Append simple string
  • AppendBulk(b []byte, bulk []byte) []byte - Append bulk bytes
  • AppendBulkString(b []byte, bulk string) []byte - Append bulk string
  • AppendArray(b []byte, n int) []byte - Append array header
  • AppendError(b []byte, s string) []byte - Append error
  • AppendNull(b []byte) []byte - Append null value
  • AppendOK(b []byte) []byte - Append OK response
  • AppendAny(b []byte, v interface{}) []byte - Append any Go type
Example: Building Responses
var out []byte

// Simple string
out = resp.AppendString(out, "OK")

// Bulk string
out = resp.AppendBulkString(out, "Hello World")

// Integer
out = resp.AppendInt(out, 42)

// Array
out = resp.AppendArray(out, 3)
out = resp.AppendBulkString(out, "item1")
out = resp.AppendBulkString(out, "item2")
out = resp.AppendBulkString(out, "item3")

// Error
out = resp.AppendError(out, "ERR something went wrong")

// Null value
out = resp.AppendNull(out)

// Any type
out = resp.AppendAny(out, map[string]interface{}{
    "name": "Redis",
    "version": 7.0,
    "features": []string{"persistence", "replication"},
})

Advanced Usage

Connection Context

Store connection-specific data using Conn.SetContext():

type ConnectionData struct {
    Authenticated bool
    Database      int
    ClientID      string
}

onOpened := func(c *redhub.Conn) (out []byte, action redhub.Action) {
    c.SetContext(&ConnectionData{
        Authenticated: false,
        Database:      0,
        ClientID:      generateID(),
    })
    return nil, redhub.None
}

onClosed := func(c *redhub.Conn, err error) (action redhub.Action) {
    ctx := c.Context().(*ConnectionData)
    // Cleanup connection data
    return redhub.None
}
Command Pipelining

RedHub naturally supports command pipelining (sending multiple commands in a single network packet):

# Client sends multiple commands in one request
echo -e '*2\r\n$3\r\nSET\r\n$3\r\nkey1\r\n$5\r\nvalue1\r\n*2\r\n$3\r\nSET\r\n$3\r\nkey2\r\n$5\r\nvalue2\r\n*2\r\n$3\r\nGET\r\n$3\r\nkey1\r\n' | nc localhost 6379
Multi-Protocol Support

RedHub supports three protocol types:

  1. RESP (Redis) - Standard Redis protocol (commands starting with *)
  2. Tile38 Native - Native Tile38 protocol (commands starting with $)
  3. Telnet - Plain text commands

Performance Benchmarks

Test Environment
OS:     Debian Buster 10.6 64bit
CPU:    8 CPU cores
Memory: 64.0 GiB
Go:     go1.16.5 linux/amd64
Benchmark Results
Implementation SET (req/sec) GET (req/sec)
Redis 5.0.3 (single-threaded) 2,306,060 3,096,742
Redis 6.2.5 (single-threaded) 2,076,325 2,652,801
Redis 6.2.5 (multi-threaded) 1,944,692 2,375,184
RedCon (multi-threaded) 2,332,742 14,654,162
RedHub (multi-threaded) 4,087,305 16,490,765
Benchmark Command
redis-benchmark -h 127.0.0.1 -p 6379 -n 50000000 -t set,get -c 512 -P 1024 -q

REDHUB Benchmarks

REDHUB Benchmarks

Testing

Run All Tests
go test ./...
Run Tests with Coverage
go test -cover ./...
Run Tests with Verbose Output
go test -v ./...
Run Specific Package Tests
go test ./pkg/resp/...
Run Specific Test
go test -run TestNewRedHub .

Best Practices

Performance Optimization
  1. Enable Multi-core: Always enable Multicore: true in production
  2. Tune Buffer Sizes: Adjust ReadBufferCap, SocketRecvBuffer, and SocketSendBuffer based on your workload
  3. Choose Load Balancing: Use appropriate load balancing strategy (RoundRobin, LeastConnections, etc.)
  4. Avoid Blocking: Never block in event handlers - use async operations
  5. Reuse Buffers: Use buffer pools for temporary allocations
Thread Safety
  1. Shared Data: Always protect shared data with appropriate synchronization (mutexes)
  2. Connection Context: Use Conn.SetContext() for per-connection data (thread-safe)
  3. Event Loop Handlers: Handlers execute in event loop threads - avoid heavy computations
Error Handling
  1. Protocol Errors: Return proper RESP error messages using resp.AppendError()
  2. Connection Errors: Log errors in onClosed handler
  3. Graceful Shutdown: Handle server shutdown properly

Contributing

We welcome contributions! Please follow these guidelines:

  1. Fork the repository
  2. Create a new branch from main/master
  3. Make your changes with tests
  4. Ensure all tests pass: go test ./...
  5. Commit with DCO sign-off: git commit -s -m "message"
  6. Push to your fork
  7. Create a pull request
Development Setup
# Clone the repository
git clone https://github.com/IceFireDB/redhub.git
cd redhub

# Install dependencies
go mod download

# Run tests
go test ./...

# Run the example
go run example/memory_kv/server.go

License

FOSSA Status

This project is licensed under the MIT License - see the LICENSE file for details.

Disclaimer

When you use this software, you agree and acknowledge that the author, maintainer, and contributor of this software are not responsible for any risks, costs, or problems you encounter. If you find a software defect or bug, please submit a patch to help improve it!

  • IceFireDB - A distributed database based on RedHub
  • gnet - High-performance event-loop networking framework

Documentation

Support

Acknowledgments

Documentation

Overview

Package redhub provides a high-performance RESP (Redis Serialization Protocol) server framework. It is built on top of the gnet library and uses the RawEpoll model to achieve ultra-high throughput with multi-threaded support while maintaining low CPU resource consumption.

RedHub is designed to help developers create Redis-compatible servers with minimal code. It supports the full RESP2 protocol and is compatible with standard Redis clients.

Basic Usage

To create a simple Redis-compatible server:

rh := redhub.NewRedHub(
    func(c *redhub.Conn) (out []byte, action redhub.Action) {
        // Called when a new connection is established
        return nil, redhub.None
    },
    func(c *redhub.Conn, err error) (action redhub.Action) {
        // Called when a connection is closed
        return redhub.None
    },
    func(cmd resp.Command, out []byte) ([]byte, redhub.Action) {
        // Called for each parsed command
        cmdName := strings.ToLower(string(cmd.Args[0]))
        switch cmdName {
        case "ping":
            return resp.AppendString(out, "PONG"), redhub.None
        default:
            return resp.AppendError(out, "ERR unknown command"), redhub.None
        }
    },
)

err := redhub.ListenAndServe("tcp://127.0.0.1:6379", redhub.Options{
    Multicore: true,
}, rh)

Architecture

RedHub implements an event-driven architecture using multiple event loops that run in parallel (in multi-core mode). Each connection has an associated buffer for command accumulation, and commands are parsed using the RESP protocol parser from the resp package.

Threading Model

- Single-core mode: All connections are handled by a single event loop - Multi-core mode: Multiple event loops distribute connections using load balancing strategies - Connection Buffering: Each connection maintains its own buffer and command queue - Thread Safety: Uses RWMutex for connection map synchronization

Performance

RedHub is optimized for high performance and can handle millions of requests per second depending on the hardware and configuration. See the benchmarks in the project README for detailed performance comparisons with Redis and other implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenAndServe

func ListenAndServe(addr string, options Options, rh *RedHub) error

ListenAndServe starts the RedHub server on the specified address with the given options.

This is the main entry point for starting a RedHub server. The address should be in the format "tcp://host:port" (e.g., "tcp://127.0.0.1:6379").

The function blocks until the server is stopped, either by a Shutdown action or by an error.

Parameters:

  • addr: The address to listen on in format "scheme://host:port"
  • options: Server configuration options
  • rh: The RedHub instance created by NewRedHub

Returns an error if the server fails to start. Otherwise, blocks until shutdown.

Example:

err := redhub.ListenAndServe("tcp://127.0.0.1:6379", redhub.Options{
    Multicore: true,
    NumEventLoop: 8,
}, rh)
if err != nil {
    log.Fatal(err)
}

Types

type Action

type Action int

Action represents the type of action to be taken after an event handler completes. Event handlers (OnOpen, OnClose, Handler) return an Action value to control the server's behavior after processing the event.

const (
	// None indicates that no action should be taken following an event.
	// The connection remains open and the server continues processing.
	None Action = iota

	// Close indicates that the connection should be closed.
	// This is typically returned when processing a QUIT command or when
	// an error condition requires closing the connection.
	Close

	// Shutdown indicates that the entire server should be shut down.
	// This is rarely used in normal operation but can be used to implement
	// graceful shutdown functionality.
	Shutdown
)

type Conn

type Conn struct {
	gnet.Conn
}

Conn wraps a gnet.Conn and provides additional functionality for connection management. It is passed to the OnOpen and OnClose handlers to allow application code to store connection-specific data and perform connection-level operations.

func (*Conn) Context added in v0.2.0

func (c *Conn) Context() interface{}

Context returns the connection-specific context data. Returns the data that was previously set using SetContext. Returns nil if no context has been set.

func (*Conn) SetContext added in v0.2.0

func (c *Conn) SetContext(ctx interface{})

SetContext sets the connection-specific context data. This can be used to store application-specific data such as authentication state, selected database, or any other per-connection information.

The context is accessible via the Context() method and is automatically cleaned up when the connection is closed.

type Options

type Options struct {
	// Multicore enables multi-core support. When true, multiple event loops are created
	// and connections are distributed across them using the configured load balancing strategy.
	// This is recommended for production environments with high connection counts.
	// Default: false
	Multicore bool

	// LockOSThread locks the OS thread for each event loop. This can improve performance
	// in certain scenarios but may reduce the overall number of connections that can be handled.
	// Default: false
	LockOSThread bool

	// ReadBufferCap sets the capacity of the read buffer in bytes. Larger buffers can
	// improve throughput for workloads with large requests or responses but use more memory.
	// Default: 64KB
	ReadBufferCap int

	// LB specifies the load balancing strategy used to distribute connections across
	// event loops when Multicore is enabled. Available strategies include:
	//   - RoundRobin: Distribute connections evenly across loops
	//   - LeastConnections: Assign to loop with fewest active connections
	//   - SourceAddrHash: Hash based on client address
	// Default: gnet.RoundRobin
	LB gnet.LoadBalancing

	// NumEventLoop specifies the number of event loops to create. If 0, the number
	// of CPU cores is used. This option is only effective when Multicore is true.
	// Default: 0 (runtime.NumCPU())
	NumEventLoop int

	// ReusePort enables the SO_REUSEPORT socket option, allowing multiple sockets
	// to bind to the same address and port. This can improve connection acceptance
	// performance but is only available on certain operating systems.
	// Default: false
	ReusePort bool

	// Ticker enables periodic ticker events. When true, the OnTick handler is called
	// at regular intervals. Useful for implementing periodic tasks such as cleanup,
	// stats collection, or timeout handling.
	// Default: false
	Ticker bool

	// TCPKeepAlive sets the TCP keep-alive interval. If non-zero, TCP keep-alive
	// probes are sent at the specified interval to detect dead connections.
	// Default: 0 (disabled)
	TCPKeepAlive time.Duration

	// TCPKeepCount sets the number of unacknowledged keep-alive probes before
	// considering the connection dead. Only effective if TCPKeepAlive is set.
	// Default: 0 (system default)
	TCPKeepCount int

	// TCPKeepInterval sets the interval between keep-alive probes when they are
	// not acknowledged. Only effective if TCPKeepAlive is set.
	// Default: 0 (system default)
	TCPKeepInterval time.Duration

	// TCPNoDelay sets the TCP_NODELAY socket option. When true, disables Nagle's
	// algorithm, sending data immediately rather than buffering it. This reduces
	// latency but may increase network overhead.
	// Default: gnet.TCPSocketOpt(1) (enabled)
	TCPNoDelay gnet.TCPSocketOpt

	// SocketRecvBuffer sets the size of the socket receive buffer in bytes.
	// Larger buffers can handle bursts of data but use more memory.
	// Default: 0 (system default)
	SocketRecvBuffer int

	// SocketSendBuffer sets the size of the socket send buffer in bytes.
	// Larger buffers can handle bursty sends but use more memory.
	// Default: 0 (system default)
	SocketSendBuffer int

	// EdgeTriggeredIO enables edge-triggered I/O mode when available.
	// This can reduce the number of system calls but requires careful handling.
	// Default: false
	EdgeTriggeredIO bool
}

Options defines the configuration options for the RedHub server. These options control various aspects of server behavior including threading, buffer sizes, network settings, and performance tuning.

Most options have sensible defaults and only need to be changed for specific use cases.

type RedHub

type RedHub struct {
	// contains filtered or unexported fields
}

RedHub represents the main server structure that manages connections and command processing. It implements the gnet.EventHandler interface and is typically created using NewRedHub.

RedHub maintains a map of connections to their associated buffers, allowing each connection to accumulate data across multiple reads until complete commands are parsed.

func NewRedHub

func NewRedHub(
	onOpened func(c *Conn) (out []byte, action Action),
	onClosed func(c *Conn, err error) (action Action),
	handler func(cmd resp.Command, out []byte) ([]byte, Action),
) *RedHub

NewRedHub creates a new RedHub instance with the specified event handlers.

The handlers allow application code to respond to connection lifecycle events and process incoming commands.

Parameters:

  • onOpened: Called when a new connection is established. The connection object is provided, allowing initialization of connection-specific data. Returns any initial response data and an action (typically None).
  • onClosed: Called when a connection is closed. The connection object and any error that caused the close are provided. Returns an action.
  • handler: Called for each parsed command from the connection. The command contains the raw RESP bytes and parsed arguments. The response buffer is provided for building the response. Returns the response data and an action (None, Close, or Shutdown).

The returned RedHub instance can then be passed to ListenAndServe to start the server.

func (*RedHub) OnBoot added in v0.2.0

func (rs *RedHub) OnBoot(eng gnet.Engine) (action gnet.Action)

OnBoot is called by gnet when the server is ready to accept connections. This is part of the gnet.EventHandler interface.

The engine parameter provides access to server-wide operations. Typically returns gnet.None to indicate normal startup.

func (*RedHub) OnClose added in v0.2.0

func (rs *RedHub) OnClose(c gnet.Conn, err error) (action gnet.Action)

OnClose is called by gnet when a connection is closed. This is part of the gnet.EventHandler interface.

The connection's buffer is removed from the map to free memory, and then the application's onClosed handler is called.

func (*RedHub) OnOpen added in v0.2.0

func (rs *RedHub) OnOpen(c gnet.Conn) (out []byte, action gnet.Action)

OnOpen is called by gnet when a new connection is opened. This is part of the gnet.EventHandler interface.

A new buffer is created for the connection to accumulate incoming data, and then the application's onOpened handler is called.

func (*RedHub) OnShutdown added in v0.2.0

func (rs *RedHub) OnShutdown(eng gnet.Engine)

OnShutdown is called by gnet when the server is shutting down. This is part of the gnet.EventHandler interface.

The engine parameter provides access to server-wide operations during shutdown. This can be used to perform cleanup tasks or notify application code.

func (*RedHub) OnTick added in v0.2.0

func (rs *RedHub) OnTick() (delay time.Duration, action gnet.Action)

OnTick is called by gnet on a periodic timer when Ticker is enabled. This is part of the gnet.EventHandler interface.

Returns the delay until the next tick and an action. Typically returns (0, gnet.None) to disable further ticks.

func (*RedHub) OnTraffic added in v0.2.0

func (rs *RedHub) OnTraffic(c gnet.Conn) (action gnet.Action)

OnTraffic is called by gnet when data is received from a connection. This is part of the gnet.EventHandler interface and is the core of the request processing pipeline.

The function: 1. Reads all available data from the connection 2. Appends it to the connection's buffer 3. Parses complete commands from the buffer 4. Processes each command through the handler 5. Sends responses back to the client 6. Handles incomplete commands by keeping remaining data in the buffer

Directories

Path Synopsis
example
memory_kv command
pkg
resp
Package resp implements the Redis Serialization Protocol (RESP) as defined in the Redis protocol specification (https://redis.io/docs/reference/protocol-spec/).
Package resp implements the Redis Serialization Protocol (RESP) as defined in the Redis protocol specification (https://redis.io/docs/reference/protocol-spec/).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL