tar-conduit-0.3.2.1: Extract and create tar files using conduit for streaming

Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.Conduit.Tar.Types

Description

Module contains all the types necessary for tarball processing.

Synopsis

- data Header = Header {
  - headerOffset :: !FileOffset
  - headerPayloadOffset :: !FileOffset
  - headerFileNameSuffix :: !ShortByteString
  - headerFileMode :: !CMode
  - headerOwnerId :: !UserID
  - headerGroupId :: !GroupID
  - headerPayloadSize :: !FileOffset
  - headerTime :: !EpochTime
  - headerLinkIndicator :: !Word8
  - headerLinkName :: !ShortByteString
  - headerMagicVersion :: !ShortByteString
  - headerOwnerName :: !ShortByteString
  - headerGroupName :: !ShortByteString
  - headerDeviceMajor :: !DeviceID
  - headerDeviceMinor :: !DeviceID
  - headerFileNamePrefix :: !ShortByteString
  }
- data TarChunk
  - = ChunkHeader Header
  - | ChunkPayload !FileOffset !ByteString
  - | ChunkException TarException
- data TarException
  - = NoMoreHeaders
  - | UnexpectedPayload !FileOffset
  - | IncompleteHeader !FileOffset
  - | IncompletePayload !FileOffset !ByteCount
  - | ShortTrailer !FileOffset
  - | BadTrailer !FileOffset
  - | InvalidHeader !FileOffset
  - | BadChecksum !FileOffset
  - | FileTypeError !FileOffset !Char !String
  - | UnsupportedType !FileType
- data TarCreateException
  - = FileNameTooLong !FileInfo
  - | TarCreationError !String
- data FileType
  - = FTNormal
  - | FTHardLink !ByteString
  - | FTSymbolicLink !ByteString
  - | FTCharacterSpecial
  - | FTBlockSpecial
  - | FTDirectory
  - | FTFifo
  - | FTOther !Word8
- data FileInfo = FileInfo {
  - filePath :: !ByteString
  - fileUserId :: !UserID
  - fileUserName :: !ByteString
  - fileGroupId :: !GroupID
  - fileGroupName :: !ByteString
  - fileMode :: !FileMode
  - fileSize :: !FileOffset
  - fileType :: !FileType
  - fileModTime :: !EpochTime
  }
- type FileOffset = COff
- type ByteCount = CSize
- type UserID = CUid
- type GroupID = CGid
- type DeviceID = CDev
- type EpochTime = CTime
- newtype CUid = CUid Word32
- newtype CGid = CGid Word32
- encodeFilePath :: FilePath -> ByteString
- decodeFilePath :: ByteString -> FilePath
- getFileInfoPath :: FileInfo -> FilePath

# Documentation

data Header Source #

Constructors

Header |

Fields

- headerOffset :: !FileOffset
- headerPayloadOffset :: !FileOffset
- headerFileNameSuffix :: !ShortByteString
- headerFileMode :: !CMode
- headerOwnerId :: !UserID
- headerGroupId :: !GroupID
- headerPayloadSize :: !FileOffset
- headerTime :: !EpochTime
- headerLinkIndicator :: !Word8
- headerLinkName :: !ShortByteString
- headerMagicVersion :: !ShortByteString
- headerOwnerName :: !ShortByteString
- headerGroupName :: !ShortByteString
- headerDeviceMajor :: !DeviceID
- headerDeviceMinor :: !DeviceID
- headerFileNamePrefix :: !ShortByteString

#### Instances

Instances details

Show Header Source # |
Instance details Defined in Data.Conduit.Tar.Types Methods showsPrec :: Int -> Header -> ShowS Source # show :: Header -> String Source # showList :: [Header] -> ShowS Source #

data TarChunk Source #

Constructors

ChunkHeader Header |
ChunkPayload !FileOffset !ByteString |
ChunkException TarException |

#### Instances

Instances details

Show TarChunk Source # |
Instance details Defined in Data.Conduit.Tar.Types Methods showsPrec :: Int -> TarChunk -> ShowS Source # show :: TarChunk -> String Source # showList :: [TarChunk] -> ShowS Source #

data TarException Source #

This the the exception type that is used in this module.

More constructors are susceptible to be added without bumping the major version of this module.

Constructors

NoMoreHeaders |
UnexpectedPayload !FileOffset |
IncompleteHeader !FileOffset |
IncompletePayload !FileOffset !ByteCount |
ShortTrailer !FileOffset |
BadTrailer !FileOffset |
InvalidHeader !FileOffset |
BadChecksum !FileOffset |
FileTypeError !FileOffset !Char !String |
UnsupportedType !FileType |

#### Instances

