packages feed

ngx-export-tools 0.1.1.0 → 0.1.2.0

raw patch · 3 files changed

+30/−13 lines, 3 filesdep +binaryPVP ok

version bump matches the API change (PVP)

Dependencies added: binary

API changes (from Hackage documentation)

+ NgxExport.Tools: ngxRequestPtr :: ByteString -> Ptr ()

Files

Changelog.md view
@@ -1,7 +1,11 @@+### 0.1.2.0++- Added function *ngxRequestPtr*.+ ### 0.1.1.0 -- Re-export `CInt` and `CUInt` like in module *NgxExport* instead of-  `unsafePerformIO`.+- Re-export *CInt* and *CUInt* like in module *NgxExport* instead of+  *unsafePerformIO*.  ### 0.1.0.0 
NgxExport/Tools.hs view
@@ -21,19 +21,19 @@     -- * Various useful functions and data                         exitWorkerProcess                        ,terminateWorkerProcess+                       ,ngxRequestPtr                        ,ngxNow                        ,threadDelaySec                        ,TimeInterval (..)                        ,toSec     -- * Exporters of simple services-    --     -- $simpleServices                        ,ServiceMode (..)                        ,ngxExportSimpleService                        ,ngxExportSimpleServiceTyped                        ,ngxExportSimpleServiceTypedAsJSON     -- * Re-exported data constructors from /Foreign.C/-    --   (for marshalling in foreign calls)+    -- | Re-exports are needed by exporters for marshalling in foreign calls.                        ,Foreign.C.Types.CInt (..)                        ,Foreign.C.Types.CUInt (..)                        ) where@@ -48,6 +48,7 @@ import           Data.ByteString (ByteString) import qualified Data.ByteString.Char8 as C8 import qualified Data.ByteString.Lazy as L+import           Data.Binary.Get import           Data.IORef import           Data.Maybe import           Data.Aeson@@ -71,6 +72,17 @@ terminateWorkerProcess :: IO () terminateWorkerProcess = exit 2 +-- | Unmarshals value of Nginx variable __/$_r_ptr/__ into a pointer to the+--   Nginx request object.+--+-- This is safe to use in request-based Haskell handlers such as synchronous+-- and asynchronous tasks and content handlers, but not in services and their+-- derivatives. The value can be passed into a /C plugin/, however, as opposed+-- to usual functions in Nginx C code, it must be tested against the /NULL/+-- value.+ngxRequestPtr :: ByteString -> Ptr ()+ngxRequestPtr = wordPtrToPtr . fromIntegral . runGet getWordhost . L.fromStrict+ -- | Returns current time as the number of seconds elapsed since UNIX epoch. -- -- The value is taken from Nginx core, so no additional system calls get@@ -360,7 +372,7 @@  -- | Exports a simple service with specified name and service mode. ----- The service expects a plain 'ByteString' as its first argument.+-- The service expects a plain 'ByteString' object as its first argument. ngxExportSimpleService :: Name         -- ^ Name of the service                        -> ServiceMode  -- ^ Service mode                        -> Q [Dec]@@ -369,10 +381,10 @@  -- | Exports a simple service with specified name and service mode. ----- The service expects a custom type deriving 'Read' as its first argument.--- For the sake of efficiency, the object of this custom type gets deserialized+-- The service expects an object of a custom type deriving 'Read' as its+-- first argument. For the sake of efficiency, this object gets deserialized -- into a global 'IORef' data storage on the first service run to be further--- accessed directly from the storage.+-- accessed directly from this storage. ngxExportSimpleServiceTyped :: Name         -- ^ Name of the service                             -> Name         -- ^ Name of the custom type                             -> ServiceMode  -- ^ Service mode@@ -382,10 +394,10 @@  -- | Exports a simple service with specified name and service mode. ----- The service expects a custom type deriving 'FromJSON' as its first argument.--- For the sake of efficiency, the object of this custom type gets deserialized+-- The service expects an object of a custom type deriving 'FromJSON' as its+-- first argument. For the sake of efficiency, this object gets deserialized -- into a global 'IORef' data storage on the first service run to be further--- accessed directly from the storage.+-- accessed directly from this storage. ngxExportSimpleServiceTypedAsJSON :: Name         -- ^ Name of the service                                   -> Name         -- ^ Name of the custom type                                   -> ServiceMode  -- ^ Service mode
ngx-export-tools.cabal view
@@ -1,5 +1,5 @@ name:                       ngx-export-tools-version:                    0.1.1.0+version:                    0.1.2.0 synopsis:                   Extra tools for Nginx haskell module description:                Extra tools for         <http://github.com/lyokha/nginx-haskell-module Nginx haskell module>@@ -18,8 +18,9 @@ library   build-depends:            base >= 4.8 && < 5                           , template-haskell >= 2.11.0.0-                          , ngx-export >= 1.5.0                           , bytestring >= 0.10.0.0+                          , binary >= 0.4+                          , ngx-export >= 1.5.0                           , aeson >= 1.0                           , safe