Îõ³h*+ø*Ð.      !"#$%&'()*+,-1.2.2(c) Alexey Radkov 2018-2023 BSD-stylealexey.radkov@gmail.comstablenon-portable (requires POSIX) Safe-Inferred )ngx-export-tools;Terminates the Nginx worker process from a Haskell service.Nginx master process shall notÈ spawn a new worker process thereafter. This function throws exception .×, and therefore terminates the worker process effectively only from a Haskell service.ngx-export-tools9Restarts the Nginx worker process from a Haskell service.üNginx master process shall spawn a new worker process after termination of the current one. This function throws exception /Ø, and therefore terminates the worker process effectively only from a Haskell service.ngx-export-toolsÓFinalizes the current HTTP request from a Haskell asynchronous variable handler.This function throws exception 0ì, and therefore terminates the HTTP request effectively only from a Haskell asynchronous variable handler.ngx-export-tools+Checks that a generic exception is of type 1.’This can be useful to check quickly in an exception handler whether a Haskell service has been interrupted because the worker process is exiting.ngx-export-tools'Unmarshals the 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. In  asynchronousá tasks and content handlers the value must be used as read-only. 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. ngx-export-toolsÒReturns the current time as the number of seconds elapsed since the UNIX epoch.¸The value is taken from Nginx core, so no additional system calls get involved. On the other hand, it means that this is only safe to use from an Nginx worker's main thread, i.e. in  synchronous Haskell handlers and  service hooksã. Be also aware that this is a small type casting hack: the value is interpreted as being of type time_tÏ while having been actually wrapped in a bigger C struct as its first element. ngx-export-tools Returns the PID4 of the current worker process cached in Nginx core.  (c) Alexey Radkov 2018-2022 BSD-stylealexey.radkov@gmail.comstableportable Safe-InferredÍÛ ngx-export-tools=Reads an object of a custom type implementing an instance of 2 from a 3.Returns 4 if reading fails. ngx-export-tools=Reads an object of a custom type implementing an instance of 5 from a 3.Returns 4 if reading fails. ngx-export-toolsòReads a pointer to the Nginx request object followed by an object of a custom type implementing an instance of 2 from a 3.ïThrows an exception if unmarshalling of the request pointer fails. In the second element of the tuple returns 4÷ if reading of the custom object fails. Notice that the value of the returned request pointer is not checked against NULL.ngx-export-toolsòReads a pointer to the Nginx request object followed by an object of a custom type implementing an instance of 5 from a 3.ïThrows an exception if unmarshalling of the request pointer fails. In the second element of the tuple returns 4ø if decoding of the custom object fails. Notice that the value of the returned request pointer is not checked against NULL.ngx-export-toolsÔSkips the number of bytes equal to the size of a pointer from the beginning of a 3.òThis can be useful to drop a pointer to the Nginx request object passed at the beginning of a handler's argument.  (c) Alexey Radkov 2018-2022 BSD-stylealexey.radkov@gmail.comstableportable Safe-Inferred$ 6 -> 7 8 signalUpconf =   . mapConcurrently_ getUrl   'signalUpconf ''Upconf $   Nothing "can be rewritten in a fancier way: signalUpconf :: Upconf -> NgxExportService signalUpconf =   . mapConcurrently_ getUrl ""(c) Alexey Radkov 2018-2023 BSD-stylealexey.radkov@gmail.comstableportable Safe-Inferredq#ngx-export-tools=Sets two different actions as ignition and deferred services.8When used as a single-shot service (in terms of module NgxExport.Tools.SimpleServiceì), the second action only runs on exit of a worker process, and therefore can be used as a cleanup handler.$ngx-export-tools&Sets an action as an ignition service.%ngx-export-tools%Sets an action as a deferred service.8When used as a single-shot service (in terms of module NgxExport.Tools.SimpleServiceå), the action only runs on exit of a worker process, and therefore can be used as a cleanup handler.#ngx-export-toolsIgnition servicengx-export-toolsDeferred servicengx-export-tools Configurationngx-export-toolsFirst-run flag$ngx-export-toolsIgnition servicengx-export-tools Configurationngx-export-toolsFirst-run flag%ngx-export-toolsDeferred servicengx-export-tools Configurationngx-export-toolsFirst-run flag#$%"#$%"(c) Alexey Radkov 2023 BSD-stylealexey.radkov@gmail.comstableportable Safe-Inferred B&ngx-export-tools8Runs an effectful computation and then returns an empty 8'This function saves printing the final return L.empty1 action in handlers that return unused or empty 8.For example, service  signalUpconf being used as an  ?https://github.com/lyokha/nginx-haskell-module#update-callbacksupdate callback in 0type Upconf = [Text] signalUpconf :: Upconf ->  Ù signalUpconf upconf = const $ do mapConcurrently_ getUrl upconf return L.empty   'signalUpconf ''Upconf $   Nothing äreturns an empty bytestring which is not used in a meaningful way, therefore it can be rewritten as signalUpconf :: Upconf ->   signalUpconf = const .  voidHandler . mapConcurrently_ getUrl 6which helps to focus better on the computation itself.'ngx-export-tools8Runs an effectful computation and then returns an empty 8 The same as &È except it accepts an additional value which is ignored. Implemented as voidHandler' = const . & ÂThis can be useful in declarations of services that accept a boolean flag which marks whether the service is running for the first time. This flag is often ignored though, in which case using  voidHandler' can simplify code.For instance, service  signalUpconf from the example for & can be further simplified as signalUpconf :: Upconf ->   signalUpconf =  voidHandler' . mapConcurrently_ getUrl &ngx-export-toolsTarget computation'ngx-export-toolsTarget computationngx-export-tools Ignored value&'"#$%&'(c) Alexey Radkov 2018-2023 BSD-stylealexey.radkov@gmail.comstable(non-portable (requires Template Haskell) Safe-Inferred)ó(ngx-export-toolsDefines a sleeping strategy.)ngx-export-tools6Persistent service (with or without periodical sleeps)*ngx-export-toolsSingle-shot service+ngx-export-tools Exports a simple service of type 3 -> 6 -> 7 8 %with specified name and service mode.,ngx-export-tools Exports a simple service of type 2 a => a -> 6 -> 7 8 %with specified name and service mode.ÌThe service expects an object of a custom type implementing an instance of 2á at its first argument. For the sake of efficiency, this object gets deserialized into a global 9• data storage on the first service run to be further accessed directly from this storage. The storage can be accessed from elsewhere by a name comprised of the name of the custom type and the name of the service connected by an underscore and prefixed as a whole word with storage_ . The stored data is wrapped in : container.øWhen reading of the custom object fails on the first service run, the service terminates the worker process by calling  with a corresponding message.-ngx-export-tools Exports a simple service of type   a => a -> 6 -> 7 8 %with specified name and service mode.ÌThe service expects an object of a custom type implementing an instance of  á at its first argument. For the sake of efficiency, this object gets deserialized into a global 9• data storage on the first service run to be further accessed directly from this storage. The storage can be accessed from elsewhere by a name comprised of the name of the custom type and the name of the service connected by an underscore and prefixed as a whole word with storage_ . The stored data is wrapped in : container.øWhen reading of the custom object fails on the first service run, the service terminates the worker process by calling  with a corresponding message.+ngx-export-toolsName of the servicengx-export-tools Service mode,ngx-export-toolsName of the servicengx-export-toolsName of the custom typengx-export-tools Service mode-ngx-export-toolsName of the servicengx-export-toolsName of the custom typengx-export-tools Service mode ()*+,-" ()*+,-"(c) Alexey Radkov 2018-2023 BSD-stylealexey.radkov@gmail.comstable2non-portable (requires POSIX and Template Haskell) Safe-Inferred*§%"&'#$% ()*+,- ; !"#$%&'()*+,-./01 2345 6 78 9:;<:;=:;>:;?@ABCDEFGHIJKIJLBMDNOEPÑngx-export-tools-1.2.2-inplaceNgxExport.Tools.SimpleServiceNgxExport.Tools.SystemNgxExport.Tools.ReadNgxExport.Tools.TimeIntervalNgxExport.Tools.TypesNgxExport.Tools.SplitServiceNgxExport.Tools.Combinatorsngx-export-tools voidHandler'ngxExportSimpleServiceTypedPersistentServiceNgxExportService Data.AesonFromJSONNgxExport.ToolsbaseForeign.C.TypesCUIntCIntterminateWorkerProcessrestartWorkerProcessfinalizeHTTPRequestworkerProcessIsExiting ngxRequestPtrngxNowngxPidreadFromByteStringreadFromByteStringAsJSONreadFromByteStringWithRPtr readFromByteStringWithRPtrAsJSONskipRPtr$fFromByteStringReadableAsJSON$fFromByteStringReadable TimeIntervalHrMinSecHrMinMinSecUnsettoSecthreadDelaySec$fOrdTimeInterval$fEqTimeInterval$fFromJSONTimeInterval$fGenericTimeInterval$fLiftBoxedRepTimeInterval$fReadTimeInterval$fShowTimeInterval splitServiceignitionServicedeferredService voidHandler ServiceModeSingleShotServicengxExportSimpleService!ngxExportSimpleServiceTypedAsJSONÓngx-export-1.7.7.1-d4fdc11104006823bef275821e8ca0599a62a189352357e40ff67e3ed8f6ae85 NgxExportTerminateWorkerProcessRestartWorkerProcessFinalizeHTTPRequestWorkerProcessIsExitingGHC.ReadReadbytestring-0.11.5.2Data.ByteString.Internal.Type ByteString GHC.MaybeNothingÎaeson-2.2.1.0-392a56f2ea1eff57397bf6fbcd6098c3e9bc9475689fe41590fb7759d816a5daData.Aeson.Types.FromJSONghc-prim GHC.TypesBoolIOData.ByteString.Lazy.Internal GHC.IORefIORefMaybe