Documentation ¶
Index ¶
- type App
- func (a *App) BG() *bg.Reg
- func (a *App) Cache() cache.Cache
- func (a *App) Close() error
- func (a *App) Config() *config.Config
- func (a *App) ConfigTree() config.Tree
- func (a *App) Deadline() (deadline time.Time, ok bool)
- func (a *App) Disco() disco.Agent
- func (a *App) Done() <-chan struct{}
- func (a *App) Drain() bool
- func (a *App) Err() error
- func (a *App) Error(tag, msg string, fields ...log.Field)
- func (a *App) L() log.Logger
- func (a *App) Ready()
- func (a *App) RegisterDrainHandler(h func(ctx context.Context))
- func (a *App) RegisterServer(addr string, s net.Server)
- func (a *App) RegisterService(r *ServiceRegistration)
- func (a *App) Scheduler() schedule.Scheduler
- func (a *App) Serve() error
- func (a *App) Service() string
- func (a *App) Shutdown()
- func (a *App) Stats() stats.Stats
- func (a *App) Trace(tag, msg string, fields ...log.Field)
- func (a *App) Tracer() tracing.Tracer
- func (a *App) Value(key interface{}) interface{}
- func (a *App) Warning(tag, msg string, fields ...log.Field)
- type ServiceRegistration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the core structure for a new service
func NewWithConfig ¶
NewWithConfig creates a new App with a custom configuration
func (*App) Close ¶
Close immediately closes the server and any in-flight request or background job will be left unfinished. For a graceful shutdown, use Shutdown.
func (*App) ConfigTree ¶
func (*App) Disco ¶
Disco returns the active service discovery agent.
When service discovery is disabled, it will return a local agent that acts like a regular service discovery agent, expect that it only registers local services.
func (*App) Drain ¶
Drain notify all handlers to enter in draining mode. It means they are no longer accepting new requests, but they can finish all in-flight requests
func (*App) RegisterDrainHandler ¶
RegisterDrainHandler registers a handler that is called when the app starts draining
func (*App) RegisterServer ¶
RegisterServer adds the given server to the list of managed servers
func (*App) RegisterService ¶
func (a *App) RegisterService(r *ServiceRegistration)
RegisterService adds the server to the list of managed servers and registers it to service discovery
func (*App) Shutdown ¶
func (a *App) Shutdown()
Shutdown gracefully shuts down the server without interrupting any active connections. Shutdown works by first draining all handlers, then draining the main context, and finally shut down. If the provided context expires before the shutdown is complete, Shutdown returns the context's error, otherwise it returns any error returned from closing the Server's underlying Listener(s).
type ServiceRegistration ¶
type ServiceRegistration struct { // ID is the service instance unique identifier (optional) ID string // Name is the service identifier Name string // Host is the interface on which the server runs. // Service discovery can override this value. Host string // Port is the port number Port uint16 // Server is the server that provides the registered service Server net.Server // Tags for that service (versioning, blue-green, whatever) Tags []string }
ServiceRegistration contains info to register a service
Directories ¶
Path | Synopsis |
---|---|
Package bg aims to manage all background jobs run on spine.
|
Package bg aims to manage all background jobs run on spine. |
Package cache is a caching and cache-filling library
|
Package cache is a caching and cache-filling library |
adapter/local
Package local provides an LRU cache and cache-filling library that only runs on the local instance.
|
Package local provides an LRU cache and cache-filling library that only runs on the local instance. |
lru
Package lru implements a LRU cache.
|
Package lru implements a LRU cache. |
Package config implements logic to load dynamic configuration from various sources
|
Package config implements logic to load dynamic configuration from various sources |
adapter/consul
Package consul reads configuration from the Consul KV store Consul is a highly available and distributed service discovery and key-value store designed with support for the modern data center to make distributed systems and configuration easy.
|
Package consul reads configuration from the Consul KV store Consul is a highly available and distributed service discovery and key-value store designed with support for the modern data center to make distributed systems and configuration easy. |
adapter/file
Package file reads configuration from a JSON file e.g.
|
Package file reads configuration from a JSON file e.g. |
Package context defines the context types, which carry information defined for a specific scope (application, request, ...) A context can be passed across API boundaries and between processes.
|
Package context defines the context types, which carry information defined for a specific scope (application, request, ...) A context can be passed across API boundaries and between processes. |
Package crypto provides security tools
|
Package crypto provides security tools |
adapter/consul
Package consul is a wrapper around the Hashicorp Consul service discovery functionnality Consul is a highly available and distributed service discovery and key-value store designed with support for the modern data center to make distributed systems and configuration easy.
|
Package consul is a wrapper around the Hashicorp Consul service discovery functionnality Consul is a highly available and distributed service discovery and key-value store designed with support for the modern data center to make distributed systems and configuration easy. |
example
|
|
cache
Package main is a distributed-cache example It creates a cache server and register it to the service discovery agent
|
Package main is a distributed-cache example It creates a cache server and register it to the service discovery agent |
disco
Package main is a service discovery example It creates an HTTP server and register it to the service discovery agent
|
Package main is a service discovery example It creates an HTTP server and register it to the service discovery agent |
grpc
Package main is a distributed-cache example It creates a cache server and register it to the service discovery agent
|
Package main is a distributed-cache example It creates a cache server and register it to the service discovery agent |
tracing
Package main is a tracing example with Jaeger
|
Package main is a tracing example with Jaeger |
Package log defines the logging facade A logger is composed of a formatter that serialises the log structure into a text line, and a log printer that outputs the formatted log lines.
|
Package log defines the logging facade A logger is composed of a formatter that serialises the log structure into a text line, and a log printer that outputs the formatted log lines. |
formatter/json
Package json is a JSON log formatter.
|
Package json is a JSON log formatter. |
formatter/logf
Package logf is a human friendly log formatter.
|
Package logf is a human friendly log formatter. |
printer/file
Package file prints log lines to a file.
|
Package file prints log lines to a file. |
printer/stackdriver
Package stackdriver send log lines to Google Stackdriver.
|
Package stackdriver send log lines to Google Stackdriver. |
printer/stdout
Package stdout prints log lines into the standard output.
|
Package stdout prints log lines into the standard output. |
Package net contains the main logic to send and receive requests I defines interfaces shared by other packages that accept or send requests Packages that implement these interfaces include: * net/cache * net/grpc * net/http It also manages the lifecycle of the handlers.
|
Package net contains the main logic to send and receive requests I defines interfaces shared by other packages that accept or send requests Packages that implement these interfaces include: * net/cache * net/grpc * net/http It also manages the lifecycle of the handlers. |
http
Package http is an extra layer on to of the standard go net/http package.
|
Package http is an extra layer on to of the standard go net/http package. |
naming
Package naming is a library that converts a target to one or multiple network addresses.
|
Package naming is a library that converts a target to one or multiple network addresses. |
stream
Package stream offers an abstraction layer for stream-processing platforms, such as NATS streaming.
|
Package stream offers an abstraction layer for stream-processing platforms, such as NATS streaming. |
stream/adapter/stan
Package stan is an adapter for NATS Streaming System
|
Package stan is an adapter for NATS Streaming System |
adapter/local
Package local implements a scheduler that persists jobs on a local storage.
|
Package local implements a scheduler that persists jobs on a local storage. |
Package stats provides functions for reporting metrics to a service.
|
Package stats provides functions for reporting metrics to a service. |
Package testing is an extension to the standard go testing package tailored for testing the spine framework.
|
Package testing is an extension to the standard go testing package tailored for testing the spine framework. |
adapter/jaeger
Package jaeger wraps the Jaeger tracer
|
Package jaeger wraps the Jaeger tracer |