Documentation ¶
Overview ¶
Package server is an interface for a micro server
Index ¶
- Variables
- func NewContext(ctx context.Context, s Server) context.Context
- type Message
- type Option
- func Address(a string) Option
- func Advertise(a string) Option
- func Id(id string) Option
- func Metadata(md map[string]string) Option
- func Name(n string) Option
- func RegisterInterval(t time.Duration) Option
- func RegisterTTL(t time.Duration) Option
- func Registry(r registry.Registry) Option
- func Version(v string) Option
- func Wait(b bool) Option
- type Options
- type Request
- type Server
- type Stream
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultAddress = ":0" DefaultName = "go-server" DefaultVersion = "1.0.0" DefaultId = uuid.NewUUID().String() )
Functions ¶
Types ¶
type Option ¶
type Option func(*Options)
func RegisterInterval ¶
RegisterInterval specifies the interval on which to re-register
type Options ¶
type Options struct { Registry registry.Registry Metadata map[string]string Name string Address string Advertise string Id string Version string RegisterInterval time.Duration RegisterTTL time.Duration // Other options for implementations of the interface // can be stored in a context Context context.Context }
type Server ¶
type Server interface { Options() Options OnInit(module module.Module, app module.App, settings *conf.ModuleSettings) error Init(...Option) error SetListener(listener mqrpc.RPCListener) Register(id string, f interface{}) RegisterGO(id string, f interface{}) ServiceRegister() error ServiceDeregister() error Start() error Stop() error OnDestroy() error String() string Id() string }
type Stream ¶
type Stream interface { Context() context.Context Request() Request Send(interface{}) error Recv(interface{}) error Error() error Close() error }
Stream 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.
Click to show internal directories.
Click to hide internal directories.