capnp-0.6.0.0: Cap'n Proto for Haskell

Safe HaskellNone
LanguageHaskell2010

Capnp.Rpc.Untyped

Contents

Description

This module does not deal with schema-level concepts; all capabilities, methods etc. as used here are untyped.

Synopsis

Connections to other vats

data ConnConfig Source #

Configuration information for a connection.

Constructors

ConnConfig 

Fields

  • maxQuestions :: !Word32

    The maximum number of simultanious outstanding requests to the peer vat. Once this limit is reached, further questsions will block until some of the existing questions have been answered.

    Defaults to 128.

  • maxExports :: !Word32

    The maximum number of objects which may be exported on this connection.

    Defaults to 8192.

  • debugMode :: !Bool

    In debug mode, errors reported by the RPC system to its peers will contain extra information. This should not be used in production, as it is possible for these messages to contain sensitive information, but it can be useful for debugging.

    Defaults to False.

  • getBootstrap :: Supervisor -> STM (Maybe Client)

    Get the bootstrap interface we should serve for this connection. the argument is a supervisor whose lifetime is bound to the connection. If $sel:getBootstrap:ConnConfig returns Nothing, we will respond to bootstrap messages with an exception.

    The default always returns Nothing.

    $sel:getBootstrap:ConnConfig MUST NOT block; the connection will not be serviced and $sel:withBootstrap:ConnConfig will not be run until this returns. If you need to supply the bootstrap interface later, use newPromiseClient.

  • withBootstrap :: Maybe (Supervisor -> Client -> IO ())

    An action to perform with access to the remote vat's bootstrap interface. The supervisor argument is bound to the lifetime of the connection. If this is Nothing (the default), the bootstrap interface will not be requested.

Instances
Default ConnConfig Source # 
Instance details

Defined in Capnp.Rpc.Untyped

Methods

def :: ConnConfig #

handleConn :: Transport -> ConnConfig -> IO () Source #

Handle a connection to another vat. Returns when the connection is closed.

Clients for capabilities

data Client Source #

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.

Instances
Eq Client Source # 
Instance details

Defined in Capnp.Rpc.Untyped

Methods

(==) :: Client -> Client -> Bool #

(/=) :: Client -> Client -> Bool #

Show Client Source # 
Instance details

Defined in Capnp.Rpc.Untyped

IsClient Client Source # 
Instance details

Defined in Capnp.Rpc.Untyped

call :: MonadSTM m => CallInfo -> Client -> m () Source #

Queue a call on a client.

nullClient :: Client Source #

A null client. This is the only client value that can be represented statically. Throws exceptions in response to all method calls.

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.

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.

Exporting local objects

export :: MonadSTM m => Supervisor -> ServerOps IO -> m Client Source #

Spawn a local server with its lifetime bound to the supervisor, and return a client for it. When the client is garbage collected, the server will be stopped (if it is still running).

Unwrapping local clients

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 unwrap method returns Nothing for type a.

Errors

data RpcError Source #

Errors which can be thrown by the rpc system.

Constructors

ReceivedAbort Exception

The remote vat sent us an abort message.

SentAbort Exception

We sent an abort to the remote vat.

Instances
Eq RpcError Source # 
Instance details

Defined in Capnp.Rpc.Untyped

Show RpcError Source # 
Instance details

Defined in Capnp.Rpc.Untyped

Generic RpcError Source # 
Instance details

Defined in Capnp.Rpc.Untyped

Associated Types

type Rep RpcError :: Type -> Type #

Methods

from :: RpcError -> Rep RpcError x #

to :: Rep RpcError x -> RpcError #

Exception RpcError Source # 
Instance details

Defined in Capnp.Rpc.Untyped

type Rep RpcError Source # 
Instance details

Defined in Capnp.Rpc.Untyped

data Exception Source #

Instances
Eq Exception Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc.Pure

Show Exception Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc.Pure

Generic Exception Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc.Pure

Associated Types

type Rep Exception :: Type -> Type #

Exception Exception Source # 
Instance details

Defined in Capnp.Rpc.Errors

Default Exception Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc.Pure

Methods

def :: Exception #

Cerialize Exception Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc.Pure

Methods

cerialize :: RWCtx m s => MutMsg s -> Exception -> m (Cerial (MutMsg s) Exception) Source #

Marshal Exception Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc.Pure

Methods

marshalInto :: RWCtx m s => Cerial (MutMsg s) Exception -> Exception -> m () Source #

Decerialize Exception Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc.Pure

Associated Types

type Cerial msg Exception :: Type Source #

FromStruct ConstMsg Exception Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc.Pure

Cerialize (Vector (Vector (Vector (Vector (Vector (Vector (Vector Exception))))))) Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc.Pure

Cerialize (Vector (Vector (Vector (Vector (Vector (Vector Exception)))))) Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc.Pure

Cerialize (Vector (Vector (Vector (Vector (Vector Exception))))) Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc.Pure

Cerialize (Vector (Vector (Vector (Vector Exception)))) Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc.Pure

Cerialize (Vector (Vector (Vector Exception))) Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc.Pure

Cerialize (Vector (Vector Exception)) Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc.Pure

Cerialize (Vector Exception) Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc.Pure

type Rep Exception Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc.Pure

type Rep Exception = D1 (MetaData "Exception" "Capnp.Gen.Capnp.Rpc.Pure" "capnp-0.6.0.0-kmuWJKkOwSDLq91ugTnNR" False) (C1 (MetaCons "Exception" PrefixI True) ((S1 (MetaSel (Just "reason") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text) :*: S1 (MetaSel (Just "obsoleteIsCallersFault") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Bool)) :*: (S1 (MetaSel (Just "obsoleteDurability") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Word16) :*: S1 (MetaSel (Just "type_") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Exception'Type))))
type Cerial msg Exception Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc.Pure

type Cerial msg Exception = Exception msg

data Exception'Type Source #

Instances
Enum Exception'Type Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc

Eq Exception'Type Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc

Read Exception'Type Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc

Show Exception'Type Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc

Generic Exception'Type Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc

Associated Types

type Rep Exception'Type :: Type -> Type #

Cerialize Exception'Type Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc.Pure

Decerialize Exception'Type Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc.Pure

Associated Types

type Cerial msg Exception'Type :: Type Source #

IsWord Exception'Type Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc

MutListElem s Exception'Type Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc

ListElem msg Exception'Type Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc

Associated Types

data List msg Exception'Type :: Type Source #

Cerialize (Vector (Vector (Vector (Vector (Vector (Vector Exception'Type)))))) Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc.Pure

Cerialize (Vector (Vector (Vector (Vector (Vector Exception'Type))))) Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc.Pure

Cerialize (Vector (Vector (Vector (Vector Exception'Type)))) Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc.Pure

Cerialize (Vector (Vector (Vector Exception'Type))) Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc.Pure

Cerialize (Vector (Vector Exception'Type)) Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc.Pure

Cerialize (Vector Exception'Type) Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc.Pure

type Rep Exception'Type Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc

type Rep Exception'Type = D1 (MetaData "Exception'Type" "Capnp.Gen.Capnp.Rpc" "capnp-0.6.0.0-kmuWJKkOwSDLq91ugTnNR" False) ((C1 (MetaCons "Exception'Type'failed" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Exception'Type'overloaded" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "Exception'Type'disconnected" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "Exception'Type'unimplemented" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "Exception'Type'unknown'" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Word16)))))
type Cerial msg Exception'Type Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc.Pure

newtype List msg Exception'Type Source # 
Instance details

Defined in Capnp.Gen.Capnp.Rpc

Shutting down the connection