router

package
v0.0.0-...-1e303e7 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2015 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const MaxSlotNum = models.DEFAULT_SLOT_NUM

Variables

View Source
var (
	ErrBadRespType = errors.New("bad resp type for command")
	ErrBadOpStrLen = errors.New("bad command length, too short or too long")
)
View Source
var ErrFailedRequest = errors.New("discard failed request")
View Source
var ErrRespIsRequired = errors.New("resp is required")
View Source
var ErrSlotIsNotReady = errors.New("slot is not ready, may be offline")

Functions

func OpCounts

func OpCounts() int64

Types

type BackendConn

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

func NewBackendConn

func NewBackendConn(addr, auth string) *BackendConn

func (*BackendConn) Addr

func (bc *BackendConn) Addr() string

func (*BackendConn) Close

func (bc *BackendConn) Close()

func (*BackendConn) KeepAlive

func (bc *BackendConn) KeepAlive() bool

func (*BackendConn) PushBack

func (bc *BackendConn) PushBack(r *Request)

func (*BackendConn) Run

func (bc *BackendConn) Run()

type Dispatcher

type Dispatcher interface {
	Dispatch(r *Request) error
}

type FlushPolicy

type FlushPolicy struct {
	*redis.Encoder

	MaxBuffered int
	MaxInterval int64
	// contains filtered or unexported fields
}

func (*FlushPolicy) Encode

func (p *FlushPolicy) Encode(resp *redis.Resp, force bool) error

func (*FlushPolicy) Flush

func (p *FlushPolicy) Flush(force bool) error

type OpStats

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

func GetAllOpStats

func GetAllOpStats() []*OpStats

func GetOpStats

func GetOpStats(opstr string, create bool) *OpStats

func (*OpStats) Calls

func (s *OpStats) Calls() int64

func (*OpStats) MarshalJSON

func (s *OpStats) MarshalJSON() ([]byte, error)

func (*OpStats) OpStr

func (s *OpStats) OpStr() string

func (*OpStats) USecs

func (s *OpStats) USecs() int64

type Request

type Request struct {
	OpStr string
	Start int64

	Resp *redis.Resp

	Coalesce func() error
	Response struct {
		Resp *redis.Resp
		Err  error
	}

	Wait *sync.WaitGroup

	Failed *atomic2.Bool
	// contains filtered or unexported fields
}

type Router

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

func New

func New() *Router

func NewWithAuth

func NewWithAuth(auth string) *Router

func (*Router) Close

func (s *Router) Close() error

func (*Router) Dispatch

func (s *Router) Dispatch(r *Request) error

func (*Router) FillSlot

func (s *Router) FillSlot(i int, addr, from string, lock bool) error

func (*Router) KeepAlive

func (s *Router) KeepAlive() error

func (*Router) ResetSlot

func (s *Router) ResetSlot(i int) error

type Session

type Session struct {
	*redis.Conn

	Ops int64

	LastOpUnix int64
	CreateUnix int64
	// contains filtered or unexported fields
}

func NewSession

func NewSession(c net.Conn, auth string) *Session

func NewSessionSize

func NewSessionSize(c net.Conn, auth string, bufsize int, timeout int) *Session

func (*Session) Close

func (s *Session) Close() error

func (*Session) IsClosed

func (s *Session) IsClosed() bool

func (*Session) Serve

func (s *Session) Serve(d Dispatcher, maxPipeline int)

func (*Session) String

func (s *Session) String() string

type SharedBackendConn

type SharedBackendConn struct {
	*BackendConn
	// contains filtered or unexported fields
}

func NewSharedBackendConn

func NewSharedBackendConn(addr, auth string) *SharedBackendConn

func (*SharedBackendConn) Close

func (s *SharedBackendConn) Close() bool

func (*SharedBackendConn) IncrRefcnt

func (s *SharedBackendConn) IncrRefcnt()

type Slot

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

Jump to

Keyboard shortcuts

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