tmp-proc-zipkin-0.5.0.0: Shows how to run redis as a tmp proc
Copyright(c) 2020-2021 Tim Emiola
LicenseBSD3
MaintainerTim Emiola <adetokunbo@users.noreply.github.com >
Safe HaskellNone
LanguageHaskell2010

System.TmpProc.Docker.Zipkin

Description

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

Proc instance

data TmpZipkin Source #

Provides the capability to launch a Zipkin instance as a tmp proc.

Constructors

TmpZipkin 

Instances

Instances details
Connectable TmpZipkin Source #

Specifies how to connect to a tmp ZipKin service.

In this case, there is not really a connection type, but Zipkin provides a close analogue.

Instance details

Defined in System.TmpProc.Docker.Zipkin

Associated Types

type Conn TmpZipkin = (conn :: Type) #

Proc TmpZipkin Source #

Specifies how to run ZipKin as a tmp proc.

Instance details

Defined in System.TmpProc.Docker.Zipkin

Associated Types

type Image TmpZipkin :: Symbol #

type Name TmpZipkin = (labelName :: Symbol) #

type Conn TmpZipkin Source # 
Instance details

Defined in System.TmpProc.Docker.Zipkin

type Name TmpZipkin Source # 
Instance details

Defined in System.TmpProc.Docker.Zipkin

type Name TmpZipkin = "a-zipkin-server"
type Image TmpZipkin Source # 
Instance details

Defined in System.TmpProc.Docker.Zipkin

type Image TmpZipkin = "openzipkin/zipkin-slim"

Useful definitions

aProc :: HList '[TmpZipkin] Source #

A singleton HList containing a TmpZipkin.

aHandle :: IO (HandlesOf '[TmpZipkin]) Source #

An HList that just contains the handle created by aProc.

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.

data ProcHandle a #

Provides access to a Proc that has been started.

Constructors

ProcHandle 

Fields

type family Conn a = (conn :: Type) | conn -> a #

The connection type.

Instances

Instances details
type Conn TmpZipkin Source # 
Instance details

Defined in System.TmpProc.Docker.Zipkin

class Proc a => Connectable a where #

Specifies how to a get a connection to a Proc.

Minimal complete definition

openConn

Associated Types

type Conn a = (conn :: Type) | conn -> a #

The connection type.

Methods

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

Instances details
Connectable TmpZipkin Source #

Specifies how to connect to a tmp ZipKin service.

In this case, there is not really a connection type, but Zipkin provides a close analogue.

Instance details

Defined in System.TmpProc.Docker.Zipkin

Associated Types

type Conn TmpZipkin = (conn :: Type) #

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

Instances

Instances details
type Name TmpZipkin Source # 
Instance details

Defined in System.TmpProc.Docker.Zipkin

type Name TmpZipkin = "a-zipkin-server"

type family Image a :: Symbol #

The image name of the docker image, e.g, postgres:10.6

Instances

Instances details
type Image TmpZipkin Source # 
Instance details

Defined in System.TmpProc.Docker.Zipkin

type Image TmpZipkin = "openzipkin/zipkin-slim"

class (KnownSymbol (Image a), KnownSymbol (Name a)) => Proc a where #

Specifies how to launch a temporary process using Docker.

Minimal complete definition

uriOf, reset, ping

Associated Types

type Image a :: Symbol #

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

Methods

runArgs :: [Text] #

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.

pingCount :: Natural #

Maximum number of pings to perform during startup.

pingGap :: Natural #

Number of milliseconds between pings.

Instances

Instances details
Proc TmpZipkin Source #

Specifies how to run ZipKin as a tmp proc.

Instance details

Defined in System.TmpProc.Docker.Zipkin

Associated Types

type Image TmpZipkin :: Symbol #

type Name TmpZipkin = (labelName :: Symbol) #

data Pinged #

Indicates the result of pinging a Proc.

If the ping succeeds, ping2 should return OK.

ping2 should catch any exceptions that are expected when the Procs service is not available and return NotOK.

startupAll uses PingFailed to report any unexpected exceptions that escape ping2.

Constructors

OK

The service is running OK.

NotOK

The service is not running.

PingFailed Text

Contact to the service failed unexpectedly.

Instances

Instances details
Eq Pinged 
Instance details

Defined in System.TmpProc.Docker

Methods

(==) :: Pinged -> Pinged -> Bool #

(/=) :: Pinged -> Pinged -> Bool #

Show Pinged 
Instance details

Defined in System.TmpProc.Docker

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 ProcHandle values.

data HList (a :: [Type]) where #

Defines a Heterogenous list.

Constructors

HNil :: HList ('[] :: [Type]) 
HCons :: forall anyTy (manyTys :: [Type]). anyTy -> HList manyTys -> HList (anyTy ': manyTys) infixr 5 

Instances

Instances details
(Eq x, Eq (HList xs)) => Eq (HList (x ': xs)) 
Instance details

Defined in System.TmpProc.TypeLevel

Methods

(==) :: HList (x ': xs) -> HList (x ': xs) -> Bool #

(/=) :: HList (x ': xs) -> HList (x ': xs) -> Bool #

Eq (HList ('[] :: [Type])) 
Instance details

Defined in System.TmpProc.TypeLevel

Methods

(==) :: HList '[] -> HList '[] -> Bool #

(/=) :: HList '[] -> HList '[] -> Bool #

(Show x, Show (HList xs)) => Show (HList (x ': xs)) 
Instance details

Defined in System.TmpProc.TypeLevel

Methods

showsPrec :: Int -> HList (x ': xs) -> ShowS #

show :: HList (x ': xs) -> String #

showList :: [HList (x ': xs)] -> ShowS #

Show (HList ('[] :: [Type])) 
Instance details

Defined in System.TmpProc.TypeLevel

Methods

showsPrec :: Int -> HList '[] -> ShowS #

show :: HList '[] -> String #

showList :: [HList '[]] -> ShowS #