Safe Haskell | None |
---|---|
Language | Haskell2010 |
Util
contains various utility functions used throughout Docker.API.Client's internals.
Synopsis
- containerSpecToCreateContainer :: ContainerSpec -> CreateContainer
- readUpstream :: Monad m => ByteString -> Int -> ConduitT ByteString o m (Maybe ByteString)
- getStreamType :: ByteString -> DockerStreamType
- getSectionLength :: ByteString -> Int
- parseDockerStream :: ByteString -> (DockerStreamType, Int, ByteString)
- parseMultiplexedDockerStream :: MonadIO m => ConduitT ByteString (DockerStreamType, ByteString) m ()
- createLogTypeFilter :: ContainerLogType -> (DockerStreamType, a) -> Bool
- chownTarballContent :: UserID -> GroupID -> FileInfo -> FileInfo
Documentation
containerSpecToCreateContainer :: ContainerSpec -> CreateContainer Source #
(Internal only, do not export) Converts a client ContainerSpec into the format expected by the docker api
readUpstream :: Monad m => ByteString -> Int -> ConduitT ByteString o m (Maybe ByteString) Source #
Conduit helper which checks the length of the input bytestring and reads data from upstream until the length is at least nBytes. Note that this method may return a Bytestring result which has length >= nBytes.
getStreamType :: ByteString -> DockerStreamType Source #
Parses the first byte from a stream metadata bytestring returned by the Docker Engine API and returns the corresponding stream type.
getSectionLength :: ByteString -> Int Source #
Converts an 8 byte section length ByteString into an integer. This value indicates the number of data bytes in the body of a Docker Engine stream record.
parseDockerStream :: ByteString -> (DockerStreamType, Int, ByteString) Source #
Parses a docker metadata bytestring of length >= 8 into it's individual components See https://docs.docker.com/engine/api/v1.40/#operation/ContainerAttach
parseMultiplexedDockerStream :: MonadIO m => ConduitT ByteString (DockerStreamType, ByteString) m () Source #
Conduit for parsing a multiplexed stream from the Docker Engine API (e.g. the output of the attatch and logs endpoints). This will force memory usage up to the returned frame size (for docker logs this is usually just one line of text). See https://docs.docker.com/engine/api/v1.40/#operation/ContainerAttach for more details on this format.
createLogTypeFilter :: ContainerLogType -> (DockerStreamType, a) -> Bool Source #
Creates a DockerStreamType filter using the input ContainerLogType