data_manager

package
v2.2.21+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionExpiredTime = 30 * 60 // Seconds
)

Variables

This section is empty.

Functions

func ReservedSubtract

func ReservedSubtract(key string, value value_t, reserved value_t) value_t

func ReservedSum

func ReservedSum(key string, values []value_t) value_t

func ToHostCandidate

func ToHostCandidate(c interface{}) (*candidatecache.HostDesc, error)

func ToHostCandidates

func ToHostCandidates(cs []interface{}) ([]*candidatecache.HostDesc, error)

Types

type BaremetalCandidateManagerImplProvider

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

func (*BaremetalCandidateManagerImplProvider) GetCandidate

func (p *BaremetalCandidateManagerImplProvider) GetCandidate(id string) (interface{}, error)

func (*BaremetalCandidateManagerImplProvider) LoadCandidates

func (p *BaremetalCandidateManagerImplProvider) LoadCandidates() ([]interface{}, error)

func (*BaremetalCandidateManagerImplProvider) ReloadAllCandidates

func (p *BaremetalCandidateManagerImplProvider) ReloadAllCandidates() ([]interface{}, error)

func (*BaremetalCandidateManagerImplProvider) ReloadCandidates

func (p *BaremetalCandidateManagerImplProvider) ReloadCandidates(
	ids []string) ([]interface{}, error)

type CandidateGetArgs

type CandidateGetArgs struct {
	ResType    string
	ZoneID     string
	PoolID     string
	IgnorePool bool
}

type CandidateIdMap

type CandidateIdMap map[string]int

type CandidateItem

type CandidateItem struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewCandidateItem

func NewCandidateItem(candidateID string) *CandidateItem

type CandidateManager

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

func NewCandidateManager

func NewCandidateManager(dataManager *DataManager, stopCh <-chan struct{}) *CandidateManager

func (*CandidateManager) AddImpl

func (cm *CandidateManager) AddImpl(name string, impl *CandidateManagerImpl)

func (*CandidateManager) CleanDirtyCandidatesOnce

func (cm *CandidateManager) CleanDirtyCandidatesOnce(keys []string)

func (*CandidateManager) DirtyPoolHas

func (cm *CandidateManager) DirtyPoolHas(id string) bool

func (*CandidateManager) GetCandidate

func (cm *CandidateManager) GetCandidate(id string, resType string) (interface{}, error)

func (*CandidateManager) GetCandidates

func (cm *CandidateManager) GetCandidates(args CandidateGetArgs) ([]core.Candidater, error)

func (*CandidateManager) GetCandidatesByIds

func (cm *CandidateManager) GetCandidatesByIds(resType string, ids []string) ([]core.Candidater, error)

func (*CandidateManager) GetData

func (cm *CandidateManager) GetData(name string) ([]interface{}, error)

func (*CandidateManager) Reload

func (cm *CandidateManager) Reload(resType string, candidateIds []string) (
	[]interface{}, error)

func (*CandidateManager) ReloadAll

func (cm *CandidateManager) ReloadAll(resType string) ([]interface{}, error)

func (*CandidateManager) Run

func (cm *CandidateManager) Run()

func (*CandidateManager) SetCandidatesDirty

func (cm *CandidateManager) SetCandidatesDirty(scs []*core.SelectedCandidate)

type CandidateManagerImpl

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

func NewCandidateManagerImpl

func NewCandidateManagerImpl(provider CandidateManagerImplProvider, stopCh <-chan struct{},
) *CandidateManagerImpl

func (*CandidateManagerImpl) GetCandidate

func (impl *CandidateManagerImpl) GetCandidate(id string) (interface{}, error)

func (*CandidateManagerImpl) GetCandidates

func (impl *CandidateManagerImpl) GetCandidates() ([]interface{}, error)

func (*CandidateManagerImpl) Reload

func (impl *CandidateManagerImpl) Reload(ids []string) ([]interface{}, error)

func (*CandidateManagerImpl) ReloadAll

func (impl *CandidateManagerImpl) ReloadAll() ([]interface{}, error)

func (*CandidateManagerImpl) Run

func (impl *CandidateManagerImpl) Run()

type CandidateManagerImplProvider

type CandidateManagerImplProvider interface {
	LoadCandidates() ([]interface{}, error)
	ReloadCandidates(ids []string) ([]interface{}, error)
	ReloadAllCandidates() ([]interface{}, error)
	GetCandidate(id string) (interface{}, error)
}

