radish

package module
v0.0.0-...-a3ce958 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2021 License: MIT Imports: 9 Imported by: 0

README

radish

A super barebones Redis clone in Go that implements the following commands:

  • PING
  • ECHO
  • GET
  • SET (with expiry in both seconds and milliseconds)

Inspired by Build Your Own Redis. I followed this guide in what order to build things in and what to use as the test cases. As it stops with the ECHO command, SET, GET and expiry were added based on the knowledge I acquired from the Redis documentation.

The goal of writing this project was to:

  • practice writing Go,
  • play around with things I've learned, but don't have that good hands-on experience with (TCP),
  • try and practice TDD style development.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIncompleteRESP = fmt.Errorf("incomplete resp string")

ErrIncompleteRESP is returned when the encoded string fed to Decode is not valid

Functions

func Decode

func Decode(encoded string) ([]string, error)

Decode returns the decoded body as either string or a slice of strings

Types

type Server

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

Server encapsulates a TCP server that can serve RESP commands

func NewServer

func NewServer(port int, keyValueStorage map[string]string) (*Server, error)

NewServer is used as the constructor to assemble new servers

func (*Server) Close

func (r *Server) Close()

Close stops the listener from accepting any more incoming connections

func (*Server) Listen

func (r *Server) Listen()

Listen makes the server start listening for incoming connections on the port specified in the constructor

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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