Documentation ¶
Overview ¶
Package ensign implements the Ensign single node server.
Index ¶
- Constants
- type PubSub
- type Server
- func (s *Server) Publish(stream api.Ensign_PublishServer) (err error)
- func (s *Server) Run(sock net.Listener)
- func (s *Server) Serve() (err error)
- func (s *Server) Shutdown() (err error)
- func (s *Server) Status(ctx context.Context, in *api.HealthCheck) (out *api.ServiceState, err error)
- func (s *Server) StreamInterceptors() []grpc.StreamServerInterceptor
- func (s *Server) Subscribe(stream api.Ensign_SubscribeServer) (err error)
- func (s *Server) UnaryInterceptors() []grpc.UnaryServerInterceptor
Constants ¶
const BufferSize = 16384
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PubSub ¶
type PubSub struct {
// contains filtered or unexported fields
}
PubSub is a simple dispatcher that has a publish queue that fans in events from different publisher streams and assigns event ids then fans the events out to send them to one or more subscriber streams with an outgoing buffer. Backpressure is applied to the publisher streams when the buffers get full.
func (*PubSub) Finish ¶
Finish closes a subscribe channel and removes it so that the PubSub no longer sends.
func (*PubSub) Publish ¶
Publish puts an event on the input queue and waits until the event is handled and an ID is assigned then returns the ID of the event to the caller.
type Server ¶
type Server struct { api.UnimplementedEnsignServer // contains filtered or unexported fields }
An Ensign server implements the Ensign service as defined by the wire protocol.
func New ¶
New creates a new ensign server with the given configuration. Most server setup is conducted in this method including setting up logging, connecting to databases, etc. If this method succeeds without an error, the server is ready to be served, but it will not listen to or handle requests until the Serve() method is called.
func (*Server) Publish ¶
func (s *Server) Publish(stream api.Ensign_PublishServer) (err error)
Publish implements the streaming endpoint for the API.
func (*Server) Run ¶
Run the gRPC server on the specified socket. This method can be used to serve TCP requests or to connect to a bufconn for testing purposes. This method blocks while the server is running so it should be run in a go routine.
func (*Server) Shutdown ¶
Shutdown stops the ensign server and all long running processes gracefully. May return a multierror if there were multiple problems during shutdown but it will attempt to close all open services and processes.
func (*Server) Status ¶
func (s *Server) Status(ctx context.Context, in *api.HealthCheck) (out *api.ServiceState, err error)
Status implements a simple heartbeat mechanism for checking on the state of the Ensign server and making sure that the node is up and responding.
func (*Server) StreamInterceptors ¶
func (s *Server) StreamInterceptors() []grpc.StreamServerInterceptor
Prepares the interceptors (middleware) for the unary RPC endpoints of the server. The first interceptor will be the outer most, while the last interceptor will be the inner most wrapper around the real call. All stream interceptors returned by this method should be chained using grpc.ChainStreamInterceptor().
func (*Server) Subscribe ¶
func (s *Server) Subscribe(stream api.Ensign_SubscribeServer) (err error)
Subscribe implements the streaming endpoint for the API
func (*Server) UnaryInterceptors ¶
func (s *Server) UnaryInterceptors() []grpc.UnaryServerInterceptor
Prepares the interceptors (middleware) for the unary RPC endpoings of the server. The first interceptor will be the outer most, while the last interceptor will be the inner most wrapper around the real call. All unary interceptors returned by this method should be chained using grpc.ChainUnaryInterceptor().
Directories ¶
Path | Synopsis |
---|---|
Package mock implements an in-memory gRPC mock Ensign server that can be connected to using a bufconn.
|
Package mock implements an in-memory gRPC mock Ensign server that can be connected to using a bufconn. |
Package o11y (a numeronym for "observability") exports server-specific metric collectors to Prometheus for monitoring of the service and Ensign nodes.
|
Package o11y (a numeronym for "observability") exports server-specific metric collectors to Prometheus for monitoring of the service and Ensign nodes. |