Documentation
¶
Index ¶
- Constants
- Variables
- type Option
- func Address(addr string) Option
- func Client(c client.Client) Option
- func Command(c *cobra.Command) Option
- func Description(s string) Option
- func Heartbeat(d time.Duration) Option
- func Metadata(md metadata.MD) Option
- func Network(name string) Option
- func Registry(r registry.Registry) Option
- func Server(s server.Server) Option
- func TLSConfig(c *tls.Config) Option
- func Timeout(d time.Duration) Option
- func Transport(t transport.Transport) Option
- func Version(v string) Option
- type Options
- type Service
Constants ¶
View Source
const ( DefaultVersion = "latest" DefaultAddress = ":0" DefaultNetwork = "local" DefaultDescription = "A service written with Nebula" DefaultHeartbeat = time.Second * 10 )
Variables ¶
View Source
var DefaultOptions = Options{ Version: DefaultVersion, Address: DefaultAddress, Network: DefaultNetwork, Description: DefaultDescription, Heartbeat: DefaultHeartbeat, Metadata: metadata.MD{}, Command: &cobra.Command{}, Registry: registry.Default, Transport: transport.Default, Client: client.Default, Server: server.Default, }
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct { // Version specifies the service version. Version string // Address specifies an address to bind. Address string // Network specifies a network to run in. e.g. local, tunnel or ip:port Network string // Metadata specifies some metadata. Metadata metadata.MD // Heartbeat specifies how often to re-register to the registry. Heartbeat time.Duration // Registry specifies a registry provider. Registry registry.Registry // Transport specifies a transport provider. Transport transport.Transport // Client specifies a client to use to make RPC calls. Client client.Client // Server specifies a server to serve this node. Server server.Server // Profile specifies a profile to instantiate global interfaces. Profile profile.Profile // TLSConfig specifies the TLS configuration used by client and server. TLSConfig *tls.Config // Timeout specifies a time limit for requests made by client. Timeout time.Duration // Command specifies a cobra command for the service. Command *cobra.Command // Description specifies a description shown in the command. Description string }
type Service ¶
type Service interface { // Name returns the service name. Name() string // Version returns the service version. Version() string // Client returns the client. Client() client.Client // Server returns the server. Server() server.Server // RunCtx runs the service with a context. RunCtx(context.Context) error // Run runs the service with the background context. Run() error }
Click to show internal directories.
Click to hide internal directories.