distributed-process-client-server-0.2.5.1: The Cloud Haskell Application Platform

Copyright(c) Tim Watson 2012 - 2017
LicenseBSD3 (see the file LICENSE)
MaintainerTim Watson <watson.timothy@gmail.com>
Stabilityexperimental
Portabilitynon-portable (requires concurrency)
Safe HaskellNone
LanguageHaskell98

Control.Distributed.Process.ManagedProcess.UnsafeClient

Contents

Description

Unsafe variant of the Managed Process Client API. This module implements the client portion of a Managed Process using the unsafe variants of cloud haskell's messaging primitives. It relies on the -extras implementation of UnsafePrimitives, which forces evaluation for types that provide an NFData instance. Direct use of the underlying unsafe primitives (from the distributed-process library) without NFData instances is unsupported.

IMPORTANT NOTE: As per the platform documentation, it is not possible to guarantee that an NFData instance will force evaluation in the same way that a Binary instance would (when encoding to a byte string). Please read the unsafe primitives documentation carefully and make sure you know what you're doing. You have been warned.

See Control.Distributed.Process.Extras. See Control.Distributed.Process.Extras.UnsafePrimitives. See Control.Distributed.Process.UnsafePrimitives.

Synopsis

Unsafe variants of the Client API

sendControlMessage :: Serializable m => ControlPort m -> m -> Process () Source #

Send a control message over a ControlPort. This version of shutdown uses unsafe primitives.

shutdown :: ProcessId -> Process () Source #

Send a signal instructing the process to terminate. This version of shutdown uses unsafe primitives.

call :: forall s a b. (Addressable s, NFSerializable a, NFSerializable b) => s -> a -> Process b Source #

Make a synchronous call - uses unsafe primitives.

safeCall :: forall s a b. (Addressable s, NFSerializable a, NFSerializable b) => s -> a -> Process (Either ExitReason b) Source #

Safe version of call that returns information about the error if the operation fails - uses unsafe primitives.

tryCall :: forall s a b. (Addressable s, NFSerializable a, NFSerializable b) => s -> a -> Process (Maybe b) Source #

Version of safeCall that returns Nothing if the operation fails. Uses unsafe primitives.

callTimeout :: forall s a b. (Addressable s, NFSerializable a, NFSerializable b) => s -> a -> TimeInterval -> Process (Maybe b) Source #

Make a synchronous call, but timeout and return Nothing if a reply is not received within the specified time interval - uses unsafe primitives.

flushPendingCalls :: forall b. NFSerializable b => TimeInterval -> (b -> Process b) -> Process (Maybe b) Source #

Block for TimeInterval waiting for any matching CallResponse

callAsync :: forall s a b. (Addressable s, NFSerializable a, NFSerializable b) => s -> a -> Process (Async b) Source #

Invokes call out of band, and returns an "async handle." Uses unsafe primitives.

cast :: forall a m. (Addressable a, NFSerializable m) => a -> m -> Process () Source #

Sends a cast message to the server identified by server - uses unsafe primitives.

callChan :: forall s a b. (Addressable s, NFSerializable a, NFSerializable b) => s -> a -> Process (ReceivePort b) Source #

Sends a channel message to the server and returns a ReceivePort - uses unsafe primitives.

syncCallChan :: forall s a b. (Addressable s, NFSerializable a, NFSerializable b) => s -> a -> Process b Source #

A synchronous version of callChan.

syncSafeCallChan :: forall s a b. (Addressable s, NFSerializable a, NFSerializable b) => s -> a -> Process (Either ExitReason b) Source #

A safe version of syncCallChan, which returns Left ExitReason if the call fails.