capnp-0.17.0.0: Cap'n Proto for Haskell
Safe HaskellSafe-Inferred
LanguageHaskell2010

Capnp.Rpc.Membrane

Description

Membranes are common in object-capability design. Think of it like a proxy on steroids: a membrane inserts itself in front of another capability, and can intercept and modify method calls. Unlike a simple proxy though, the membrane will also be applied to any objects returned by method calls, or passed in arguments, transitively, so it can sit in front of entire object graphs.

Synopsis

Documentation

enclose :: (IsClient c, MonadSTM m) => Supervisor -> c -> Policy -> m c Source #

enclose sup cap policy wraps cap in a membrane whose behavior is goverend by policy.

exclude :: (IsClient c, MonadSTM m) => Supervisor -> c -> Policy -> m c Source #

exclude is like enclose, except that the capability is treated as being *outside* of a membrane that wraps the rest of the world.

type Policy = Call -> STM Action Source #

A Policy decides what to do when a call crosses the membrane.

data Action Source #

An action indicates what to do with an incoming method call.

Constructors

Handle UntypedMethodHandler

Handle the method using the provided method handler, instead of letting it through the membrane. Arguments and return values will not be wrapped/unwraped, so be careful when delegating to objects inside the membrane.

Forward

Forward the method call on to its original destination, wrapping and unwrapping arguments & return values as normal.

data Direction Source #

A Direction indicates which direction a method call is traveling: into or out of the membrane.

Constructors

In 
Out 

Instances

Instances details
Read Direction Source # 
Instance details

Defined in Capnp.Rpc.Membrane

Show Direction Source # 
Instance details

Defined in Capnp.Rpc.Membrane

Eq Direction Source # 
Instance details

Defined in Capnp.Rpc.Membrane

data Call Source #

A Call represents a method call that is crossing the membrane.

Constructors

Call 

Fields

  • direction :: Direction

    Which direction is the call going? if this is In, the call was made by something outside the membrane to something inside it. If it is Out, something inside the membrane is making a call to something outside the membrane.

  • interfaceId :: Word64

    The interface id of the method being called.

  • methodId :: Word16

    The ordinal of the method being called.

  • target :: Client

    The target of the method call.