Copyright | (c) 2020-2021 Tim Emiola |
---|---|
License | BSD3 |
Maintainer | Tim Emiola <adetokunbo@users.noreply.github.com > |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Provides an instance of Proc
that launches ZipKin
as a tmp proc
.
The instance this module provides can be used in integration tests as is.
It's also possible to write other instances that launch ZipKin
in different
ways; for those, this instance can be used as a reference example.
Synopsis
- data TmpZipkin = TmpZipkin
- aProc :: HList '[TmpZipkin]
- aHandle :: IO (HandlesOf '[TmpZipkin])
- withTmpConn :: Connectable a => ProcHandle a -> (Conn a -> IO b) -> IO b
- toPinged :: Exception e => Proxy e -> IO a -> IO Pinged
- startupAll :: forall (procs :: [Type]). AreProcs procs => HList procs -> IO (HandlesOf procs)
- data ProcHandle a = ProcHandle {}
- type family Conn a = (conn :: Type) | conn -> a
- class Proc a => Connectable a where
- type family Name a = (labelName :: Symbol) | labelName -> a
- type family Image a :: Symbol
- class (KnownSymbol (Image a), KnownSymbol (Name a)) => Proc a where
- data Pinged
- = OK
- | NotOK
- | PingFailed Text
- type HostIpAddress = Text
- type SvcURI = ByteString
- type HandlesOf (procs :: [Type]) = HList (Proc2Handle procs)
- only :: x -> HList '[x]
- data HList (a :: [Type]) where
Proc
instance
Provides the capability to launch a Zipkin instance as a tmp proc
.
Instances
Connectable TmpZipkin Source # | Specifies how to connect to a tmp In this case, there is not really a connection type, but |
Proc TmpZipkin Source # | Specifies how to run |
type Conn TmpZipkin Source # | |
Defined in System.TmpProc.Docker.Zipkin | |
type Image TmpZipkin Source # | |
Defined in System.TmpProc.Docker.Zipkin | |
type Name TmpZipkin Source # | |
Defined in System.TmpProc.Docker.Zipkin |
Useful definitions
Re-exports
withTmpConn :: Connectable a => ProcHandle a -> (Conn a -> IO b) -> IO b #
Run an action on a Connectable
handle as a callback on its Conn
toPinged :: Exception e => Proxy e -> IO a -> IO Pinged #
Use an action that might throw an exception as a ping.
startupAll :: forall (procs :: [Type]). AreProcs procs => HList procs -> IO (HandlesOf procs) #
Start up processes for each Proc
type.
class Proc a => Connectable a where #
Specifies how to a get a connection to a Proc
.
openConn :: ProcHandle a -> IO (Conn a) #
Get a connection to the Proc via its ProcHandle
.
closeConn :: Conn a -> IO () #
Close a connection to a Proc
.
Instances
Connectable TmpZipkin Source # | Specifies how to connect to a tmp In this case, there is not really a connection type, but |
type family Name a = (labelName :: Symbol) | labelName -> a #
A label used to refer to running process created from this image, e.g, a-postgres-db
class (KnownSymbol (Image a), KnownSymbol (Name a)) => Proc a where #
Specifies how to launch a temporary process using Docker.
The image name of the docker image, e.g, postgres:10.6
type Name a = (labelName :: Symbol) | labelName -> a #
A label used to refer to running process created from this image, e.g, a-postgres-db
Additional arguments to the docker command that launches the tmp proc.
uriOf :: HostIpAddress -> SvcURI #
Determines the service URI of the process, when applicable.
reset :: ProcHandle a -> IO () #
Resets some state in a tmp proc service.
ping :: ProcHandle a -> IO Pinged #
Checks if the tmp proc started ok.
Maximum number of pings to perform during startup.
Number of milliseconds between pings.
Indicates the result of pinging a Proc
.
If the ping succeeds, ping
should return OK
.
ping
should catch any exceptions that are expected when the
service
is not available and return Proc
sNotOK
.
startupAll
uses PingFailed
to report any unexpected exceptions that escape
ping
.
OK | The service is running OK. |
NotOK | The service is not running. |
PingFailed Text | Contact to the service failed unexpectedly. |
type HostIpAddress = Text #
The IP address of the docker host.
type SvcURI = ByteString #
A connection string used to access the service once its running.
type HandlesOf (procs :: [Type]) = HList (Proc2Handle procs) #
A list of
values.ProcHandle
data HList (a :: [Type]) where #
Defines a Heterogenous list.
HNil :: HList ('[] :: [Type]) | |
HCons :: forall anyTy (manyTys :: [Type]). anyTy -> HList manyTys -> HList (anyTy ': manyTys) infixr 5 |