host

package
v0.8.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: PostgreSQL Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const HostMonitorRefreshInterval = 15 * time.Second

Variables

This section is empty.

Functions

func GreatestCommonDefaultVersion

func GreatestCommonDefaultVersion(hosts ...*Host) (*ds.PgEdgeVersion, error)

func Provide

func Provide(i *do.Injector)

Types

type Cohort

type Cohort struct {
	Type             CohortType
	MemberID         string
	ControlAvailable bool
}

type CohortType

type CohortType string
const (
	CohortTypeSwarm CohortType = "swarm"
)

type Host

type Host struct {
	ID                      string
	Orchestrator            config.Orchestrator
	Cohort                  *Cohort
	DataDir                 string
	PeerAddresses           []string
	ClientAddresses         []string
	CPUs                    int
	MemBytes                uint64
	EtcdMode                config.EtcdMode
	Status                  *HostStatus
	DefaultPgEdgeVersion    *ds.PgEdgeVersion
	SupportedPgEdgeVersions []*ds.PgEdgeVersion
}

func (*Host) Supports

func (h *Host) Supports(pgEdgeVersion *ds.PgEdgeVersion) bool

type HostState

type HostState string
const (
	HostStateHealthy     HostState = "healthy"
	HostStateUnreachable HostState = "unreachable"
	HostStateDegraded    HostState = "degraded"
	HostStateUnknown     HostState = "unknown"
)

type HostStatus

type HostStatus struct {
	HostID     string
	UpdatedAt  time.Time
	State      HostState
	Components map[string]healthcheck.ComponentStatus
}

type HostStatusStore

type HostStatusStore struct {
	// contains filtered or unexported fields
}

func NewHostStatusStore

func NewHostStatusStore(client *clientv3.Client, root string) *HostStatusStore

func (*HostStatusStore) Create

func (*HostStatusStore) DeleteByKey

func (s *HostStatusStore) DeleteByKey(hostID string) storage.DeleteOp

func (*HostStatusStore) GetAll

func (*HostStatusStore) GetByKey

func (s *HostStatusStore) GetByKey(hostID string) storage.GetOp[*StoredHostStatus]

func (*HostStatusStore) GetByKeys

func (s *HostStatusStore) GetByKeys(hostIDs ...string) storage.GetMultipleOp[*StoredHostStatus]

func (*HostStatusStore) Key

func (s *HostStatusStore) Key(hostID string) string

func (*HostStatusStore) Prefix

func (s *HostStatusStore) Prefix() string

func (*HostStatusStore) Put

type HostStore

type HostStore struct {
	// contains filtered or unexported fields
}

func NewHostStore

func NewHostStore(client *clientv3.Client, root string) *HostStore

func (*HostStore) Create

func (s *HostStore) Create(item *StoredHost) storage.PutOp[*StoredHost]

func (*HostStore) DeleteByKey

func (s *HostStore) DeleteByKey(hostID string) storage.DeleteOp

func (*HostStore) GetAll

func (s *HostStore) GetAll() storage.GetMultipleOp[*StoredHost]

func (*HostStore) GetByKey

func (s *HostStore) GetByKey(hostID string) storage.GetOp[*StoredHost]

func (*HostStore) GetByKeys

func (s *HostStore) GetByKeys(hostIDs ...string) storage.GetMultipleOp[*StoredHost]

func (*HostStore) Key

func (s *HostStore) Key(hostID string) string

func (*HostStore) Prefix

func (s *HostStore) Prefix() string

func (*HostStore) Put

func (s *HostStore) Put(item *StoredHost) storage.PutOp[*StoredHost]

type Orchestrator

type Orchestrator interface {
	PopulateHost(ctx context.Context, h *Host) error
	PopulateHostStatus(ctx context.Context, h *HostStatus) error
}

type Resources

type Resources struct {
	CPUs     int    `json:"cpus"`
	MemBytes uint64 `json:"mem_bytes"`
}

func DetectResources

func DetectResources() (*Resources, error)

func (Resources) NanoCPUs

func (r Resources) NanoCPUs() int64

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(cfg config.Config, etcd etcd.Etcd, store *Store, orchestrator Orchestrator) *Service

func (*Service) GetAllHosts

func (s *Service) GetAllHosts(ctx context.Context) ([]*Host, error)

func (*Service) GetHost

func (s *Service) GetHost(ctx context.Context, hostID string) (*Host, error)

func (*Service) GetHosts

func (s *Service) GetHosts(ctx context.Context, hostIDs []string) ([]*Host, error)

func (*Service) RemoveHost

func (s *Service) RemoveHost(ctx context.Context, hostID string) error

func (*Service) UpdateHost

func (s *Service) UpdateHost(ctx context.Context) error

func (*Service) UpdateHostStatus

func (s *Service) UpdateHostStatus(ctx context.Context) error

type Store

type Store struct {
	Host       *HostStore
	HostStatus *HostStatusStore
	// contains filtered or unexported fields
}

func NewStore

func NewStore(client *clientv3.Client, root string) *Store

func (*Store) Txn

func (s *Store) Txn(ops ...storage.TxnOperation) storage.Txn

type StoredCohort

type StoredCohort struct {
	Type             CohortType `json:"type"`
	MemberID         string     `json:"member_id"`
	ControlAvailable bool       `json:"control_available"`
}

type StoredHost

type StoredHost struct {
	storage.StoredValue
	ID                      string              `json:"id"`
	Orchestrator            config.Orchestrator `json:"type"`
	Cohort                  *StoredCohort       `json:"stored_cohort,omitempty"`
	DataDir                 string              `json:"data_dir"`
	PeerAddresses           []string            `json:"peer_addresses"`
	ClientAddresses         []string            `json:"client_addresses"`
	CPUs                    int                 `json:"cpus"`
	MemBytes                uint64              `json:"mem_bytes"`
	EtcdMode                config.EtcdMode     `json:"etcd_mode"`
	DefaultPgEdgeVersion    *ds.PgEdgeVersion   `json:"default_version"`
	SupportedPgEdgeVersions []*ds.PgEdgeVersion `json:"supported_versions"`
}

type StoredHostStatus

type StoredHostStatus struct {
	storage.StoredValue
	HostID     string                                 `json:"host_id"`
	UpdatedAt  time.Time                              `json:"updated_at"`
	State      HostState                              `json:"state"`
	Components map[string]healthcheck.ComponentStatus `json:"components"`
}

Jump to

Keyboard shortcuts

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