server

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FREE_LIST_SIZE = 4 * 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	Service() string // Service Interface
	Version() string
}

type Option

type Option func(*Options)

func Codec

func Codec(codecs map[string]codec.NewCodec) Option

Codec to use to encode/decode requests for a given content type

func ConfList added in v0.2.0

func ConfList(confList []registry.ServerConfig) Option

func Registry

func Registry(r registry.Registry) Option

Registry used for discovery

func ServiceConfList

func ServiceConfList(confList []registry.ServiceConfig) Option

func Transport

func Transport(t transport.Transport) Option

Transport mechanism for communication e.g http, rabbitmq, etc

type Options

type Options struct {
	Codecs    map[string]codec.NewCodec
	Registry  registry.Registry
	Transport transport.Transport

	ConfList        []registry.ServerConfig
	ServiceConfList []registry.ServiceConfig
	// Other options for implementations of the interface
	// can be stored in a context
	Context context.Context
}

type Request

type Request interface {
	Service() string
	Method() string
	ContentType() string
	Request() interface{}
	// indicates whether the request will be streamed
	Stream() bool
}

type Server

type Server interface {
	Options() Options
	Handle(Handler) error
	Start() error
	Stop()
	String() string
}

Provider

func NewServer

func NewServer(opts ...Option) Server

type Streamer

type Streamer interface {
	Context() context.Context
	Request() Request
	Send(interface{}) error
	Recv(interface{}) error
	Error() error
	Close() error
}

Streamer represents a stream established with a client. A stream can be bidirectional which is indicated by the request. The last error will be left in Error(). EOF indicated end of the stream.

Jump to

Keyboard shortcuts

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