ganeti-htoolsSource codeContentsIndex
Ganeti.HTools.Container
Description

Module abstracting the node and instance container implementation.

This is currently implemented on top of an IntMap, which seems to give the best performance for our workload.

Synopsis
type Key = Key
type Container = IntMap
empty :: Container a
size :: Container a -> Int
find :: Key -> Container a -> a
add :: Key -> a -> Container a -> Container a
remove :: Key -> Container a -> Container a
elems :: Container a -> [a]
keys :: Container a -> [Key]
fromAssocList :: [(Key, a)] -> Container a
addTwo :: Key -> a -> Key -> a -> Container a -> Container a
nameOf :: Element a => Container a -> Key -> String
findByName :: (Element a, Monad m) => Container a -> String -> m a
Documentation
type Key = KeySource
type Container = IntMapSource
empty :: Container aSource
Create an empty container.
size :: Container a -> IntSource
Returns the number of elements in the map.
find :: Key -> Container a -> aSource
Locate a key in the map (must exist).
add :: Key -> a -> Container a -> Container aSource
Add or update one element to the map.
remove :: Key -> Container a -> Container aSource
Remove an element from the map.
elems :: Container a -> [a]Source
Return the list of values in the map.
keys :: Container a -> [Key]Source
Return the list of keys in the map.
fromAssocList :: [(Key, a)] -> Container aSource
Create a map from an association list.
addTwo :: Key -> a -> Key -> a -> Container a -> Container aSource
Add or update two elements of the map.
nameOf :: Element a => Container a -> Key -> StringSource
Compute the name of an element in a container.
findByName :: (Element a, Monad m) => Container a -> String -> m aSource
Find an element by name in a Container; this is a very slow function.
Produced by Haddock version 2.6.0