Safe Haskell | None |
---|
DRBD proc file parser
This module holds the definition of the parser that extracts status information from the DRBD proc file.
Synopsis
- skipSpaces :: Parser ()
- skipSpacesAndString :: Text -> Parser a -> Parser a
- isBadEndOfLine :: Char -> Bool
- optional :: Parser a -> Parser (Maybe a)
- drbdStatusParser :: [DrbdInstMinor] -> Parser DRBDStatus
- versionInfoParser :: Parser VersionInfo
- deviceParser :: [DrbdInstMinor] -> Parser DeviceInfo
- connStateParser :: Parser ConnState
- localRemoteParser :: Parser a -> Parser (LocalRemote a)
- roleParser :: Parser Role
- diskStateParser :: Parser DiskState
- ioFlagsParser :: Parser String
- perfIndicatorsParser :: Parser PerfIndicators
- syncStatusParser :: Parser SyncStatus
- statusBarParser :: Parser ()
- sizeUnitParser :: Parser SizeUnit
- timeParser :: Parser Time
- timeUnitParser :: Parser TimeUnit
- commaIntParser :: Parser Int
- commaIntHelper :: Int -> Parser Int
- additionalInfoParser :: Parser AdditionalInfo
Documentation
skipSpaces :: Parser () Source #
Our own space-skipping function, because A.skipSpace also skips newline characters. It skips ZERO or more spaces, so it does not fail if there are no spaces.
skipSpacesAndString :: Text -> Parser a -> Parser a Source #
Skips spaces and the given string, then executes a parser and returns its result.
isBadEndOfLine :: Char -> Bool Source #
Predicate verifying (potentially bad) end of lines
optional :: Parser a -> Parser (Maybe a) Source #
Takes a parser and returns it with the content wrapped in a Maybe object. The resulting parser never fails, but contains Nothing if it couldn't properly parse the string.
drbdStatusParser :: [DrbdInstMinor] -> Parser DRBDStatus Source #
The parser for a whole DRBD status file.
versionInfoParser :: Parser VersionInfo Source #
The parser for the version information lines.
deviceParser :: [DrbdInstMinor] -> Parser DeviceInfo Source #
The parser for a (multi-line) string representing a device.
connStateParser :: Parser ConnState Source #
The parser for the connection state.
localRemoteParser :: Parser a -> Parser (LocalRemote a) Source #
Parser for recognizing strings describing two elements of the
same type separated by a /
. The first one is considered local,
the second remote.
roleParser :: Parser Role Source #
The parser for resource roles.
diskStateParser :: Parser DiskState Source #
The parser for disk states.
ioFlagsParser :: Parser String Source #
The parser for I/O flags.
perfIndicatorsParser :: Parser PerfIndicators Source #
The parser for performance indicators.
syncStatusParser :: Parser SyncStatus Source #
The parser for the syncronization status.
statusBarParser :: Parser () Source #
The parser for recognizing (and discarding) the sync status bar.
sizeUnitParser :: Parser SizeUnit Source #
The parser for recognizing data size units (only the ones actually found in DRBD files are implemented).
timeParser :: Parser Time Source #
The parser for recognizing time (hh:mm:ss).
timeUnitParser :: Parser TimeUnit Source #
The parser for recognizing time units (only the ones actually found in DRBD files are implemented).
commaIntParser :: Parser Int Source #
Haskell does not recognise ',' as the thousands separator every 3 digits but DRBD uses it, so we need an ah-hoc parser. If a number beginning with more than 3 digits without a comma is parsed, only the first 3 digits are considered to be valid, the rest is not consumed, and left for further parsing.
commaIntHelper :: Int -> Parser Int Source #
Helper (triplet parser) for the commaIntParser
additionalInfoParser :: Parser AdditionalInfo Source #
Parser for the additional information provided by DRBD <= 8.0.