Documentation ¶
Index ¶
- Variables
- type VirtualMachine
- func (vm *VirtualMachine) Close(name string) error
- func (vm *VirtualMachine) IsRunning() bool
- func (vm *VirtualMachine) Loop()
- func (vm *VirtualMachine) NumPendingAsycnJobs() int32
- func (vm *VirtualMachine) NumWorkers() int
- func (vm *VirtualMachine) Open(name string) (*VirtualMachine, error)
- func (vm *VirtualMachine) SendWork(jobData interface{}) (interface{}, error)
- func (vm *VirtualMachine) SendWorkAsync(jobData interface{}, callback func(interface{}, error))
- func (vm *VirtualMachine) SendWorkClean(jobData interface{}) (interface{}, error)
- func (vm *VirtualMachine) SendWorkCleanAsync(jobData interface{}) error
- func (vm *VirtualMachine) SendWorkTimed(timeout time.Duration, jobData interface{}) (interface{}, error)
- func (vm *VirtualMachine) SendWorkTimedAsync(timeout time.Duration, jobData interface{}, callback func(interface{}, error))
- type VmDefaultWorker
- type VmExtendedWorker
- type VmInterruptableWorker
- type VmWorker
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrVMAlreadyRunning = errors.New("vm have been running ...") ErrVMNotRunning = errors.New("vm not running") ErrJobNotFunc = errors.New("job not function") ErrWorkerClosed = errors.New("worker closed") ErrWorkerTimeout = errors.New("worker timeout") )
start vm(lua and js service according to configure) manage the all worker instance
Functions ¶
This section is empty.
Types ¶
type VirtualMachine ¶
type VirtualMachine struct {
// contains filtered or unexported fields
}
func CreateCustomVM ¶
func CreateCustomVM(workers []VmWorker) *VirtualMachine
func CreateGenericVM ¶
func CreateGenericVM(numWorkers int, fn func(interface{}) interface{}) *VirtualMachine
func CreateVM ¶
func CreateVM(numWorkers int, job func(interface{}) interface{}) *VirtualMachine
func (*VirtualMachine) Close ¶
func (vm *VirtualMachine) Close(name string) error
func (*VirtualMachine) IsRunning ¶
func (vm *VirtualMachine) IsRunning() bool
func (*VirtualMachine) Loop ¶
func (vm *VirtualMachine) Loop()
func (*VirtualMachine) NumPendingAsycnJobs ¶
func (vm *VirtualMachine) NumPendingAsycnJobs() int32
func (*VirtualMachine) NumWorkers ¶
func (vm *VirtualMachine) NumWorkers() int
func (*VirtualMachine) Open ¶
func (vm *VirtualMachine) Open(name string) (*VirtualMachine, error)
func (*VirtualMachine) SendWork ¶
func (vm *VirtualMachine) SendWork(jobData interface{}) (interface{}, error)
func (*VirtualMachine) SendWorkAsync ¶
func (vm *VirtualMachine) SendWorkAsync(jobData interface{}, callback func(interface{}, error))
func (*VirtualMachine) SendWorkClean ¶
func (vm *VirtualMachine) SendWorkClean(jobData interface{}) (interface{}, error)
func (*VirtualMachine) SendWorkCleanAsync ¶
func (vm *VirtualMachine) SendWorkCleanAsync(jobData interface{}) error
func (*VirtualMachine) SendWorkTimed ¶
func (vm *VirtualMachine) SendWorkTimed(timeout time.Duration, jobData interface{}) (interface{}, error)
func (*VirtualMachine) SendWorkTimedAsync ¶
func (vm *VirtualMachine) SendWorkTimedAsync(timeout time.Duration, jobData interface{}, callback func(interface{}, error))
type VmDefaultWorker ¶
type VmDefaultWorker struct {
// contains filtered or unexported fields
}
the vm DefaultWorker
func (*VmDefaultWorker) VmJob ¶
func (worker *VmDefaultWorker) VmJob(data interface{}) (interface{}, error)
func (*VmDefaultWorker) VmReady ¶
func (worker *VmDefaultWorker) VmReady() bool
type VmExtendedWorker ¶
type VmExtendedWorker interface { // when the mechine is opened and closed, the will be implemented. VmInitialize() VmTerminate() }
type VmInterruptableWorker ¶
type VmInterruptableWorker interface {
//called by the client that will be killed this worker
VmInterruptable()
}
Click to show internal directories.
Click to hide internal directories.