Documentation ¶
Index ¶
Constants ¶
View Source
const (
EtcdLinkDirectory = "/link"
)
Variables ¶
View Source
var ( ErrIPAlreadyPresent = errors.New("IP already present") ErrHostNotFound = errors.New("host not found") )
Functions ¶
func NewEtcdStorage ¶
Types ¶
type Healthcheck ¶
type Healthcheck struct { Type HealthcheckType `json:"type"` Host string `json:"host"` Port int `json:"port"` }
func (Healthcheck) Addr ¶
func (h Healthcheck) Addr() string
type Host ¶
type Host struct { Hostname string `json:"hostname"` // Hostname of this host LeaseID int64 `json:"lease_id"` // LeaseID current lease ID of this host // DataVersion is the version number of how the data is stored in etcd for this host. This field is introduced in 2.0.0. But the data format version v0 correspond to the format before v1.9.0. DataVersion int `json:"data_version,omitempty"` }
Host stores the host configuration. This is used by an host to retrieve his configuration after a restart.
type IP ¶
type IP struct { ID string `json:"id"` // ID of this Virtual IP (strarting with vip-) IP string `json:"ip"` // Full IP with mask (i.e. 10.0.0.1/32) Status string `json:"status,omitempty"` // Status of this VIP Checks []Healthcheck `json:"checks,omitempty"` // Healthcheck configured with this VIP HealthcheckInterval int `json:"healthcheck_interval"` // HealthcheckIntevals for this VIP }
IP stores the configuration of a virtual IP for one host
func (IP) StorableIP ¶
StorableIP transforms the IP to a string that is compatible with ETCD key naming rules
func (IP) ToLogrusFields ¶
ToLogrusFields returns a Logrus representation of an IP
type Storage ¶
type Storage interface { GetIPs(context.Context) ([]IP, error) // GetIPs configured for this host AddIP(context.Context, IP) (IP, error) UpdateIP(ctx context.Context, ip IP) error RemoveIP(context.Context, string) error GetCurrentHost(context.Context) (Host, error) // Get host configuration for the current host SaveHost(context.Context, Host) error // Save host modifications LinkIPWithCurrentHost(context.Context, IP) error // Link an IP to the current host UnlinkIPFromCurrentHost(context.Context, IP) error // Unlink an IP from the current host GetIPHosts(context.Context, IP) ([]string, error) // List all hosts linked to the IP }
Storage engine needed for the LinK persistent memory
Directories ¶
Path | Synopsis |
---|---|
Package modelsmock is a generated GoMock package.
|
Package modelsmock is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.