import "github.com/cmcoffee/go-ezipc"
Package ezipc provides a simple framework to allow for communication between multiple background processes.
EzIPC has similar requirements for exporting functions that Go's native "rpc" package provides, however ezipc maps both functions and object methods.
1)the method or function requires two arguments, both exported (or builtin) types.
2)the method or function's second argument is a pointer.
3)the method or function has a return type of error.
Registered methods or functions should look like:
func (*T) Name(argType T1, replyType *T2) error
and respectively ...
func name(argType T1, replyType *T2) error
Exported functions & methods should be made thread safe.
var ErrClosed = errors.New("Connection closed.")
var ErrFail = errors.New("Call failed.")
type EzIPC struct {
// contains filtered or unexported fields
}
EzIPC is common to both IPC clients and servers.
func New() *EzIPC
Creates a new ezipc router.
func (e *EzIPC) Call(name string, arg interface{}, reply interface{}) (err error)
Call invokes a registered method/function, blocks while actively checking for for completion, returns err on failure.
func (e *EzIPC) Dial(socketf string) error
Dial is the client function of EzIPC, it opens a connection to the socket file.
func (e *EzIPC) Listen(socketf string) (err error)
Listens is the server function of EzIPC, it opens a connection and blocks while listening for requests.
func (e *EzIPC) Register(fptr interface{}) error
Registers local methods or function, informs Broker of registration. Function/method template should follow: func name(argType T1, replyType *T2) error func (*T) Name(argType T1, replyType *T2) error
func (e *EzIPC) RegisterName(name string, fptr interface{}) (err error)
RegisterName operates exactly as Register but allows changing the name of the object or function.
Generated by godoc2md