Documentation ¶
Overview ¶
Package server is an interface for a micro server
Index ¶
- Variables
- type Option
- func Address(a string) Option
- func Advertise(a string) Option
- func ChainName(n string) Option
- func ID(id string) Option
- func Metadata(md map[string]string) Option
- func Name(n string) Option
- func Provider(p provider.Provider) Option
- func RegisterTTL(t time.Duration) Option
- func TLSConfig(t *tls.Config) Option
- func Transport(t transport.Transport) Option
- func Version(v string) Option
- func WithCodecs(c map[string]codec.Codec) Option
- type Options
- type RegisterOption
- type RegisterOptions
- type Server
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultOptions = Options{ ChainName: "default", Metadata: map[string]string{}, }
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Options)
type Options ¶
type Options struct { Codecs map[string]codec.Codec Transport transport.Transport Metadata map[string]string //protocol Name string Address string Advertise string ID string Version string //singleton ChainName string //each microservice is a provider Provider provider.Provider RegisterTTL time.Duration // Other options for implementations of the interface // can be stored in a context Context context.Context TLSConfig *tls.Config }
type RegisterOption ¶
type RegisterOption func(*RegisterOptions)
func WithGrpcRegister ¶
func WithGrpcRegister(grpcRegister interface{}) RegisterOption
WithGrpcRegister set GrpcRegister
func WithMicroServiceName ¶
func WithMicroServiceName(microservice string) RegisterOption
func WithSchemaID ¶
func WithSchemaID(schemaID string) RegisterOption
func WithServiceProvider ¶
func WithServiceProvider(provider provider.Provider) RegisterOption
type RegisterOptions ¶
type Server ¶
type Server interface { Options() Options Init(...Option) error //register a schema of microservice,return unique schema id,you can specify schema id and microservice name of this schema Register(interface{}, ...RegisterOption) (string, error) Start() error Stop() error String() string }
Server interface for the server it implements innit, register, start, and stop the server..
Click to show internal directories.
Click to hide internal directories.