Documentation ¶
Index ¶
- type Application
- func (s *Application) AddLabelToShard(group, shardID uint64, name, value string, timeout time.Duration) error
- func (s *Application) AsyncExec(cmd CustomRequest, cb func(CustomRequest, []byte, error), ...)
- func (s *Application) Exec(cmd CustomRequest, timeout time.Duration) ([]byte, error)
- func (s *Application) Retry(requestID []byte) (rpc.Request, bool)
- func (s *Application) ShardProxy() raftstore.ShardsProxy
- func (s *Application) Start() error
- func (s *Application) Stop()
- type Cfg
- type CustomRequest
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
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
Click to show internal directories.
Click to hide internal directories.