Instances details

Exception TarException Source # |
Instance details Defined in Data.Conduit.Tar.Types Methods toException :: TarException -> SomeException Source # fromException :: SomeException -> Maybe TarException Source # displayException :: TarException -> String Source #
Show TarException Source # |
Instance details Defined in Data.Conduit.Tar.Types Methods showsPrec :: Int -> TarException -> ShowS Source # show :: TarException -> String Source # showList :: [TarException] -> ShowS Source #

data TarCreateException Source #

Constructors

FileNameTooLong !FileInfo |
TarCreationError !String |

#### Instances

Instances details

Exception TarCreateException Source # |
Instance details Defined in Data.Conduit.Tar.Types Methods toException :: TarCreateException -> SomeException Source # fromException :: SomeException -> Maybe TarCreateException Source # displayException :: TarCreateException -> String Source #
Show TarCreateException Source # |
Instance details Defined in Data.Conduit.Tar.Types Methods showsPrec :: Int -> TarCreateException -> ShowS Source # show :: TarCreateException -> String Source # showList :: [TarCreateException] -> ShowS Source #

data FileType Source #

Constructors

FTNormal |
FTHardLink !ByteString |
FTSymbolicLink !ByteString |
FTCharacterSpecial |
FTBlockSpecial |
FTDirectory |
FTFifo |
FTOther !Word8 |

#### Instances

Instances details

Show FileType Source # |
Instance details Defined in Data.Conduit.Tar.Types Methods showsPrec :: Int -> FileType -> ShowS Source # show :: FileType -> String Source # showList :: [FileType] -> ShowS Source #
Eq FileType Source # |
Instance details Defined in Data.Conduit.Tar.Types Methods (==) :: FileType -> FileType -> Bool Source # (/=) :: FileType -> FileType -> Bool Source #

data FileInfo Source #

Constructors

FileInfo |

Fields

- filePath :: !ByteString

  File path.

- fileUserId :: !UserID

  Unix user id.

- fileUserName :: !ByteString

  Unix user name.

- fileGroupId :: !GroupID

  Unix group id.

- fileGroupName :: !ByteString

  Unix group name.

- fileMode :: !FileMode

  Unix file permissions

- fileSize :: !FileOffset

  File size

- fileType :: !FileType

  File type. `FTNormal`, `FTHardLink` (@since 0.3.0), `FTSymbolicLink` and `FTDirectory` are the only ones supported for now

- fileModTime :: !EpochTime

  File modification timestamp

#### Instances

Instances details

Show FileInfo Source # |
Instance details Defined in Data.Conduit.Tar.Types Methods showsPrec :: Int -> FileInfo -> ShowS Source # show :: FileInfo -> String Source # showList :: [FileInfo] -> ShowS Source #
Eq FileInfo Source # |
Instance details Defined in Data.Conduit.Tar.Types Methods (==) :: FileInfo -> FileInfo -> Bool Source # (/=) :: FileInfo -> FileInfo -> Bool Source #

type FileOffset = COff Source #

type ByteCount = CSize Source #

type UserID = CUid Source #

type GroupID = CGid Source #

type DeviceID = CDev Source #

type EpochTime = CTime Source #

newtype CUid Source #

Constructors

CUid Word32 |

#### Instances

Instances details

Storable CUid |

Instance details

Defined in System.Posix.Types

Methods

sizeOf :: CUid -> Int Source #

alignment :: CUid -> Int Source #

peekElemOff :: Ptr CUid -> Int -> IO CUid Source #

pokeElemOff :: Ptr CUid -> Int -> CUid -> IO () Source #

peekByteOff :: Ptr b -> Int -> IO CUid Source #

pokeByteOff :: Ptr b -> Int -> CUid -> IO () Source #

peek :: Ptr CUid -> IO CUid Source #

poke :: Ptr CUid -> CUid -> IO () Source #

Bits CUid |

Instance details

Defined in System.Posix.Types

Methods

(.&.) :: CUid -> CUid -> CUid Source #

(.|.) :: CUid -> CUid -> CUid Source #

xor :: CUid -> CUid -> CUid Source #

complement :: CUid -> CUid Source #

shift :: CUid -> Int -> CUid Source #

rotate :: CUid -> Int -> CUid Source #

zeroBits :: CUid Source #

bit :: Int -> CUid Source #

setBit :: CUid -> Int -> CUid Source #

clearBit :: CUid -> Int -> CUid Source #

complementBit :: CUid -> Int -> CUid Source #

testBit :: CUid -> Int -> Bool Source #

bitSizeMaybe :: CUid -> Maybe Int Source #

bitSize :: CUid -> Int Source #

isSigned :: CUid -> Bool Source #

