| Copyright | (c) Tim Watson 2012 - 2017 |
|---|---|
| License | BSD3 (see the file LICENSE) |
| Maintainer | Tim Watson <[email protected]> |
| Stability | experimental |
| Portability | non-portable (requires concurrency) |
| Safe Haskell | None |
| Language | Haskell98 |
Control.Distributed.Process.ManagedProcess.UnsafeClient
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.
- sendControlMessage :: Serializable m => ControlPort m -> m -> Process ()
- shutdown :: ProcessId -> Process ()
- call :: forall s a b. (Addressable s, NFSerializable a, NFSerializable b) => s -> a -> Process b
- safeCall :: forall s a b. (Addressable s, NFSerializable a, NFSerializable b) => s -> a -> Process (Either ExitReason b)
- tryCall :: forall s a b. (Addressable s, NFSerializable a, NFSerializable b) => s -> a -> Process (Maybe b)
- callTimeout :: forall s a b. (Addressable s, NFSerializable a, NFSerializable b) => s -> a -> TimeInterval -> Process (Maybe b)
- flushPendingCalls :: forall b. NFSerializable b => TimeInterval -> (b -> Process b) -> Process (Maybe b)
- callAsync :: forall s a b. (Addressable s, NFSerializable a, NFSerializable b) => s -> a -> Process (Async b)
- cast :: forall a m. (Addressable a, NFSerializable m) => a -> m -> Process ()
- callChan :: forall s a b. (Addressable s, NFSerializable a, NFSerializable b) => s -> a -> Process (ReceivePort b)
- syncCallChan :: forall s a b. (Addressable s, NFSerializable a, NFSerializable b) => s -> a -> Process b
- syncSafeCallChan :: forall s a b. (Addressable s, NFSerializable a, NFSerializable b) => s -> a -> Process (Either ExitReason b)
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 #
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.