models

package
v1.9.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ETCD_LINK_DIRECTORY = "/link"
)

Variables

View Source
var (
	ErrIPAlreadyPresent = errors.New("IP already present")
	ErrHostNotFound     = errors.New("Host not found")
)

Functions

func NewEtcdStorage

func NewEtcdStorage(config config.Config) etcdStorage

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 HealthcheckType

type HealthcheckType string
const (
	TCPHealthCheck HealthcheckType = "TCP"
)

type Host added in v1.9.0

type Host struct {
	Hostname string `json:"hostname"`
	LeaseID  int64  `json:"lease_id"`
}

type IP

type IP struct {
	ID                  string        `json:"id"`
	IP                  string        `json:"ip"`
	Status              string        `json:"status,omitempty"`
	Checks              []Healthcheck `json:"checks,omitempty"`
	KeepaliveInterval   int           `json:"keepalive_interval"`
	HealthcheckInterval int           `json:"healthcheck_interval"`
}

func (IP) ToLogrusFields added in v1.9.0

func (i IP) ToLogrusFields() logrus.Fields

type Storage

type Storage interface {
	GetIPs(context.Context) ([]IP, error)
	AddIP(context.Context, IP) (IP, error)
	UpdateIP(ctx context.Context, ip IP) error
	RemoveIP(context.Context, string) error

	GetHost(context.Context) (Host, error)
	SaveHost(context.Context, Host) error
}

Directories

Path Synopsis
Package modelsmock is a generated GoMock package.
Package modelsmock is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL