Documentation
¶
Index ¶
- type BasePoolManager
- type BasePoolWorker
- func (t BasePoolWorker) GetId() uint32
- func (t BasePoolWorker) GetName() string
- func (this *BasePoolWorker) Init() error
- func (this *BasePoolWorker) Run() error
- func (this *BasePoolWorker) SendToWorkChain(msg interface{})
- func (this *BasePoolWorker) SetWorkChain(ch chan interface{}) bool
- func (this *BasePoolWorker) SetWorkPool(pl IPoolManager)
- type IPool
- type IPoolBase
- type IPoolManager
- type IPoolWorker
- type Pool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasePoolManager ¶
type BasePoolManager struct { run.BaseWorker WorkPool IPool SelfPoolChain chan interface{} }
*
管理池基本类 要实现池,只需要继承该结构,并实现自定义的创建方法
func (BasePoolManager) GetId ¶
func (t BasePoolManager) GetId() uint32
*************for IPoolManager******************
func (BasePoolManager) GetName ¶
func (t BasePoolManager) GetName() string
func (*BasePoolManager) Init ¶
func (t *BasePoolManager) Init() error
func (*BasePoolManager) Run ¶
func (t *BasePoolManager) Run() error
type BasePoolWorker ¶
type BasePoolWorker struct { run.BaseWorker WorkChain chan interface{} WorkPool IPoolManager }
*
基本的工作线程类 需要自己定义run方法
func (BasePoolWorker) GetId ¶
func (t BasePoolWorker) GetId() uint32
*********** for IPoolWorker**********************
func (BasePoolWorker) GetName ¶
func (t BasePoolWorker) GetName() string
func (*BasePoolWorker) Init ¶
func (this *BasePoolWorker) Init() error
func (*BasePoolWorker) Run ¶
func (this *BasePoolWorker) Run() error
func (*BasePoolWorker) SendToWorkChain ¶
func (this *BasePoolWorker) SendToWorkChain(msg interface{})
func (*BasePoolWorker) SetWorkChain ¶
func (this *BasePoolWorker) SetWorkChain(ch chan interface{}) bool
func (*BasePoolWorker) SetWorkPool ¶
func (this *BasePoolWorker) SetWorkPool(pl IPoolManager)
type IPool ¶
type IPool interface { Take() (IPoolWorker, error) Return(entity IPoolWorker) error GetTotal() uint32 GetUsed() uint32 }
type IPoolManager ¶
type IPoolManager interface { IPoolBase }
type IPoolWorker ¶
type IPoolWorker interface { IPoolBase SetWorkChain(ch chan interface{}) bool SetWorkPool(pl IPoolManager) SendToWorkChain(msg interface{}) }
type Pool ¶
type Pool struct { Total uint32 Etype reflect.Type GenEntity func() IPoolWorker IdContainer map[uint32]bool // contains filtered or unexported fields }
func (*Pool) Return ¶
func (this *Pool) Return(entity IPoolWorker) error
func (*Pool) Take ¶
func (this *Pool) Take() (IPoolWorker, error)
Click to show internal directories.
Click to hide internal directories.