Documentation ¶
Overview ¶
Package rpc allows higher level components to register methods that can be called by other network hosts.
Usage:
r := rpc.NewRPC() r.RegisterMethod("hello_world", func(sender *host.Host, args [][]byte) ([]byte, error) { fmt.Println("Hello World") return nil, nil }) r.Invoke(&host.Host{}, "hello_world", [][]byte{})
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Factory ¶
type Factory interface {
Create() RPC
}
Factory allows to create new RPC.
func NewRPCFactory ¶
func NewRPCFactory(methods map[string]RemoteProcedure) Factory
NewRPCFactory creates new RPC Factory.
type RPC ¶
type RPC interface { // Invoke is used to actually call remote procedure. Invoke(sender *host.Host, method string, args [][]byte) ([]byte, error) // RegisterMethod allows to register new function in RPC module. RegisterMethod(name string, method RemoteProcedure) }
RPC is remote procedure call module.
Click to show internal directories.
Click to hide internal directories.