pool

package
v0.0.0-...-1c5d739 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: Apache-2.0 Imports: 12 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

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

Functions

func GetType

func GetType() string

GetType returns a ResourcePool's type or kind, can be used to get the string value of ResourcePool's type without a ResourcePool instance. It returns the kind as a string.

func Key

func Key(id string) datastore.Key

Key creates a Key suitable for getting, putting and deleting ResourcePools

Types

type ByIP

type ByIP []VirtualIP

func (ByIP) Len

func (b ByIP) Len() int

func (ByIP) Less

func (b ByIP) Less(i, j int) bool

func (ByIP) Swap

func (b ByIP) Swap(i, j int)

type Permission

type Permission uint
const (
	AdminAccess Permission = 1 << iota
	DFSAccess
)

type PoolHost

type PoolHost struct {
	HostID string
	PoolID string
	HostIP string
}

An association between a host and a pool.

type PoolIPs

type PoolIPs struct {
	PoolID     string
	HostIPs    []host.HostIPResource
	VirtualIPs []VirtualIP
}

PoolIPs type for IP resources available in a ResourcePool

type ReadPool

type ReadPool struct {
	ID                string     // Unique identifier for resource pool, eg "default"
	Description       string     // Description of the resource pool
	CoreCapacity      int        // Sum of all cores on all hosts in the pool
	MemoryCapacity    uint64     // Sum of all RAM available (bytes) on all hosts in the pool
	MemoryCommitment  uint64     // Sum of RAM committed (bytes) to services in the pool
	ConnectionTimeout int        // Wait delay on service rescheduling when an outage is reported (milliseconds)
	CreatedAt         time.Time  // When the pool was created
	UpdatedAt         time.Time  // When the poool was last updated
	Permissions       Permission // A bitset of pemissions for this pool's hosts
}

ReadPool is the read model for resource pools which contains properties for viewing information about resource pools.

type ResourcePool

type ResourcePool struct {
	ID                string      // Unique identifier for resource pool, eg "default"
	Realm             string      // The name of the realm where this pool resides
	Description       string      // Description of the resource pool
	VirtualIPs        []VirtualIP // All virtual IPs associated with a pool
	CoreLimit         int         // Number of cores on the host available to serviced
	MemoryLimit       uint64      // A quota on the amount (bytes) of RAM in the pool, 0 = unlimited
	CoreCapacity      int         // Number of cores available as a sum of all cores on all hosts in the pool
	MemoryCapacity    uint64      // Amount (bytes) of RAM available as a sum of all memory on all hosts in the pool
	MemoryCommitment  uint64      // Amount (bytes) of RAM committed to services
	ConnectionTimeout int         // Wait delay on service rescheduling when an outage is reported (milliseconds)
	CreatedAt         time.Time
	UpdatedAt         time.Time
	MonitoringProfile domain.MonitorProfile
	Permissions       Permission
	datastore.VersionedEntity
}

ResourcePool A collection of computing resources with optional quotas.

func New

func New(id string) *ResourcePool

New creates new ResourcePool

func (*ResourcePool) Equals

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

Equal returns true if two resource pools are equal

func (ResourcePool) GetConnectionTimeout

func (p ResourcePool) GetConnectionTimeout() time.Duration

func (*ResourcePool) GetID

func (a *ResourcePool) GetID() string

GetID returns its ResourcePool's ID. It return the ID as a string

func (*ResourcePool) GetType

func (a *ResourcePool) GetType() string

GetType return a ResourcePool's Entity type or kind. It returns the Kind as a string.

func (*ResourcePool) HasAdminAccess

func (a *ResourcePool) HasAdminAccess() bool

func (*ResourcePool) HasDfsAccess

func (a *ResourcePool) HasDfsAccess() bool

func (*ResourcePool) ValidEntity

func (p *ResourcePool) ValidEntity() error

ValidEntity validates Host fields

func (*ResourcePool) VirtualIPsEqual

func (a *ResourcePool) VirtualIPsEqual(b *ResourcePool) bool

type Store

type Store interface {
	datastore.EntityStore

	// GetResourcePools Get a list of all the resource pools
	GetResourcePools(ctx datastore.Context) ([]ResourcePool, error)

	// GetResourcePoolsByRealm gets a list of resource pools for a given realm
	GetResourcePoolsByRealm(ctx datastore.Context, realm string) ([]ResourcePool, error)

	// HasVirtualIP returns true if there is a virtual ip found for the given pool
	HasVirtualIP(ctx datastore.Context, poolID, virtualIP string) (bool, error)
}

Store type for interacting with ResourcePool persistent storage

func NewStore

func NewStore() Store

NewStore creates a ResourcePool store

type VirtualIP

type VirtualIP struct {
	PoolID        string
	IP            string
	Netmask       string
	BindInterface string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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