Documentation ¶
Index ¶
- Variables
- func ActiveListenerNames() []string
- func BuildKVStoreTestConfig(t *testing.T) kvstore.KVStore
- func RecordActiveConfig(serviceConfig *ServiceConfig)
- func RegisterHealthCheckForBackend(kvs kvstore.KVStore, backend string, hcfn HealthCheckFn) error
- func RegisterHealthCheckForServer(kvs kvstore.KVStore, server string, hcfn HealthCheckFn) error
- type BackendConfig
- type HealthCheckFn
- type ListenerConfig
- type RouteConfig
- type ServerConfig
- type ServiceBackend
- type ServiceConfig
- type ServiceRoute
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoListenerName = errors.New("No listener name specified") ErrNoKVStore = errors.New("No kv store provided") )
var ErrNoHealthCheckFn = errors.New("No health check function provided")
var ErrNoSuchBackend = errors.New("Backend definition not found")
var ErrNoSuchServer = errors.New("Server definition not found")
var ListenContext bool
ListenContext is set to true if the listen command is being executed
var (
NullJSON = []byte("null")
)
NullJSON represents the marshaling of a nil value
Functions ¶
func ActiveListenerNames ¶
func ActiveListenerNames() []string
ActiveListenerNames reurns the names of the listeners for whom the associated ServiceConfig has been recorded.
func RecordActiveConfig ¶
func RecordActiveConfig(serviceConfig *ServiceConfig)
RecordActiveConfig allows a service config constructed from a listener name to be recorded and made available to all code using the xavi framework
func RegisterHealthCheckForBackend ¶
func RegisterHealthCheckForBackend(kvs kvstore.KVStore, backend string, hcfn HealthCheckFn) error
RegisterHealthCheckForBackend registers the given health check for every server associated with the given backend
func RegisterHealthCheckForServer ¶
func RegisterHealthCheckForServer(kvs kvstore.KVStore, server string, hcfn HealthCheckFn) error
RegisterHealthCheckForServer registers a custom health check function for a given server. The configuration store is check for the existence of the specified server definition prior to storing the health check function.
Types ¶
type BackendConfig ¶
type BackendConfig struct { Name string ServerNames []string LoadBalancerPolicy string CACertPath string TLSOnly bool }
BackendConfig defines the data stored for a Backend definition
func JSONToBackend ¶
func JSONToBackend(bytes []byte) *BackendConfig
JSONToBackend unmarshals a JSON representation of a BackendCOnfig
func ListBackendConfigs ¶
func ListBackendConfigs(kvs kvstore.KVStore) ([]*BackendConfig, error)
ListBackendConfigs lists the backend definitions present in the supplied KVS
func ReadBackendConfig ¶
func ReadBackendConfig(name string, kvs kvstore.KVStore) (*BackendConfig, error)
ReadBackendConfig reads a backend config defnition using the supplied KVS
type HealthCheckFn ¶
HealthCheckFn defines the signature of custom health checks
func HealthCheckForServer ¶
func HealthCheckForServer(server string) HealthCheckFn
HealthCheckForServer returns the custom health check function associated with a server
type ListenerConfig ¶
ListenerConfig represents a listener configuration definition
func JSONToListener ¶
func JSONToListener(bytes []byte) *ListenerConfig
JSONToListener unmarshals the JSON representation of a listener definition
func ListListenerConfigs ¶
func ListListenerConfigs(kvs kvstore.KVStore) ([]*ListenerConfig, error)
ListListenerConfigs retrieves the listener defs from the KVS
func ReadListenerConfig ¶
func ReadListenerConfig(name string, kvs kvstore.KVStore) (*ListenerConfig, error)
ReadListenerConfig retrieves the named listener definition from the supplied KVS
type RouteConfig ¶
type RouteConfig struct { Name string URIRoot string Backends []string Plugins []string MultiBackendAdapter string MsgProps string }
RouteConfig represents a route configuration definition
func JSONToRoute ¶
func JSONToRoute(bytes []byte) *RouteConfig
JSONToRoute unmarshals the JSON representation of a route definition
func ListRouteConfigs ¶
func ListRouteConfigs(kvs kvstore.KVStore) ([]*RouteConfig, error)
ListRouteConfigs returns the route configs in the key value store
func ReadRouteConfig ¶
func ReadRouteConfig(name string, kvs kvstore.KVStore) (*RouteConfig, error)
ReadRouteConfig retrieves the specified route config using the supplied key value store
type ServerConfig ¶
type ServerConfig struct { Name string Address string Port int PingURI string HealthCheck string HealthCheckInterval int //In milliseconds HealthCheckTimeout int //In milliseconds }
ServerConfig represents a server configuration definition
func JSONToServer ¶
func JSONToServer(bytes []byte) *ServerConfig
JSONToServer unmarshals a JSON representation of a server definition
func ListServerConfigs ¶
func ListServerConfigs(kvs kvstore.KVStore) ([]*ServerConfig, error)
ListServerConfigs returns a list of the server configurations present in the supplied KVS
func ReadServerConfig ¶
func ReadServerConfig(name string, kvs kvstore.KVStore) (*ServerConfig, error)
ReadServerConfig retrieves the named server defnition using the supplied KVS
type ServiceBackend ¶
type ServiceBackend struct { Backend *BackendConfig Servers []*ServerConfig }
ServiceBackend contains the backend definition and all the linked server definitions for the backend
type ServiceConfig ¶
type ServiceConfig struct { Listener *ListenerConfig Routes []*ServiceRoute }
ServiceConfig is the top level structure that joins up all the configuration from the listener def into a single structure, reading the definition from the KVStore
func ActiveConfigForListener ¶
func ActiveConfigForListener(listenerName string) *ServiceConfig
ActiveConfigForListener returns the ServiceConfig associated with the provided listener names
func ReadServiceConfig ¶
func ReadServiceConfig(listenerName string, kvs kvstore.KVStore) (*ServiceConfig, error)
ReadServiceConfig reads all configuration for a given listener and links all the definitions together
func (*ServiceConfig) LogConfig ¶
func (sc *ServiceConfig) LogConfig()
LogConfig logs information associated with the ServiceConfig
type ServiceRoute ¶
type ServiceRoute struct { Route *RouteConfig Backends []*ServiceBackend }
ServiceRoute contains the Route definition read from config and the associated backend configs as well