package fargo
import "github.com/hudl/fargo"
Index ¶
- Constants
- Variables
- type AmazonMetadataType
- type AppNotFoundError
- type Application
- type Config
- type DataCenterInfo
- type EurekaConnection
- func NewConn(address ...string) (e EurekaConnection)
- func NewConnFromConfig(conf Config) (c EurekaConnection)
- func NewConnFromConfigFile(location string) (c EurekaConnection, err error)
- func (e EurekaConnection) AddMetadataString(ins *Instance, key, value string) error
- func (e *EurekaConnection) DeregisterInstance(ins *Instance) error
- func (e *EurekaConnection) GetApp(name string) (Application, error)
- func (e *EurekaConnection) GetApps() (map[string]*Application, error)
- func (e *EurekaConnection) HeartBeatInstance(ins *Instance) error
- func (e *EurekaConnection) RegisterInstance(ins *Instance) error
- func (e *EurekaConnection) ReregisterInstance(ins *Instance) error
- func (e *EurekaConnection) SelectServiceURL() string
- func (e *EurekaConnection) UpdateApp(app *Application)
- func (e EurekaConnection) UpdateInstanceStatus(ins *Instance, status StatusType) error
- type GetAppsResponse
- type Instance
- type InstanceMetadata
- func (im *InstanceMetadata) GetBool(key string) (b bool, err error)
- func (im *InstanceMetadata) GetFloat32(key string) (f float32, err error)
- func (im *InstanceMetadata) GetFloat64(key string) (f float64, err error)
- func (im *InstanceMetadata) GetInt(key string) (i int, err error)
- func (im *InstanceMetadata) GetMap() map[string]interface{}
- func (im *InstanceMetadata) GetString(key string) (s string, err error)
- type LeaseInfo
- type StatusType
Constants ¶
const ( Amazon = "Amazon" MyOwn = "MyOwn" )
Datacenter names
Variables ¶
EurekaUrlSlugs is a map of resource names -> eureka URLs
Types ¶
type AmazonMetadataType ¶
type AmazonMetadataType struct { AmiLaunchIndex string `xml:"ami-launch-index"` LocalHostname string `xml:"local-hostname"` AvailabilityZone string `xml:"availability-zone"` InstanceID string `xml:"instance-id"` PublicIpv4 string `xml:"public-ipv4"` PublicHostname string `xml:"public-hostname"` AmiManifestPath string `xml:"ami-manifest-path"` LocalIpv4 string `xml:"local-ipv4"` HostName string `xml:"hostname"` AmiID string `xml:"ami-id"` InstanceType string `xml:"instance-type"` }
AmazonMetadataType is information about AZ's, AMI's, and the AWS instance <xsd:complexType name="amazonMetdataType"> from http://docs.amazonwebservices.com/AWSEC2/latest/DeveloperGuide/index.html?AESDG-chapter-instancedata.html
type AppNotFoundError ¶
type AppNotFoundError struct {
// contains filtered or unexported fields
}
func (AppNotFoundError) Error ¶
func (e AppNotFoundError) Error() string
type Application ¶
Application deserializeable from Eureka XML
func (*Application) ParseAllMetadata ¶
func (a *Application) ParseAllMetadata() error
ParseAllMetadata iterates through all instances in an application
type Config ¶
type Config struct { AWS aws Eureka eureka }
Config is a base struct to be read by code.google.com/p/gcfg
func ReadConfig ¶
ReadConfig from a file location. Minimal error handling. Just bails and passes up an error if the file isn't found
type DataCenterInfo ¶
type DataCenterInfo struct { Name string `xml:"name"` Metadata AmazonMetadataType `xml:"metadata"` }
DataCenterInfo is only really useful when running in AWS.
type EurekaConnection ¶
type EurekaConnection struct { ServiceUrls []string Timeout time.Duration PollInterval time.Duration PreferSameZone bool Retries int }
EurekaConnection is the settings required to make eureka requests
func NewConn ¶
func NewConn(address ...string) (e EurekaConnection)
NewConn is a default connection with just a list of ServiceUrls. Most basic way to make a new connection. Generally only if you know what you're doing and are going to do the configuration yourself some other way.
func NewConnFromConfig ¶
func NewConnFromConfig(conf Config) (c EurekaConnection)
NewConnFromConfig will, given a Config struct, return a connection based on those options
func NewConnFromConfigFile ¶
func NewConnFromConfigFile(location string) (c EurekaConnection, err error)
NewConnFromConfigFile sets up a connection object based on a config in specified path
func (EurekaConnection) AddMetadataString ¶
func (e EurekaConnection) AddMetadataString(ins *Instance, key, value string) error
AddMetadataString to a given instance. Is immediately sent to Eureka server.
func (*EurekaConnection) DeregisterInstance ¶
func (e *EurekaConnection) DeregisterInstance(ins *Instance) error
DeregisterInstance will deregister the given Instance from eureka. This is good practice to do before exiting or otherwise going off line.
func (*EurekaConnection) GetApp ¶
func (e *EurekaConnection) GetApp(name string) (Application, error)
GetApp returns a single eureka application by name
func (*EurekaConnection) GetApps ¶
func (e *EurekaConnection) GetApps() (map[string]*Application, error)
GetApps returns a map of all Applications
func (*EurekaConnection) HeartBeatInstance ¶
func (e *EurekaConnection) HeartBeatInstance(ins *Instance) error
HeartBeatInstance sends a single eureka heartbeat. Does not continue sending heartbeats. Errors if the response is not 200.
func (*EurekaConnection) RegisterInstance ¶
func (e *EurekaConnection) RegisterInstance(ins *Instance) error
RegisterInstance will register the given Instance with eureka if it is not already registered, but DOES NOT automatically send heartbeats. See HeartBeatInstance for that functionality
func (*EurekaConnection) ReregisterInstance ¶
func (e *EurekaConnection) ReregisterInstance(ins *Instance) error
ReregisterInstance will register the given Instance with eureka but DOES NOT automatically send heartbeats. See HeartBeatInstance for that functionality
func (*EurekaConnection) SelectServiceURL ¶
func (e *EurekaConnection) SelectServiceURL() string
SelectServiceURL gets a eureka instance based on the connection's load balancing scheme. TODO: Make this not just pick a random one.
func (*EurekaConnection) UpdateApp ¶
func (e *EurekaConnection) UpdateApp(app *Application)
UpdateApp creates a goroutine that continues to keep an application updated with its status in Eureka
func (EurekaConnection) UpdateInstanceStatus ¶
func (e EurekaConnection) UpdateInstanceStatus(ins *Instance, status StatusType) error
UpdateInstanceStatus updates the status of a given instance with eureka.
type GetAppsResponse ¶
type GetAppsResponse struct { VersionDelta int `xml:"versions__delta"` AppsHashCode string `xml:"apps__hashcode"` Applications []Application `xml:"application"` }
GetAppsResponse lets us deserialize the eureka/v2/apps response XML
type Instance ¶
type Instance struct { XMLName struct{} `xml:"instance"` HostName string `xml:"hostName"` App string `xml:"app"` IPAddr string `xml:"ipAddr"` VipAddress string `xml:"vipAddress"` SecureVipAddress string `xml:"secureVipAddress"` Status StatusType `xml:"status"` Port int `xml:"port"` SecurePort int `xml:"securePort"` DataCenterInfo DataCenterInfo `xml:"dataCenterInfo"` LeaseInfo LeaseInfo `xml:"leaseInfo"` Metadata InstanceMetadata `xml:"metadata"` }
Instance [de]serializeable [to|from] Eureka XML
type InstanceMetadata ¶
type InstanceMetadata struct { Raw []byte `xml:",innerxml"` // contains filtered or unexported fields }
InstanceMetadata represents the eureka metadata, which is arbitrary XML. See metadata.go for more info.
func (*InstanceMetadata) GetBool ¶
func (im *InstanceMetadata) GetBool(key string) (b bool, err error)
GetBool pulls a value cast as bool. Swallows panics from type assertion and returns false + an error if conversion fails
func (*InstanceMetadata) GetFloat32 ¶
func (im *InstanceMetadata) GetFloat32(key string) (f float32, err error)
GetFloat32 pulls a value cast as float. Swallows panics from type assertion and returns 0.0 + an error if conversion fails
func (*InstanceMetadata) GetFloat64 ¶
func (im *InstanceMetadata) GetFloat64(key string) (f float64, err error)
GetFloat64 pulls a value cast as float. Swallows panics from type assertion and returns 0.0 + an error if conversion fails
func (*InstanceMetadata) GetInt ¶
func (im *InstanceMetadata) GetInt(key string) (i int, err error)
GetInt pulls a value cast as int. Swallows panics from type assertion and returns 0 + an error if conversion fails
func (*InstanceMetadata) GetMap ¶
func (im *InstanceMetadata) GetMap() map[string]interface{}
GetMap returns a map of the metadata parameters for this instance
func (*InstanceMetadata) GetString ¶
func (im *InstanceMetadata) GetString(key string) (s string, err error)
GetString pulls a value cast as a string. Swallows panics from type assertion and returns empty string + an error if conversion fails
type LeaseInfo ¶
type LeaseInfo struct { RenewalIntervalInSecs int32 `xml:"renewalIntervalInSecs"` DurationInSecs int32 `xml:"durationInSecs"` RegistrationTimestamp int64 `xml:"registrationTimestamp"` LastRenewalTimestamp int64 `xml:"lastRenewalTimestamp"` EvictionTimestamp int32 `xml:"evictionTimestamp"` ServiceUpTimestamp int64 `xml:"serviceUpTimestamp"` }
LeaseInfo tells us about the renewal from Eureka, including how old it is
type StatusType ¶
type StatusType string
StatusType is an enum of the different statuses allowed by Eureka
const ( UP StatusType = "UP" DOWN StatusType = "DOWN" STARTING StatusType = "STARTING" OUTOFSERVICE StatusType = "OUT_OF_SERVICE" UNKNOWN StatusType = "UNKNOWN" )
Supported statuses
Source Files ¶
config.go connection.go errors.go log.go metadata.go net.go rpc.go struct.go
Directories ¶
Path | Synopsis |
---|---|
tests |
- Version
- v0.1.1
- Published
- Jun 9, 2014
- Platform
- js/wasm
- Imports
- 14 packages
- Last checked
- 3 weeks ago –
Tools for package owners.