shiftL :: CUid -> Int -> CUid Source #

unsafeShiftL :: CUid -> Int -> CUid Source #

shiftR :: CUid -> Int -> CUid Source #

unsafeShiftR :: CUid -> Int -> CUid Source #

rotateL :: CUid -> Int -> CUid Source #

rotateR :: CUid -> Int -> CUid Source #

popCount :: CUid -> Int Source #

FiniteBits CUid |
Instance details Defined in System.Posix.Types Methods finiteBitSize :: CUid -> Int Source # countLeadingZeros :: CUid -> Int Source # countTrailingZeros :: CUid -> Int Source #
Bounded CUid |
Instance details Defined in System.Posix.Types Methods minBound :: CUid Source # maxBound :: CUid Source #
Enum CUid |
Instance details Defined in System.Posix.Types Methods succ :: CUid -> CUid Source # pred :: CUid -> CUid Source # toEnum :: Int -> CUid Source # fromEnum :: CUid -> Int Source # enumFrom :: CUid -> [CUid] Source # enumFromThen :: CUid -> CUid -> [CUid] Source # enumFromTo :: CUid -> CUid -> [CUid] Source # enumFromThenTo :: CUid -> CUid -> CUid -> [CUid] Source #
Ix CUid |
Instance details Defined in System.Posix.Types Methods range :: (CUid, CUid) -> [CUid] Source # index :: (CUid, CUid) -> CUid -> Int Source # unsafeIndex :: (CUid, CUid) -> CUid -> Int Source # inRange :: (CUid, CUid) -> CUid -> Bool Source # rangeSize :: (CUid, CUid) -> Int Source # unsafeRangeSize :: (CUid, CUid) -> Int Source #
Num CUid |
Instance details Defined in System.Posix.Types Methods (+) :: CUid -> CUid -> CUid Source # (-) :: CUid -> CUid -> CUid Source # (*) :: CUid -> CUid -> CUid Source # negate :: CUid -> CUid Source # abs :: CUid -> CUid Source # signum :: CUid -> CUid Source # fromInteger :: Integer -> CUid Source #
Read CUid |
Instance details Defined in System.Posix.Types Methods readsPrec :: Int -> ReadS CUid Source # readList :: ReadS [CUid] Source # readPrec :: ReadPrec CUid Source # readListPrec :: ReadPrec [CUid] Source #
Integral CUid |
Instance details Defined in System.Posix.Types Methods quot :: CUid -> CUid -> CUid Source # rem :: CUid -> CUid -> CUid Source # div :: CUid -> CUid -> CUid Source # mod :: CUid -> CUid -> CUid Source # quotRem :: CUid -> CUid -> (CUid, CUid) Source # divMod :: CUid -> CUid -> (CUid, CUid) Source # toInteger :: CUid -> Integer Source #
Real CUid |
Instance details Defined in System.Posix.Types Methods toRational :: CUid -> Rational Source #
Show CUid |
Instance details Defined in System.Posix.Types Methods showsPrec :: Int -> CUid -> ShowS Source # show :: CUid -> String Source # showList :: [CUid] -> ShowS Source #
Eq CUid |
Instance details Defined in System.Posix.Types Methods (==) :: CUid -> CUid -> Bool Source # (/=) :: CUid -> CUid -> Bool Source #
Ord CUid |
Instance details Defined in System.Posix.Types Methods compare :: CUid -> CUid -> Ordering Source # (<) :: CUid -> CUid -> Bool Source # (<=) :: CUid -> CUid -> Bool Source # (>) :: CUid -> CUid -> Bool Source # (>=) :: CUid -> CUid -> Bool Source # max :: CUid -> CUid -> CUid Source # min :: CUid -> CUid -> CUid Source #

newtype CGid Source #

Constructors

CGid Word32 |

#### Instances

Instances details

Storable CGid |

Instance details

Defined in System.Posix.Types

Methods

sizeOf :: CGid -> Int Source #

alignment :: CGid -> Int Source #

peekElemOff :: Ptr CGid -> Int -> IO CGid Source #

pokeElemOff :: Ptr CGid -> Int -> CGid -> IO () Source #

peekByteOff :: Ptr b -> Int -> IO CGid Source #

pokeByteOff :: Ptr b -> Int -> CGid -> IO () Source #

peek :: Ptr CGid -> IO CGid Source #

poke :: Ptr CGid -> CGid -> IO () Source #

Bits CGid |

Instance details

Defined in System.Posix.Types

Methods

(.&.) :: CGid -> CGid -> CGid Source #

(.|.) :: CGid -> CGid -> CGid Source #

xor :: CGid -> CGid -> CGid Source #

