Îõ³h*.ƒ-V/      !"#$%&'()*+,-.1.2.3(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 0Ø, 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 1ì, 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 2.’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 3 from a 4.Returns 5 if reading fails. ngx-export-tools=Reads an object of a custom type implementing an instance of 6 from a 4.Returns 5 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 3 from a 4.ïThrows an exception if unmarshalling of the request pointer fails. In the second element of the tuple returns 5÷ 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 6 from a 4.ïThrows an exception if unmarshalling of the request pointer fails. In the second element of the tuple returns 5ø 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 4.ò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$ 7 -> 8 9 signalUpconf =   . mapConcurrently_ getUrl   'signalUpconf ''Upconf $   Nothing "can be rewritten in a fancier way: signalUpconf :: Upconf -> NgxExportService signalUpconf =   . mapConcurrently_ getUrl "ngx-export-toolsFirst-run flag""(c) Alexey Radkov 2018-2023 BSD-stylealexey.radkov@gmail.comstableportable Safe-Inferred-#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 Configuration$ngx-export-toolsIgnition servicengx-export-tools Configuration%ngx-export-toolsDeferred servicengx-export-tools Configuration#$%"#$%"(c) Alexey Radkov 2023-2024 BSD-stylealexey.radkov@gmail.comstableportable Safe-Inferred"Å&ngx-export-tools8Runs an effectful computation and then returns an empty 9.'This function saves printing the final return L.empty1 action in handlers that return unused or empty 9.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 9. The same as &Ð except it accepts an additional boolean 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-tools7A void service which does nothing and returns an empty 9.ïThis can be useful for loading global data from the Nginx configuration in a more concise and declarative way.For example, if data Conf in Çnewtype Conf = Conf Int deriving (Read, Show) testLoadConf :: Conf ->   testLoadConf =  voidService   'testLoadConf ''Conf   gets loaded by service  testLoadConfÐ from the Nginx configuration, then it can be accessed in the Haskell code via  data storage storage_Conf_testLoadConf.&ngx-export-toolsTarget computation'ngx-export-toolsTarget computationngx-export-toolsIgnored boolean value(ngx-export-toolsIgnored configurationngx-export-toolsIgnored boolean value&'("#$%&'((c) Alexey Radkov 2018-2023 BSD-stylealexey.radkov@gmail.comstable(non-portable (requires Template Haskell) Safe-Inferred,x)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 4 -> 7 -> 8 9 %with specified name and service mode.-ngx-export-tools Exports a simple service of type 3 a => a -> 7 -> 8 9 %with specified name and service mode.ÌThe service expects an object of a custom type implementing an instance of 3á at its first argument. For the sake of efficiency, this object gets deserialized into a global :• 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 -> 7 -> 8 9 %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 :• 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-,&"&'(#$% )*+,-. < !"#$%&'()*+,-./01234 5678 9:  ; <=>?=>@=>A=>BCDEFGHIJKLMNLMOEPGQHRÓngx-export-tools-1.2.3-inplaceNgxExport.Tools.SimpleServiceNgxExport.Tools.SystemNgxExport.Tools.ReadNgxExport.Tools.TimeIntervalNgxExport.Tools.TypesNgxExport.Tools.SplitServiceNgxExport.Tools.Combinatorsngx-export-tools voidHandler'ngxExportSimpleServiceTypedPersistentServiceNgxExportServiceSingleShotService Data.IORefIORef Data.AesonFromJSONNgxExport.ToolsbaseForeign.C.TypesCUIntCIntterminateWorkerProcessrestartWorkerProcessfinalizeHTTPRequestworkerProcessIsExiting ngxRequestPtrngxNowngxPidreadFromByteStringreadFromByteStringAsJSONreadFromByteStringWithRPtr readFromByteStringWithRPtrAsJSONskipRPtr$fFromByteStringReadableAsJSON$fFromByteStringReadable TimeIntervalHrMinSecHrMinMinSecUnsettoSecthreadDelaySec$fOrdTimeInterval$fEqTimeInterval$fFromJSONTimeInterval$fGenericTimeInterval$fLiftBoxedRepTimeInterval$fReadTimeInterval$fShowTimeInterval splitServiceignitionServicedeferredService voidHandler voidService ServiceModengxExportSimpleService!ngxExportSimpleServiceTypedAsJSONÑngx-export-1.7.9-8b7d98aaa30ba8c4aa57d7d04b2b6538aaa81b88543133fda07c9f10f6161266 NgxExportTerminateWorkerProcessRestartWorkerProcessFinalizeHTTPRequestWorkerProcessIsExitingGHC.ReadReadbytestring-0.11.5.3Data.ByteString.Internal.Type ByteString GHC.MaybeNothingÎaeson-2.2.1.0-ed5a980e49d4ee56b1b09ddb4426ed0a8b6bdf5b69fcb36ff489f7a28e680ccbData.Aeson.Types.FromJSONghc-prim GHC.TypesBoolIOData.ByteString.Lazy.Internal GHC.IORefMaybe