router

package
v0.0.0-...-39c9722 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2015 License: MIT Imports: 24 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

This section is empty.

Types

type BackendConn

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

func NewBackendConn

func NewBackendConn(addr, passwd 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 Config

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

func LoadConf

func LoadConf(configFile string) (*Config, error)

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 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 Server

type Server struct {
	net.Listener
	OnSuicide func() error
	// contains filtered or unexported fields
}

func NewServer

func NewServer(addr string, debugVarAddr string, conf *Config) (*Server, error)

func (*Server) Dispatch

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

func (*Server) OnGroupChange

func (s *Server) OnGroupChange(groupId int)

func (*Server) OnSlotRangeChange

func (s *Server) OnSlotRangeChange(param *models.SlotMultiSetParam)

func (*Server) RegisterAndWait

func (s *Server) RegisterAndWait()

func (*Server) Serve

func (s *Server) Serve() 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, passwd string) *Session

func NewSessionSize

func NewSessionSize(c net.Conn, passwd 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, passwd string) *SharedBackendConn

func (*SharedBackendConn) Close

func (s *SharedBackendConn) Close() bool

func (*SharedBackendConn) IncrRefcnt

func (s *SharedBackendConn) IncrRefcnt()

type Slot

type Slot struct {
	Id    int
	Info  *models.Slot
	Group *models.ServerGroup
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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