server

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

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

Application a tcp application server

func NewApplication

func NewApplication(cfg Cfg) *Application

NewApplication returns a tcp application server

func NewApplicationWithDispatcher

func NewApplicationWithDispatcher(cfg Cfg, dispatcher func(req rpc.Request, cmd CustomRequest, proxy raftstore.ShardsProxy) error) *Application

NewApplication returns a tcp application server

func (*Application) AddLabelToShard added in v0.2.0

func (s *Application) AddLabelToShard(group, shardID uint64, name, value string, timeout time.Duration) error

AddLabelToShard add label to shard

func (*Application) AsyncExec

func (s *Application) AsyncExec(cmd CustomRequest, cb func(CustomRequest, []byte, error), timeout time.Duration)

AsyncExec async exec the request, if the err is ErrTimeout means the request is timeout

func (*Application) Exec

func (s *Application) Exec(cmd CustomRequest, timeout time.Duration) ([]byte, error)

ExecWithGroup exec the request command

func (*Application) Retry added in v0.2.0

func (s *Application) Retry(requestID []byte) (rpc.Request, bool)

func (*Application) ShardProxy

func (s *Application) ShardProxy() raftstore.ShardsProxy

ShardProxy returns the shard proxy

func (*Application) Start

func (s *Application) Start() error

Start start the application server

func (*Application) Stop

func (s *Application) Stop()

Stop stop redis server

type Cfg

type Cfg struct {
	Store raftstore.Store
	// contains filtered or unexported fields
}

Cfg cfg

type CustomRequest added in v0.2.0

type CustomRequest struct {
	// Group used to indicate which group of Shards to send
	Group uint64
	// Key the key used to indicate which shard to send
	Key []byte
	// ToShard if the field is specified, Key are disabled
	ToShard uint64
	// CustomType type of custom request
	CustomType uint64
	// Cmd serialized custom request content
	Cmd []byte
	// Read read request
	Read bool
	// Write write request
	Write bool
	// Amdin admin request
	Admin bool
	// Args custom args for async execute callback
	Args interface{}
}

CustomRequest customized request with request type and request content

Jump to

Keyboard shortcuts

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