complement :: CGid -> CGid Source #

shift :: CGid -> Int -> CGid Source #

rotate :: CGid -> Int -> CGid Source #

zeroBits :: CGid Source #

bit :: Int -> CGid Source #

setBit :: CGid -> Int -> CGid Source #

clearBit :: CGid -> Int -> CGid Source #

complementBit :: CGid -> Int -> CGid Source #

testBit :: CGid -> Int -> Bool Source #

bitSizeMaybe :: CGid -> Maybe Int Source #

bitSize :: CGid -> Int Source #

isSigned :: CGid -> Bool Source #

shiftL :: CGid -> Int -> CGid Source #

unsafeShiftL :: CGid -> Int -> CGid Source #

shiftR :: CGid -> Int -> CGid Source #

unsafeShiftR :: CGid -> Int -> CGid Source #

rotateL :: CGid -> Int -> CGid Source #

rotateR :: CGid -> Int -> CGid Source #

popCount :: CGid -> Int Source #

FiniteBits CGid |
Instance details Defined in System.Posix.Types Methods finiteBitSize :: CGid -> Int Source # countLeadingZeros :: CGid -> Int Source # countTrailingZeros :: CGid -> Int Source #
Bounded CGid |
Instance details Defined in System.Posix.Types Methods minBound :: CGid Source # maxBound :: CGid Source #
Enum CGid |
Instance details Defined in System.Posix.Types Methods succ :: CGid -> CGid Source # pred :: CGid -> CGid Source # toEnum :: Int -> CGid Source # fromEnum :: CGid -> Int Source # enumFrom :: CGid -> [CGid] Source # enumFromThen :: CGid -> CGid -> [CGid] Source # enumFromTo :: CGid -> CGid -> [CGid] Source # enumFromThenTo :: CGid -> CGid -> CGid -> [CGid] Source #
Ix CGid |
Instance details Defined in System.Posix.Types Methods range :: (CGid, CGid) -> [CGid] Source # index :: (CGid, CGid) -> CGid -> Int Source # unsafeIndex :: (CGid, CGid) -> CGid -> Int Source # inRange :: (CGid, CGid) -> CGid -> Bool Source # rangeSize :: (CGid, CGid) -> Int Source # unsafeRangeSize :: (CGid, CGid) -> Int Source #
Num CGid |
Instance details Defined in System.Posix.Types Methods (+) :: CGid -> CGid -> CGid Source # (-) :: CGid -> CGid -> CGid Source # (*) :: CGid -> CGid -> CGid Source # negate :: CGid -> CGid Source # abs :: CGid -> CGid Source # signum :: CGid -> CGid Source # fromInteger :: Integer -> CGid Source #
Read CGid |
Instance details Defined in System.Posix.Types Methods readsPrec :: Int -> ReadS CGid Source # readList :: ReadS [CGid] Source # readPrec :: ReadPrec CGid Source # readListPrec :: ReadPrec [CGid] Source #
Integral CGid |
Instance details Defined in System.Posix.Types Methods quot :: CGid -> CGid -> CGid Source # rem :: CGid -> CGid -> CGid Source # div :: CGid -> CGid -> CGid Source # mod :: CGid -> CGid -> CGid Source # quotRem :: CGid -> CGid -> (CGid, CGid) Source # divMod :: CGid -> CGid -> (CGid, CGid) Source # toInteger :: CGid -> Integer Source #
Real CGid |
Instance details Defined in System.Posix.Types Methods toRational :: CGid -> Rational Source #
Show CGid |
Instance details Defined in System.Posix.Types Methods showsPrec :: Int -> CGid -> ShowS Source # show :: CGid -> String Source # showList :: [CGid] -> ShowS Source #
Eq CGid |
Instance details Defined in System.Posix.Types Methods (==) :: CGid -> CGid -> Bool Source # (/=) :: CGid -> CGid -> Bool Source #
Ord CGid |
Instance details Defined in System.Posix.Types Methods compare :: CGid -> CGid -> Ordering Source # (<) :: CGid -> CGid -> Bool Source # (<=) :: CGid -> CGid -> Bool Source # (>) :: CGid -> CGid -> Bool Source # (>=) :: CGid -> CGid -> Bool Source # max :: CGid -> CGid -> CGid Source # min :: CGid -> CGid -> CGid Source #

encodeFilePath :: FilePath -> ByteString Source #

Convert `FilePath` into a UTF-8 encoded `ByteString`

decodeFilePath :: ByteString -> FilePath Source #

Convert UTF-8 encoded `ByteString` back into the `FilePath`.

getFileInfoPath :: FileInfo -> FilePath Source #

Get the `FilePath`.