server

package
v0.0.0-...-2c19b2c Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2015 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultAddress        = ":0"
	DefaultName           = "go-server"
	DefaultVersion        = "1.0.0"
	DefaultId             = uuid.NewUUID().String()
	DefaultServer  Server = newRpcServer()
)

Functions

func Config

func Config() options

func Deregister

func Deregister() error

func Handle

func Handle(h Handler) error

func Init

func Init(opt ...Option)

func Register

func Register() error

func Run

func Run() error

func Start

func Start() error

func Stop

func Stop() error

func Subscribe

func Subscribe(s Subscriber) error

Types

type Debug

type Debug struct{}

func (*Debug) Health

func (d *Debug) Health(ctx context.Context, req *health.Request, rsp *health.Response) error

type Handler

type Handler interface {
	Name() string
	Handler() interface{}
	Endpoints() []*registry.Endpoint
}

func NewHandler

func NewHandler(h interface{}) Handler

type Option

type Option func(*options)

func Address

func Address(a string) Option

func Broker

func Broker(b broker.Broker) Option

func Id

func Id(id string) Option

func Metadata

func Metadata(md map[string]string) Option

func Name

func Name(n string) Option

func Registry

func Registry(r registry.Registry) Option

func Transport

func Transport(t transport.Transport) Option

func Version

func Version(v string) Option

type Server

type Server interface {
	Config() options
	Init(...Option)
	Handle(Handler) error
	NewHandler(interface{}) Handler
	NewSubscriber(string, interface{}) Subscriber
	Subscribe(Subscriber) error
	Register() error
	Deregister() error
	Start() error
	Stop() error
}

func NewServer

func NewServer(opt ...Option) Server

type Subscriber

type Subscriber interface {
	Topic() string
	Subscriber() interface{}
	Endpoints() []*registry.Endpoint
}

func NewSubscriber

func NewSubscriber(topic string, h interface{}) Subscriber

Directories

Path Synopsis
proto
health
Package health is a generated protocol buffer package.
Package health is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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