Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Ganeti.HTools.Cluster.AllocationSolution
Description
Implementation of handling of Allocation Solutions
Synopsis
- type GenericAllocElement a = (List, Instance, [Node], a)
- type AllocElement = GenericAllocElement Score
- data GenericAllocSolution a = AllocSolution {
- asFailures :: [FailMode]
- asAllocs :: Int
- asSolution :: Maybe (GenericAllocElement a)
- asLog :: [String]
- type AllocSolution = GenericAllocSolution Score
- emptyAllocSolution :: GenericAllocSolution a
- sumAllocs :: Ord a => GenericAllocSolution a -> GenericAllocSolution a -> GenericAllocSolution a
- concatAllocs :: Ord a => GenericAllocSolution a -> OpResult (GenericAllocElement a) -> GenericAllocSolution a
- updateIl :: List -> Maybe (GenericAllocElement a) -> List
- extractNl :: List -> List -> Maybe (GenericAllocElement a) -> List
- collapseFailures :: [FailMode] -> FailStats
- genericAnnotateSolution :: (a -> String) -> GenericAllocSolution a -> GenericAllocSolution a
- annotateSolution :: AllocSolution -> AllocSolution
- solutionDescription :: (Group, Result (GenericAllocSolution a)) -> [String]
- data AllocSolutionCollection a
- emptyAllocCollection :: AllocSolutionCollection a
- concatAllocCollections :: Ord a => AllocSolutionCollection a -> OpResult (GenericAllocElement a) -> AllocSolutionCollection a
- collectionToSolution :: Ord a => FailMode -> (GenericAllocElement a -> Bool) -> AllocSolutionCollection a -> GenericAllocSolution a
Documentation
type GenericAllocElement a = (List, Instance, [Node], a) #
A simple name for an allocation element (here just for logistic reasons), generic in the type of the metric.
type AllocElement = GenericAllocElement Score #
A simple name for an allocation element (here just for logistic reasons).
data GenericAllocSolution a #
Allocation/relocation solution.
Constructors
AllocSolution | |
Fields
|
type AllocSolution = GenericAllocSolution Score #
emptyAllocSolution :: GenericAllocSolution a #
The empty solution we start with when computing allocations.
sumAllocs :: Ord a => GenericAllocSolution a -> GenericAllocSolution a -> GenericAllocSolution a #
Sums two GenericAllocSolution
structures.
concatAllocs :: Ord a => GenericAllocSolution a -> OpResult (GenericAllocElement a) -> GenericAllocSolution a #
Update current Allocation solution and failure stats with new elements.
Arguments
:: List | The original instance list |
-> Maybe (GenericAllocElement a) | The result of the allocation attempt |
-> List | The updated instance list |
Calculate the new instance list after allocation solution.
Arguments
:: List | The original node list |
-> List | The original instance list |
-> Maybe (GenericAllocElement a) | The result of the allocation attempt |
-> List | The new node list |
Extract the the new node list from the allocation solution.
collapseFailures :: [FailMode] -> FailStats #
Build failure stats out of a list of failures.
genericAnnotateSolution :: (a -> String) -> GenericAllocSolution a -> GenericAllocSolution a #
Annotates a solution with the appropriate string.
annotateSolution :: AllocSolution -> AllocSolution #
Annotate a solution based on the standard metrics
solutionDescription :: (Group, Result (GenericAllocSolution a)) -> [String] #
Given a group/result, describe it as a nice (list of) messages.
data AllocSolutionCollection a #
Collection of Allocation Solution
emptyAllocCollection :: AllocSolutionCollection a #
Empty collection of allocation solutions.
concatAllocCollections :: Ord a => AllocSolutionCollection a -> OpResult (GenericAllocElement a) -> AllocSolutionCollection a #
Update current collection of solution and failure stats with new elements.
Arguments
:: Ord a | |
=> FailMode | Failure mode to assign to solutions filtered out in this step |
-> (GenericAllocElement a -> Bool) | predicate to restrict to |
-> AllocSolutionCollection a | |
-> GenericAllocSolution a |
From a collection of solutions collapse to a single one by chosing the best that fulfills a given predicate.