ganeti
Safe HaskellNone

Ganeti.Network

Description

Implementation of the Ganeti network objects.

This is does not (yet) cover all methods that are provided in the corresponding python implementation (network.py).

Synopsis

Documentation

ipv4NumHosts :: Integral n => n -> Integer Source #

newPoolArray :: (MonadError e m, Error e) => Network -> m BitArray Source #

Creates a new bit array pool of the appropriate size

newPool :: (MonadError e m, Error e) => Network -> m AddressPool Source #

Creates a new bit array pool of the appropriate size

orNewPool :: (MonadError e m, Error e) => Network -> Maybe AddressPool -> m AddressPool Source #

A helper function that creates a bit array pool, of it's missing.

withPool :: (MonadError e m, Error e) => PoolPart -> (Network -> BitArray -> m (a, BitArray)) -> StateT Network m a Source #

withPool_ :: (MonadError e m, Error e) => PoolPart -> (Network -> BitArray -> m BitArray) -> Network -> m Network Source #

readPoolE :: (MonadError e m, Error e) => PoolPart -> Network -> m BitArray Source #

readAllE :: (MonadError e m, Error e) => Network -> m BitArray Source #

allReservations :: Network -> Maybe BitArray Source #

Get a bit vector of all reservations (internal and external) combined.

getReservedCount :: Network -> Int Source #

Get the count of reserved addresses.

getFreeCount :: Network -> Int Source #

Get the count of free addresses.

isFull :: Network -> Bool Source #

Check whether the network is full.

getMap :: Network -> String Source #

Return a textual representation of the network's occupation status.

Functions used for manipulating the reservations

addrIndex :: (MonadError e m, Error e) => Ip4Address -> Network -> m Int Source #

Returns an address index wrt a network. Fails if the address isn't in the network range.

addrAt :: (MonadError e m, Error e) => Int -> Network -> m Ip4Address Source #

Returns an address of a given index wrt a network. Fails if the index isn't in the network range.

isReserved :: (MonadError e m, Error e) => PoolPart -> Ip4Address -> Network -> m Bool Source #

Checks if a given address is reserved. Fails if the address isn't in the network range.

reserve :: (MonadError e m, Error e) => PoolPart -> Ip4Address -> Network -> m Network Source #

Marks an address as used.

release :: (MonadError e m, Error e) => PoolPart -> Ip4Address -> Network -> m Network Source #

Marks an address as unused.

findFree :: (MonadError e m, Error e) => (Ip4Address -> Bool) -> Network -> m (Maybe Ip4Address) Source #

Get the first free address in the network that satisfies a given predicate.