Documentation
¶
Index ¶
- type Application
- func (s *Application) AsyncBroadcast(cmd interface{}, group uint64, cb func(interface{}, [][]byte, error), ...)
- func (s *Application) AsyncExec(cmd interface{}, cb func(interface{}, []byte, error), arg interface{})
- func (s *Application) AsyncExecWithGroupAndTimeout(cmd interface{}, group uint64, cb func(interface{}, []byte, error), ...)
- func (s *Application) AsyncExecWithTimeout(cmd interface{}, cb func(interface{}, []byte, error), timeout time.Duration, ...)
- func (s *Application) Exec(cmd interface{}, timeout time.Duration) ([]byte, error)
- func (s *Application) ExecWithGroup(cmd interface{}, group uint64, timeout time.Duration) ([]byte, error)
- func (s *Application) ShardProxy() raftstore.ShardsProxy
- func (s *Application) Start() error
- func (s *Application) Stop()
- type Cfg
- type Handler
- type TestApplicationCluster
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 *raftcmdpb.Request, cmd interface{}, proxy raftstore.ShardsProxy) error) *Application
NewApplication returns a tcp application server
func (*Application) AsyncBroadcast ¶
func (s *Application) AsyncBroadcast(cmd interface{}, group uint64, cb func(interface{}, [][]byte, error), timeout time.Duration, arg interface{}, mustLeader bool)
AsyncBroadcast broadcast to all current shards, and aggregate responses
func (*Application) AsyncExec ¶
func (s *Application) AsyncExec(cmd interface{}, cb func(interface{}, []byte, error), arg interface{})
AsyncExec async exec the request command
func (*Application) AsyncExecWithGroupAndTimeout ¶
func (s *Application) AsyncExecWithGroupAndTimeout(cmd interface{}, group uint64, cb func(interface{}, []byte, error), timeout time.Duration, arg interface{})
AsyncExecWithGroupAndTimeout async exec the request, if the err is ErrTimeout means the request is timeout
func (*Application) AsyncExecWithTimeout ¶
func (s *Application) AsyncExecWithTimeout(cmd interface{}, cb func(interface{}, []byte, error), timeout time.Duration, arg interface{})
AsyncExecWithTimeout async exec the request, if the err is ErrTimeout means the request is timeout
func (*Application) Exec ¶
func (s *Application) Exec(cmd interface{}, timeout time.Duration) ([]byte, error)
Exec exec the request command
func (*Application) ExecWithGroup ¶
func (s *Application) ExecWithGroup(cmd interface{}, group uint64, timeout time.Duration) ([]byte, error)
ExecWithGroup exec the request command
func (*Application) ShardProxy ¶
func (s *Application) ShardProxy() raftstore.ShardsProxy
ShardProxy returns the shard proxy
type Handler ¶
type Handler interface { // BuildRequest build the request, fill the key, cmd, type, // and the custom type BuildRequest(*raftcmdpb.Request, interface{}) error // Codec returns the decoder and encoder to transfer request and response Codec() (codec.Encoder, codec.Decoder) // AddReadFunc add read handler func AddReadFunc(cmdType uint64, cb command.ReadCommandFunc) // AddWriteFunc add write handler func AddWriteFunc(cmdType uint64, cb command.WriteCommandFunc) }
Handler is the request handler
type TestApplicationCluster ¶
type TestApplicationCluster struct { RaftCluster raftstore.TestRaftCluster Applications []*Application // contains filtered or unexported fields }
TestApplicationCluster test application cluster, it based on raftstore.TestClusterStore.
func NewTestApplicationCluster ¶
func NewTestApplicationCluster(t *testing.T, applicationFactory func(i int, store raftstore.Store) *Application, opts ...raftstore.TestClusterOption) *TestApplicationCluster
NewTestApplicationCluster returns TestApplicationCluster
func (*TestApplicationCluster) Start ¶
func (c *TestApplicationCluster) Start()
Start start the application cluster
func (*TestApplicationCluster) Stop ¶
func (c *TestApplicationCluster) Stop()
Stop stop the application cluster