Documentation
¶
Overview ¶
Package server provides the HTTP server for the TODO
Index ¶
- Variables
- type EventClient
- type EventMessage
- type NATSClient
- type NATSOption
- type Option
- func WithAuditFileWriter(w io.Writer) Option
- func WithDebug(dbg bool) Option
- func WithEventProcessor(p eventprocessor.EventProcessor) Option
- func WithEventRouter(er eventrouter.EventRouter) Option
- func WithGovernorClient(c *governor.Client) Option
- func WithLogger(logger *zap.Logger) Option
- func WithNATSClient(c *NATSClient) Option
- func WithTracer(t trace.Tracer) Option
- type Server
- type Status
Constants ¶
This section is empty.
Variables ¶
var ErrNoNATSConnection = errors.New("no NATS connection")
ErrNoNATSConnection is returned when there is no NATS connection
Functions ¶
This section is empty.
Types ¶
type EventClient ¶
type EventClient interface { Subscribe(ctx context.Context, subject string) error Messages() <-chan *EventMessage Shutdown() error }
EventClient is an interface for the event client
type EventMessage ¶
EventMessage is a wrapper for a governor event message
type NATSClient ¶
type NATSClient struct {
// contains filtered or unexported fields
}
NATSClient is a NATS client with some configuration
func NewNATSClient ¶
func NewNATSClient(opts ...NATSOption) (*NATSClient, error)
NewNATSClient configures and establishes a new NATS client connection
func (*NATSClient) Messages ¶
func (c *NATSClient) Messages() <-chan *EventMessage
Messages returns a channel of messages
func (*NATSClient) Shutdown ¶
func (c *NATSClient) Shutdown() error
Shutdown drains and closes the NATS connection
type NATSOption ¶
type NATSOption func(c *NATSClient)
NATSOption is a functional configuration option for NATS
func WithNATSConn ¶
func WithNATSConn(nc *nats.Conn) NATSOption
WithNATSConn sets the nats connection
func WithNATSLogger ¶
func WithNATSLogger(l *zap.Logger) NATSOption
WithNATSLogger sets the NATS client logger
func WithNATSPrefix ¶
func WithNATSPrefix(p string) NATSOption
WithNATSPrefix sets the nats subscription prefix
func WithNATSQueueGroup ¶
func WithNATSQueueGroup(q string, s int) NATSOption
WithNATSQueueGroup sets the nats subscription queue group
func WithNATSTracer ¶
func WithNATSTracer(t trace.Tracer) NATSOption
WithNATSTracer sets the NATS client tracer
type Option ¶
type Option func(*Server)
Option is a function that configures a Server
func WithAuditFileWriter ¶
WithAuditFileWriter sets the audit file writer for the server
func WithEventProcessor ¶
func WithEventProcessor(p eventprocessor.EventProcessor) Option
WithEventProcessor adds an event processor to the server
func WithEventRouter ¶
func WithEventRouter(er eventrouter.EventRouter) Option
WithEventRouter sets the event router for the server
func WithGovernorClient ¶
WithGovernorClient sets the governor client for the server
func WithLogger ¶
WithLogger sets the logger for the server
func WithNATSClient ¶
func WithNATSClient(c *NATSClient) Option
WithNATSClient sets the nats client for the server
type Server ¶
type Server struct { Listen string Debug bool AuditFileWriter io.Writer // contains filtered or unexported fields }
Server implements the HTTP Server
func (*Server) Bootstrap ¶
Bootstrap is a function that bootstraps the extension it is called by the server after it has started
- extension check if it is registered
- extension check if it is enabled
- compare local ERDs with ERDs from governor, only create new ERDs if they don't exist in governor. Since ERDs are immutable, the extension will not attempt to update the ERDs if it was changed by the developer.
func (*Server) ListenEvents ¶
ListenEvents listens for events from the governor api