activeobject

package
v0.1.8-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2019 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveObject

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

ActiveObject provides an API for implements Active Object Pattern

func NewActiveObject

func NewActiveObject() *ActiveObject

NewActiveObject creates an instance of ActiveObject

func (*ActiveObject) Call

func (a *ActiveObject) Call(fName string, args ...interface{}) chan interface{}

Call schedules a function call. It panics if no function has been registered under the fName. It returns a channel which will be sent the result of the call.

func (*ActiveObject) RegisterFunc

func (a *ActiveObject) RegisterFunc(fName string, f SchedulerFunc)

RegisterFunc registers a function to execute against a call request that matches fName.

func (*ActiveObject) Start

func (a *ActiveObject) Start()

Start the active object engine. It will start the scheduler on a goroutine and return.

type CallRequest

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

CallRequest represents a request for a function call.

type Scheduler

type Scheduler struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

Scheduler manages method calls and execute already scheduled calls in a FIFO order.

func NewScheduler

func NewScheduler() *Scheduler

NewScheduler creates an instance of Scheduler

type SchedulerFunc

type SchedulerFunc func(args ...interface{}) interface{}

SchedulerFunc describes the signature of a scheduled method

Jump to

Keyboard shortcuts

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