Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultCacheConfig = CacheConfig{ TTL: 0, Statuses: []int{}, Tags: []string{}, }
DefaultCacheConfig is the value by default
var ErrCacheConfigNotFound = errors.New("Cache config not found")
ErrCacheConfigNotFound error for not found service
var ErrCacheNotFound = errors.New("Cache not found")
ErrCacheNotFound error for not found cache
var ErrInvalidCacheConfig = errors.New("Invalid cache config")
ErrInvalidCacheConfig error for invalid cache
var ErrInvalidDeleteCache = errors.New("Paths or tags should be specified")
ErrInvalidDeleteCache error for invalid delete cache objects
var ErrInvalidServiceStatus = errors.New("Invalid service status")
ErrInvalidServiceStatus error for unknown service statuses
var ErrServiceAlreadyRegistered = errors.New("Service is already registered")
ErrServiceAlreadyRegistered error for service already registered
var ErrServiceNotFound = errors.New("Service not found")
ErrServiceNotFound error for not found service
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct { Path string `json:"path"` StatusCode int `json:"statusCode"` Headers http.Header `json:"headers"` Body []byte `json:"body"` TTL CacheTTL `json:"ttl"` Tags []string `json:"tags"` }
Cache is a cached service response
type CacheConfig ¶
type CacheConfig struct { TTL int64 `json:"ttl"` Statuses []int `json:"statuses"` Tags []string `json:"tags"` }
CacheConfig defines cache configuration params for a service
func (CacheConfig) Validate ¶
func (c CacheConfig) Validate() error
Validate checks whether a cache is valid
type CacheTTL ¶
CacheTTL is the cache time to live in seconds
func NewCacheTTL ¶
NewCacheTTL creates a new cache TTL in seconds
func (CacheTTL) MarshalJSON ¶
MarshalJSON serializes a TTL
type DeleteCache ¶
DeleteCache defines the params used to delete cache
func (DeleteCache) Validate ¶
func (p DeleteCache) Validate() error
Validate checks if the payload is valid
type ErrCachePathNotFound ¶
type ErrCachePathNotFound struct {
CachePath
}
ErrCachePathNotFound used when a cache defined by its path was not found
func (*ErrCachePathNotFound) Error ¶
func (e *ErrCachePathNotFound) Error() string
type Match ¶ added in v0.0.11
type Service ¶
type Service struct { ID string `json:"id"` Match Match `json:"match"` Backend Backend `json:"backend"` Status ServiceStatus `json:"status"` Cache CacheConfig `json:"cache"` }
Service defines the relevant info about a microservice
type ServiceStatus ¶
type ServiceStatus string
ServiceStatus defines the service current status
const ( // ServiceStatusHealthy service is responding to healtchecks ServiceStatusHealthy ServiceStatus = "healthy" // ServiceStatusIdle service is not responding to healthchecks ServiceStatusIdle ServiceStatus = "idle" )
func (ServiceStatus) MarshalBinary ¶
func (ss ServiceStatus) MarshalBinary() ([]byte, error)
MarshalBinary serializes a service status
func (ServiceStatus) Validate ¶
func (ss ServiceStatus) Validate() error
Validate validates a service status