ogdlrf

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2021 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(host string, handler Function, timeout int) error

Serve starts a remote function server. Incomming requests should be handled by the given Function. This version of Serve doesn't work with AddRoute.

func Serve1

func Serve1(host string, handler Function, timeout int) error

Serve1 starts a remote function server. Incomming requests should be handled by the given Function. This version of Serve doesn't work with AddRoute.

Types

type Client

type Client struct {
	Host string

	Timeout  int
	Protocol int
	// contains filtered or unexported fields
}

Client represents a the client side of a remote function (also known as a remote procedure call).

func (*Client) Call

func (rf *Client) Call(g *ogdl.Graph) (*ogdl.Graph, error)

Call makes a request and returns the response. It dials the host if not connected.

func (*Client) Close

func (rf *Client) Close()

Close closes the underlying connection, if open.

func (*Client) Dial

func (rf *Client) Dial() error

Dial opens the TCP connection

type Function

type Function func(net.Conn, *ogdl.Graph) *ogdl.Graph

Function is the prototype of functions to be server by ogdlrf.Serve

type Server

type Server struct {
	Host    string
	Timeout int

	Protocol int
	// contains filtered or unexported fields
}

Server hold the state of the server side of a remote function.

func (*Server) AddRoute

func (srv *Server) AddRoute(path string, f Function)

AddRoute associates a handler function with the given path. A path in this context is the first child of the incomming request.

func (*Server) Serve

func (srv *Server) Serve() error

Serve starts a remote function server. Handler functions should be set up with AddRoute.

Jump to

Keyboard shortcuts

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