| Safe Haskell | Safe-Inferred | 
|---|---|
| Language | Haskell2010 | 
Capnp.Rpc
Description
This module exposes the most commonly used parts of the RPC subsystem.
Synopsis
- handleConn :: Transport -> ConnConfig -> IO ()
- data ConnConfig = ConnConfig {- maxQuestions :: !Word32
- maxExports :: !Word32
- maxCallWords :: !WordCount
- debugMode :: !Bool
- getBootstrap :: Supervisor -> STM (Maybe Client)
- withBootstrap :: Maybe (Supervisor -> Client -> IO ())
 
- throwFailed :: MonadThrow m => Text -> m a
- data Transport = Transport {}
- socketTransport :: Socket -> WordCount -> Transport
- handleTransport :: Handle -> WordCount -> Transport
- tracingTransport :: TraceConfig -> Transport -> Transport
- module Capnp.Rpc.Promise
- data Client
- class IsClient a where- toClient :: a -> Client
- fromClient :: Client -> a
 
- newPromiseClient :: (MonadSTM m, IsClient c) => m (c, Fulfiller c)
- waitClient :: (IsClient c, MonadSTM m) => c -> m c
- unwrapServer :: (IsClient c, Typeable a) => c -> Maybe a
- module Supervisors
Establishing connections
handleConn :: Transport -> ConnConfig -> IO () Source #
Handle a connection to another vat. Returns when the connection is closed.
data ConnConfig Source #
Configuration information for a connection.
Constructors
| ConnConfig | |
| Fields 
 | |
Instances
| Default ConnConfig Source # | |
| Defined in Capnp.Rpc.Untyped Methods def :: ConnConfig # | |
throwing errors
throwFailed :: MonadThrow m => Text -> m a Source #
Throw an exception with a type field of Exception'Type'failed and
 the argument as a reason.
Transmitting messages
A Transport
socketTransport :: Socket -> WordCount -> Transport Source #
socketTransport socket limitlimit as the traversal limit when
 reading messages and decoing.
handleTransport :: Handle -> WordCount -> Transport Source #
handleTransport handle limithandle. It uses limit as the traversal limit when
 reading messages and decoding.
tracingTransport :: TraceConfig -> Transport -> Transport Source #
tracingTransport log transtrans, loging
 messages when they are sent or received (using the log function). This
 can be useful for debugging.
Promises
module Capnp.Rpc.Promise
Clients
A reference to a capability, which may be live either in the current vat or elsewhere. Holding a client affords making method calls on a capability or modifying the local vat's reference count to it.
class IsClient a where Source #
Types which may be converted to and from Clients. Typically these
 will be simple type wrappers for capabilities.
Methods
toClient :: a -> Client Source #
Convert a value to a client.
fromClient :: Client -> a Source #
Convert a client to a value.
newPromiseClient :: (MonadSTM m, IsClient c) => m (c, Fulfiller c) Source #
Create a new client based on a promise. The fulfiller can be used to supply the final client.
waitClient :: (IsClient c, MonadSTM m) => c -> m c Source #
Wait for the client to be fully resolved, and then return a client pointing directly to the destination.
If the argument is null, a local client, or a (permanent) remote client, this returns the argument immediately. If the argument is a promise client, then this waits for the promise to resolve and returns the result of the resolution. If the promise resolves to *another* promise, then this waits for that promise to also resolve.
If the promise is rejected, then this throws the corresponding exception.
Reflection
unwrapServer :: (IsClient c, Typeable a) => c -> Maybe a Source #
Attempt to unwrap a client, to get at an underlying value from the
 server. Returns Nothing on failure.
This shells out to the underlying server's implementation of
 unwrap. It will fail with Nothing if any of these are true:
- The client is a promise.
- The client points to an object in a remote vat.
- The underlying Server's unwrapmethod returnsNothingfor typea.
Supervisors
module Supervisors