type DataManager

type DataManager struct {
	DBCacheGroup   cache.CacheGroup
	SyncCacheGroup cache.CacheGroup
	CandidateGroup cache.CacheGroup
}

func NewDataManager

func NewDataManager(stopCh <-chan struct{}) *DataManager

func (*DataManager) Run

func (m *DataManager) Run()

type DefaultResAlgorithm

type DefaultResAlgorithm struct {
}

func (*DefaultResAlgorithm) Subtract

func (al *DefaultResAlgorithm) Subtract(sum value_t, value value_t) value_t

func (*DefaultResAlgorithm) Sum

func (al *DefaultResAlgorithm) Sum(values []value_t) value_t

type GroupGuestRelation

type GroupGuestRelation struct {
	Data map[string]*candidatecache.GroupCount
}

type GroupResAlgorithm

type GroupResAlgorithm struct {
}

func (*GroupResAlgorithm) Subtract

func (al *GroupResAlgorithm) Subtract(sum value_t, value value_t) value_t

func (*GroupResAlgorithm) Sum

func (al *GroupResAlgorithm) Sum(values []value_t) value_t

type GroupResAlgorithmResult

type GroupResAlgorithmResult struct {
	Groups []*candidatecache.GroupCounts
}

func NewGroupResAlgorithmResult

func NewGroupResAlgorithmResult() *GroupResAlgorithmResult

func (*GroupResAlgorithmResult) ExistsGroup

func (r *GroupResAlgorithmResult) ExistsGroup(groupId string) bool

func (*GroupResAlgorithmResult) GuestCountOfGroup

func (r *GroupResAlgorithmResult) GuestCountOfGroup(groupId string) int64

type HostCandidateManagerImplProvider

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

func (*HostCandidateManagerImplProvider) GetCandidate

func (p *HostCandidateManagerImplProvider) GetCandidate(id string) (interface{}, error)

func (*HostCandidateManagerImplProvider) LoadCandidates

func (p *HostCandidateManagerImplProvider) LoadCandidates() ([]interface{}, error)

func (*HostCandidateManagerImplProvider) ReloadAllCandidates

func (p *HostCandidateManagerImplProvider) ReloadAllCandidates() ([]interface{}, error)

func (*HostCandidateManagerImplProvider) ReloadCandidates

func (p *HostCandidateManagerImplProvider) ReloadCandidates(
	ids []string) ([]interface{}, error)

type IsolatedDeviceResAlgorithm

type IsolatedDeviceResAlgorithm struct {
}

func (*IsolatedDeviceResAlgorithm) Subtract

func (al *IsolatedDeviceResAlgorithm) Subtract(sum value_t, value value_t) value_t

func (*IsolatedDeviceResAlgorithm) Sum

func (a *IsolatedDeviceResAlgorithm) Sum(values []value_t) value_t

type IsolatedDeviceResAlgorithmResult

type IsolatedDeviceResAlgorithmResult struct {
	IDs map[string]int
}

type KeyValue

type KeyValue interface {
	Get(key string) interface{}
}

type NetworkManager

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

func NewNetworkManager

func NewNetworkManager(dataManager *DataManager, reservedPoolManager *ReservedPoolManager) *NetworkManager

func (*NetworkManager) CleanVpc

func (m *NetworkManager) CleanVpc()

func (*NetworkManager) ExistsVpcNetwork

func (m *NetworkManager) ExistsVpcNetwork(networkId, candidateId string,
) *synccache.SchedNetworkBuildResult

func (*NetworkManager) GetReservecPorts

func (m *NetworkManager) GetReservecPorts(id string) int64

func (*NetworkManager) GetVpcNetwork

func (m *NetworkManager) GetVpcNetwork(networkId string) *VpcNetwork

func (*NetworkManager) IsUnknown

func (m *NetworkManager) IsUnknown(id string) bool

func (*NetworkManager) LoadUnknownNetworks

func (m *NetworkManager) LoadUnknownNetworks(ids []string)

type NetworksResAlgorithm

type NetworksResAlgorithm struct {
}

func (*NetworksResAlgorithm) Subtract

func (a *NetworksResAlgorithm) Subtract(sum value_t, value value_t) value_t

func (*NetworksResAlgorithm) Sum

