-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A Haskell implementation of the Carbon protocol (part of the Graphite monitoring tools)
--   
--   A Haskell implementation of the Carbon protocol (part of the Graphite
--   monitoring tools)
@package network-carbon
@version 1.0.11

module Network.Carbon.Plaintext

-- | Low-level representation of a Carbon connection. It's suggested that
--   you construct this via <a>connect</a>. It is henceforth assumed that
--   <a>getPeerName</a> will return something useful, which usually means
--   <a>connectionSocket</a> should have been <a>connect</a>ed at least
--   once.
data Connection
Connection :: !Socket -> Connection

-- | The connection socket to Carbon.
[connectionSocket] :: Connection -> !Socket

-- | Connect to Carbon.
connect :: SockAddr -> IO Connection

-- | Disconnect from Carbon. Note that it's still valid to
--   <a>sendMetrics</a> to this <a>Connection</a>, and it will result in a
--   reconnection.
disconnect :: Connection -> IO ()

-- | Send a collection of metrics to Carbon.
sendMetrics :: Connection -> Vector Metric -> IO ()

-- | Send a single metric.
sendMetric :: Connection -> Text -> Double -> UTCTime -> IO ()

-- | A single data point. A metric has a path that names it, a value, and
--   the time the metric was sampled.
data Metric
Metric :: !Text -> !Double -> !UTCTime -> Metric
[metricPath] :: Metric -> !Text
[metricValue] :: Metric -> !Double
[metricTimeStamp] :: Metric -> !UTCTime

-- | Encode a <a>Metric</a> for transmission over the plain text protocol.
encodeMetric :: Metric -> Builder
instance GHC.Show.Show Network.Carbon.Plaintext.Metric
instance GHC.Classes.Eq Network.Carbon.Plaintext.Metric
instance GHC.Show.Show Network.Carbon.Plaintext.Connection
instance GHC.Classes.Eq Network.Carbon.Plaintext.Connection
