ganeti-3.1: Cluster-based virtualization management software
Safe HaskellSafe-Inferred
LanguageHaskell2010

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

Types

type Container = IntMap #

Our container type.

type Key = Key #

Our key type.

Creation

empty :: IntMap a #

singleton :: Key -> a -> IntMap a #

fromList :: [(Key, a)] -> IntMap a #

Query

size :: IntMap a -> Int #

null :: IntMap a -> Bool #

find :: Key -> Container a -> a #

Locate a key in the map (must exist).

findMax :: IntMap a -> (Key, a) #

member :: Key -> IntMap a -> Bool #

lookup :: Key -> IntMap a -> Maybe a #

Update

add :: Key -> a -> Container a -> Container a #

Add or update one element to the map.

addTwo :: Key -> a -> Key -> a -> Container a -> Container a #

Add or update two elements of the map.

map :: (a -> b) -> IntMap a -> IntMap b #

mapAccum :: (a -> b -> (a, c)) -> a -> IntMap b -> (a, IntMap c) #

filter :: (a -> Bool) -> IntMap a -> IntMap a #

Conversion

elems :: IntMap a -> [a] #

keys :: IntMap a -> [Key] #

Element functions

nameOf :: Element a => Container a -> Key -> String #

Compute the name of an element in a container.

findByName :: (Element a, MonadFail m) => Container a -> String -> m a #

Find an element by name in a Container; this is a very slow function.