func (a *NetworksResAlgorithm) Sum(values []value_t) value_t

type NetworksResAlgorithmResult

type NetworksResAlgorithmResult struct {
	Networks map[string]int
}

type ResAlgorithm

type ResAlgorithm interface {
	Sum(values []value_t) value_t
	Subtract(sum value_t, value value_t) value_t
}

func GetResAlgorithm

func GetResAlgorithm(res_name string) ResAlgorithm

type ReservedItem

type ReservedItem struct {
	CandidateId string

	sync.RWMutex
	// contains filtered or unexported fields
}

ReservedItem

func NewReservedItem

func NewReservedItem(candidateID string) *ReservedItem

func (*ReservedItem) Get

func (item *ReservedItem) Get(key string, def_value value_t) value_t

func (*ReservedItem) GetAll

func (item *ReservedItem) GetAll() (values map[string]interface{})

func (*ReservedItem) Set

func (item *ReservedItem) Set(key string, value value_t)

func (*ReservedItem) SetAll

func (item *ReservedItem) SetAll(values map[string]interface{})

func (*ReservedItem) ToDict

func (item *ReservedItem) ToDict() map[string]interface{}

type ReservedPool

type ReservedPool struct {
	Name string

	sync.RWMutex
	// contains filtered or unexported fields
}

func NewReservedPool

func NewReservedPool(name string, stopCh <-chan struct{}) *ReservedPool

func (*ReservedPool) Add

func (pool *ReservedPool) Add(sessionID string, candidateID string,
	reservedItem *ReservedItem)

func (*ReservedPool) GetReservedItem

func (pool *ReservedPool) GetReservedItem(candidateID string) *ReservedItem

func (*ReservedPool) GetSessionItem

func (pool *ReservedPool) GetSessionItem(sessionID string) *SessionItem

func (*ReservedPool) InSession

func (pool *ReservedPool) InSession(candidateId string) bool

func (*ReservedPool) RemoveSession

func (pool *ReservedPool) RemoveSession(sessionID string) bool

func (*ReservedPool) Start

func (pool *ReservedPool) Start()

func (*ReservedPool) ToDict

func (pool *ReservedPool) ToDict() interface{}

type ReservedPoolManager

type ReservedPoolManager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Reserved pool manager is mainly to cloud resources to do state updates, currently divided into host, baemetal there are three network resources management.

func NewReservedPoolManager

func NewReservedPoolManager(stopCh <-chan struct{}) *ReservedPoolManager

func (*ReservedPoolManager) GetPool

func (pm *ReservedPoolManager) GetPool(name string) (*ReservedPool, error)

func (*ReservedPoolManager) InSession

func (pm *ReservedPoolManager) InSession(resType string, candidateId string) bool

func (*ReservedPoolManager) RemoveSession

func (pm *ReservedPoolManager) RemoveSession(sessionId string) bool

func (*ReservedPoolManager) SearchReservedPoolBySessionID

func (pm *ReservedPoolManager) SearchReservedPoolBySessionID(sessionId string) (
	*ReservedPool, error)

type SessionItem

type SessionItem struct {
	Time time.Time

	sync.RWMutex
	// contains filtered or unexported fields
}

func NewSessionItem

func NewSessionItem() *SessionItem

func (*SessionItem) AllCandidateIDs

func (si *SessionItem) AllCandidateIDs() []string

func (*SessionItem) ToDict

func (si *SessionItem) ToDict() map[string]interface{}

type VpcNetwork

type VpcNetwork struct {
	Data    CandidateIdMap
	Network *synccache.SchedNetworkBuildResult
}

func NewVpcNetwork

func NewVpcNetwork() *VpcNetwork

type VpcNetworks

type VpcNetworks struct {
	Data map[string]*VpcNetwork
	// contains filtered or unexported fields
}

func NewVpcNetworks

func NewVpcNetworks() *VpcNetworks

func (*VpcNetworks) Append

func (vns *VpcNetworks) Append(candidateId string,
	networks []*synccache.SchedNetworkBuildResult)

func (*VpcNetworks) Exists

func (vns *VpcNetworks) Exists(networkId, candidateId string,
) *synccache.SchedNetworkBuildResult

func (*VpcNetworks) Get

func (vns *VpcNetworks) Get(networkId string) *VpcNetwork

Jump to

Keyboard shortcuts

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