host

package
Version: v0.0.0-...-88aa921 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2015 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	//MAPPING is the elastic mapping for a host
	MAPPING, _ = elastic.NewMapping(mappingString)
)

Functions

func HostEquals

func HostEquals(t errorf, h1 *Host, h2 *Host) bool

HostEquals used for testing host equality in tests

func HostKey

func HostKey(id string) datastore.Key

HostKey creates a Key suitable for getting, putting and deleting Hosts

Types

type Host

type Host struct {
	ID             string // Unique identifier, default to hostid
	Name           string // A label for the host, eg hostname, role
	PoolID         string // Pool that the Host belongs to
	IPAddr         string // The IP address the host can be reached at from a serviced master
	RPCPort        int    // The RPC port of the host
	Cores          int    // Number of cores available to serviced
	Memory         uint64 // Amount of RAM (bytes) available to serviced
	PrivateNetwork string // The private network where containers run, eg 172.16.42.0/24
	CreatedAt      time.Time
	UpdatedAt      time.Time
	IPs            []HostIPResource // The static IP resources available on the host
	KernelVersion  string
	KernelRelease  string
	ServiceD       struct {
		Version   string
		Date      string
		Gitcommit string
		Gitbranch string
		Giturl    string
		Buildtag  string
	}
	MonitoringProfile domain.MonitorProfile
	datastore.VersionedEntity
}

Host that runs the control center agent.

func Build

func Build(ip string, rpcport string, poolid string, ipAddrs ...string) (*Host, error)

Build creates a Host type from the current host machine, filling out fields using the current machines attributes. The IP param is a routable IP used to connect to to the Host, if empty an IP from the available IPs will be used. The poolid param is the pool the host should belong to. Optional list of IP address strings to set as available IP resources, if not set the IP used for the host will be given as an IP Resource. If any IP is not a valid IP on the machine return error.

func New

func New() *Host

New creates a new empty host

func UpdateHostInfo

func UpdateHostInfo(h Host) (Host, error)

UpdateHostInfo returns a new host with updated hardware and software info. Does not update poor or IP information

func (*Host) Equals

func (a *Host) Equals(b *Host) bool

Equals verifies whether two host objects are equal

func (*Host) ValidEntity

func (h *Host) ValidEntity() error

ValidEntity validates Host fields

type HostIPResource

type HostIPResource struct {
	HostID        string
	IPAddress     string
	InterfaceName string
	MACAddress    string
}

HostIPResource contains information about a specific IP available as a resource

type HostStore

type HostStore struct {
	datastore.DataStore
}

HostStore type for interacting with Host persistent storage

func NewStore

func NewStore() *HostStore

NewStore creates a HostStore

func (*HostStore) FindHostsWithPoolID

func (hs *HostStore) FindHostsWithPoolID(ctx datastore.Context, poolID string) ([]Host, error)

FindHostsWithPoolID returns all hosts with the given poolid.

func (*HostStore) GetHostByIP

func (hs *HostStore) GetHostByIP(ctx datastore.Context, hostIP string) (*Host, error)

GetHostByIP looks up a host by the given ip address

func (*HostStore) GetN

func (hs *HostStore) GetN(ctx datastore.Context, limit uint64) ([]Host, error)

GetN returns all hosts up to limit.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL