packages feed

milena 0.4.0.0 → 0.4.0.1

raw patch · 4 files changed

+16/−62 lines, 4 filesdep −listsafedep −pretty-showdep ~basedep ~bytestringdep ~cerealPVP ok

version bump matches the API change (PVP)

Dependencies removed: listsafe, pretty-show

Dependency ranges changed: base, bytestring, cereal, lens, lifted-base, mtl

API changes (from Hackage documentation)

Files

Network/Kafka/Producer.hs view
@@ -5,13 +5,13 @@ import Control.Monad.Trans (liftIO) import Data.ByteString.Char8 (ByteString) import qualified Data.Digest.Murmur32 as Murmur32-import Data.List.Safe ((!!)) import Data.Monoid ((<>)) import System.IO import qualified Data.Map as M import System.Random (getStdRandom, randomR)-import Prelude hiding ((!!)) +import Prelude+ import Network.Kafka import Network.Kafka.Protocol @@ -59,7 +59,7 @@ -- | clients compute the partition. getPartitionByKey :: ByteString -> [PartitionAndLeader] -> Maybe PartitionAndLeader getPartitionByKey key ps = let i = Murmur32.asWord32 $ Murmur32.hash32WithSeed 0x9747b28c key-                           in ps !! i+                           in ps ^? ix (fromIntegral i)  -- | Execute a produce request using the values in the state. send :: Leader -> [(TopicAndPartition, MessageSet)] -> Kafka ProduceResponse
+ README.md view
@@ -0,0 +1,8 @@+Milena+======++A Kafka client for Haskell.++Supports Kafka 0.8.x++The protocol module is stable (the only changes will be to support changes in the Kafka protocol). The API is functional but subject to change.
milena.cabal view
@@ -4,10 +4,11 @@ -- PVP summary:      +-+------- breaking API changes --                   | | +----- non-breaking API additions --                   | | | +--- code changes with no API change-version:             0.4.0.0+version:             0.4.0.1 synopsis:            A Kafka client for Haskell. description:-    The protocol module is stable (the only changes will be to support changes in the Kafka protocol). The API is functional but subject to change.+  A Kafka client for Haskell.+  The protocol module is stable (the only changes will be to support changes in the Kafka protocol). The API is functional but subject to change. license:             BSD3 license-file:        LICENSE author:              Tyler Holien@@ -17,6 +18,7 @@ build-type:          Simple stability:           alpha cabal-version:       >=1.10+extra-source-files:  README.md  source-repository head   type: git@@ -25,7 +27,7 @@ source-repository this   type: git   location: https://github.com/tylerholien/milena.git-  tag: 0.4.0.0+  tag: 0.4.0.1  library   default-language: Haskell2010@@ -46,7 +48,6 @@                        resource-pool >=0.2.3.2  && <0.3,                        lifted-base   >=0.2.3.6  && <0.3,                        murmur-hash   >=0.1.0.8  && <0.2,-                       listsafe      >=0.1.0.1  && <0.2,                        semigroups    >=0.16.2.2 && <0.17  test-suite test@@ -66,16 +67,3 @@   hs-source-dirs:      test   main-is:             tests.hs   type:                exitcode-stdio-1.0--executable exkhs-  hs-source-dirs:      src-  main-is:             Main.hs-  default-language:    Haskell2010-  build-depends:       base,-                       milena,-                       bytestring,-                       cereal,-                       mtl,-                       lifted-base,-                       lens,-                       pretty-show
− src/Main.hs
@@ -1,42 +0,0 @@-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE NamedFieldPuns #-}-{-# LANGUAGE UnicodeSyntax #-}-{-# LANGUAGE ExplicitForAll #-}--module Main where--import qualified Data.ByteString.Char8 as C-import Control.Lens-import Control.Monad (forM)-import Control.Monad.Except (catchError)-import Network.Kafka-import Network.Kafka.Protocol-import System.Environment (getArgs)--- import Text.Show.Pretty (ppShow)--main ∷ IO ()-main = do-  h:portString:_ ← getArgs-  let host  = Host (KString (C.pack h))-      port  = Port (read portString)-      topic = "open_channel"-      state = mkKafkaState "command-line-test-client" (host, port)-  result ← runKafka state $ do-    -- md ← metadata (MetadataReq [topic])-    -- putStrLnM (ppShow md)-    topicPartitionList ← brokerPartitionInfo topic-    forM topicPartitionList $ \(PartitionAndLeader { _palLeader, _palTopic, _palPartition }) → do-      let s = stateBrokers . at _palLeader-      broker ← findMetadataOrElse [topic] s (KafkaInvalidBroker _palLeader)-      flip catchError (return . Left) $ do-        result ← withBrokerHandle broker $ \handle → do-          offset ← getLastOffset' handle EarliestTime _palPartition topic-          fetchRequest offset _palPartition topic >>= fetch' handle-        return $ Right result-  print result---- tmd :: TopicMetadata--- tmd = TopicMetadata (NoError, "omfg", [PartitionMetadata (NoError, 0, Leader (Just 1), Replicas [], Isr []), PartitionMetadata (NoError, 1, Leader (Just 1), Replicas [], Isr [])])--- newtype TopicMetadata = TopicMetadata { _topicMetadataFields :: (KafkaError, TopicName, [PartitionMetadata]) } deriving (Show, Eq, Deserializable)--- newtype PartitionMetadata = PartitionMetadata { _partitionMetadataFields :: (KafkaError, Partition, Leader, Replicas, Isr) } deriving (Show, Eq, Deserializable)