Documentation ¶
Overview ¶
Example:
var group = rpcgroup.New(5000, "app1:5000", "app2:5000") func init() { id := "0001" group.Call(InitializeFunction, id) } var InitializeFunction = rpcgroup.Register(func(id string) { StartLogger(id) })
Index ¶
- func Call(name string, params ...interface{}) []interface{}
- func GetFunctionNameOrString(f interface{}) string
- func GobRegister(d interface{})
- func Hostname() string
- func Listen(listenPort int)
- func Register(f interface{}) string
- func RegisterAs(name string, f interface{})
- type CallArgs
- type Client
- type Dummy
- type FunctionCallRequest
- type Group
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Call ¶
func Call(name string, params ...interface{}) []interface{}
Call a function named as "name" with argments params... Before calling this function, you need to first call Register.
func GetFunctionNameOrString ¶
func GetFunctionNameOrString(f interface{}) string
func GobRegister ¶
func GobRegister(d interface{})
GobRegister registers your struct If error "panic: gob: type not registered for interface: YOUR STRUCT" happens. (Example: cluster.GobRegister(MyStruct{}))
func Register ¶
func Register(f interface{}) string
Register registers a function to call over network. Every function that is called by RPC must be registered before its call. Return value: registered function name
func RegisterAs ¶
func RegisterAs(name string, f interface{})
Register registers a function using a name
Types ¶
type Client ¶
type FunctionCallRequest ¶
type Group ¶
func GroupWithoutListen ¶
GroupWithoutListen is a constructor of Group that does not listen any port. It groups together all the hosts.
Click to show internal directories.
Click to hide internal directories.