SMOLNET PORTAL home about changes

package resp - github.com/mediocregopher/radix/v4/resp - godocs.io


import "github.com/mediocregopher/radix/v4/resp"


Package resp is an umbrella package which covers both the old RESP protocol (resp2) and the new one (resp3), allowing clients to choose which one they care to use

Functions


func ErrConnUnusable

func ErrConnUnusable(err error) error

ErrConnUnusable takes an existing error and, if it is wrapped in an ErrConnUsable, unwraps the ErrConnUsable from around it.

Types


type ErrConnUsable

type ErrConnUsable struct {
	Err error
}

ErrConnUsable is used to wrap an error encountered while marshaling or unmarshaling a message on a connection. It indicates that the network connection is still healthy and that there are no partially written/read messages on the stream.

func (ErrConnUsable) Error

func (ed ErrConnUsable) Error() string


func (ErrConnUsable) Unwrap

func (ed ErrConnUsable) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type LenReader

type LenReader interface {
	io.Reader
	Len() int
}

LenReader adds an additional method to io.Reader, returning how many bytes are left till be read until an io.EOF is reached.

func NewLenReader

func NewLenReader(r io.Reader, l int) LenReader

NewLenReader wraps an existing io.Reader whose length is known so that it implements LenReader

type Marshaler

type Marshaler interface {
	MarshalRESP(io.Writer) error
}

Marshaler is the interface implemented by types that can marshal themselves into valid RESP.

NOTE It's important to keep track of whether a partial RESP message has been written to the Writer, and to use ErrConnUnusable when returning errors if a partial RESP message has not been written.

type Unmarshaler

type Unmarshaler interface {
	UnmarshalRESP(*bufio.Reader) error
}

Unmarshaler is the interface implemented by types that can unmarshal a RESP description of themselves. UnmarshalRESP should _always_ fully consume a RESP message off the reader, unless there is an error returned from the reader itself. Use ErrConnUsable when applicable.

Directories


resp/resp2

Package resp2 implements the original redis RESP protocol, a plaintext protocol which is also binary safe.

resp/resp3

Package resp3 implements the upgraded redis RESP3 protocol, a plaintext protocol which is also binary safe and backwards compatible with the original RESP2 protocol.

Details

Version: v4.0.0-beta.0
  • Published: Oct 4, 2020
Platform: linux/amd64
Imports: 3 packages
  • Last checked: 3 minutes ago
Refresh now


Back to home
Search
Response: 20 (Success), text/gemini
Original URLgemini://godocs.io/github.com/mediocregopher/radix/v4/res...
Status Code20 (Success)
Content-Typetext/gemini; charset=utf-8