Documentation
¶
Index ¶
- Constants
- Variables
- type EncryptedData
- type EncryptedStorage
- type Endpoint
- type EndpointLink
- type Endpoints
- type EtcdStorage
- func (e EtcdStorage) AddEndpoint(ctx context.Context, endpoint Endpoint) (Endpoint, error)
- func (e EtcdStorage) GetCurrentHost(ctx context.Context) (Host, error)
- func (e EtcdStorage) GetEndpointHosts(ctx context.Context, lockKey string) ([]string, error)
- func (e EtcdStorage) GetEndpoints(ctx context.Context) (Endpoints, error)
- func (e EtcdStorage) LinkEndpointWithCurrentHost(ctx context.Context, lockKey string) error
- func (e EtcdStorage) RemoveEndpoint(ctx context.Context, id string) error
- func (e EtcdStorage) SaveHost(ctx context.Context, host Host) error
- func (e EtcdStorage) UnlinkEndpointFromCurrentHost(ctx context.Context, lockKey string) error
- func (e EtcdStorage) UpdateEndpoint(ctx context.Context, endpoint Endpoint) error
- type HealthCheck
- type HealthChecks
- type Host
- type Storage
Constants ¶
View Source
const (
EncryptedDataTypeAESCFB = "aes-cfb"
)
View Source
const (
EtcdLinkDirectory = "/link"
)
Variables ¶
View Source
var ( ErrEndpointAlreadyPresent = errors.New("endpoint already present") ErrHostNotFound = errors.New("host not found") )
Functions ¶
This section is empty.
Types ¶
type EncryptedData ¶
type EncryptedStorage ¶
type EncryptedStorage interface {
Encrypt(ctx context.Context, data any) (EncryptedData, error)
Decrypt(ctx context.Context, data EncryptedData, v any) error
}
func NewEncryptedStorage ¶
type Endpoint ¶
type Endpoint struct {
ID string `json:"id"` // ID of this endpoint (starting with vip-)
// Full IP with mask (i.e. 10.0.0.1/32)
// Deprecated: The IP is now stored in the ARP Plugin config. This field is kept for backward compatibility
IP string `json:"ip"`
Checks HealthChecks `json:"checks,omitempty"` // Health check configured with this Endpoint
HealthCheckInterval int `json:"healthcheck_interval"` // Health check Intervals for this Endpoint
Plugin string `json:"plugin,omitempty"` // Plugin to use for this Endpoint
PluginConfig json.RawMessage `json:"plugin_config,omitempty"` // Plugin configuration
}
Endpoint stores the configuration of an endpoint for one host
type EndpointLink ¶
EndpointLink is the structure stored when an IP is linked to an Host
type EtcdStorage ¶
type EtcdStorage struct {
// contains filtered or unexported fields
}
func NewEtcdStorage ¶
func NewEtcdStorage(config config.Config) EtcdStorage
func (EtcdStorage) AddEndpoint ¶
func (EtcdStorage) GetCurrentHost ¶
func (e EtcdStorage) GetCurrentHost(ctx context.Context) (Host, error)
func (EtcdStorage) GetEndpointHosts ¶
func (EtcdStorage) GetEndpoints ¶
func (e EtcdStorage) GetEndpoints(ctx context.Context) (Endpoints, error)
func (EtcdStorage) LinkEndpointWithCurrentHost ¶
func (e EtcdStorage) LinkEndpointWithCurrentHost(ctx context.Context, lockKey string) error
func (EtcdStorage) RemoveEndpoint ¶
func (e EtcdStorage) RemoveEndpoint(ctx context.Context, id string) error
func (EtcdStorage) UnlinkEndpointFromCurrentHost ¶
func (e EtcdStorage) UnlinkEndpointFromCurrentHost(ctx context.Context, lockKey string) error
func (EtcdStorage) UpdateEndpoint ¶
func (e EtcdStorage) UpdateEndpoint(ctx context.Context, endpoint Endpoint) error
type HealthCheck ¶
type HealthCheck struct {
Type api.HealthCheckType `json:"type"`
Host string `json:"host"`
Port int `json:"port"`
}
func HealthCheckFromAPIType ¶
func HealthCheckFromAPIType(h api.HealthCheck) HealthCheck
func (HealthCheck) Addr ¶
func (h HealthCheck) Addr() string
func (HealthCheck) ToAPIType ¶
func (h HealthCheck) ToAPIType() api.HealthCheck
type HealthChecks ¶
type HealthChecks []HealthCheck
func HealthChecksFromAPIType ¶
func HealthChecksFromAPIType(hs []api.HealthCheck) HealthChecks
func (HealthChecks) ToAPIType ¶
func (h HealthChecks) ToAPIType() []api.HealthCheck
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 Storage ¶
type Storage interface {
GetEndpoints(ctx context.Context) (Endpoints, error) // GetEndpoints configured for this host
AddEndpoint(ctx context.Context, endpoint Endpoint) (Endpoint, error)
UpdateEndpoint(ctx context.Context, endpoint Endpoint) error
RemoveEndpoint(ctx context.Context, id string) error
GetCurrentHost(ctx context.Context) (Host, error) // Get host configuration for the current host
SaveHost(ctx context.Context, host Host) error // Save host modifications
LinkEndpointWithCurrentHost(ctx context.Context, key string) error // Link an Endpoint to the current host
UnlinkEndpointFromCurrentHost(ctx context.Context, key string) error // Unlink an Endpoint from the current host
GetEndpointHosts(ctx context.Context, key string) ([]string, error) // List all hosts linked to the Endpoint
}
Storage engine needed for the LinK persistent memory
Source Files
¶
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.