{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
module Capnp.Rpc.Server
( Server(..)
, ServerOps(..)
, CallInfo(..)
, runServer
, MethodHandler
, pureHandler
, rawHandler
, rawAsyncHandler
, methodThrow
, methodUnimplemented
, untypedHandler
, toUntypedHandler
, fromUntypedHandler
, invoke
) where
import Control.Concurrent.STM
import Control.Monad.STM.Class
import Data.Word
import Control.Exception.Safe (MonadCatch, finally, try)
import Control.Monad.IO.Class (MonadIO, liftIO)
import Control.Monad.Primitive (PrimMonad, PrimState)
import Data.Typeable (Typeable)
import Capnp.Classes
( Cerialize
, Decerialize(Cerial, decerialize)
, FromPtr(fromPtr)
, ToStruct(toStruct)
)
import Capnp.Convert (valueToMsg)
import Capnp.Message (ConstMsg, MutMsg)
import Capnp.Rpc.Errors (eMethodUnimplemented, wrapException)
import Capnp.Rpc.Promise (Fulfiller, breakPromise, fulfill, newCallback)
import Capnp.TraversalLimit (defaultLimit, evalLimitT)
import Capnp.Untyped (Ptr)
import Data.Mutable (freeze)
import qualified Capnp.Gen.Capnp.Rpc.Pure as RpcGen
import qualified Capnp.Message as Message
import qualified Capnp.Untyped as Untyped
import qualified Internal.TCloseQ as TCloseQ
newtype MethodHandler m p r = MethodHandler
{ MethodHandler m p r
-> Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ()
handleMethod
:: Maybe (Ptr ConstMsg)
-> Fulfiller (Maybe (Ptr ConstMsg))
-> m ()
}
invoke
:: MonadSTM m
=> MethodHandler m (Maybe (Ptr ConstMsg)) (Maybe (Ptr ConstMsg))
-> Maybe (Ptr ConstMsg)
-> Fulfiller (Maybe (Ptr ConstMsg))
-> m ()
invoke :: MethodHandler m (Maybe (Ptr ConstMsg)) (Maybe (Ptr ConstMsg))
-> Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ()
invoke = MethodHandler m (Maybe (Ptr ConstMsg)) (Maybe (Ptr ConstMsg))
-> Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ()
forall (m :: * -> *) p r.
MethodHandler m p r
-> Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ()
handleMethod
pureHandler ::
( MonadCatch m
, MonadSTM m
, PrimMonad m
, s ~ PrimState m
, Decerialize p
, FromPtr ConstMsg (Cerial ConstMsg p)
, Cerialize s r
, ToStruct (MutMsg s) (Cerial (MutMsg s) r)
) =>
(cap -> p -> m r)
-> cap
-> MethodHandler m p r
pureHandler :: (cap -> p -> m r) -> cap -> MethodHandler m p r
pureHandler cap -> p -> m r
f cap
cap = MethodHandler :: forall (m :: * -> *) p r.
(Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ())
-> MethodHandler m p r
MethodHandler
{ handleMethod :: Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ()
handleMethod = \Maybe (Ptr ConstMsg)
ptr Fulfiller (Maybe (Ptr ConstMsg))
reply -> do
p
param <- WordCount -> LimitT m p -> m p
forall (m :: * -> *) a.
MonadThrow m =>
WordCount -> LimitT m a -> m a
evalLimitT WordCount
defaultLimit (LimitT m p -> m p) -> LimitT m p -> m p
forall a b. (a -> b) -> a -> b
$
ConstMsg -> Maybe (Ptr ConstMsg) -> LimitT m (Cerial ConstMsg p)
forall msg a (m :: * -> *).
(FromPtr msg a, ReadCtx m msg) =>
msg -> Maybe (Ptr msg) -> m a
fromPtr ConstMsg
Message.empty Maybe (Ptr ConstMsg)
ptr LimitT m (Cerial ConstMsg p)
-> (Cerial ConstMsg p -> LimitT m p) -> LimitT m p
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Cerial ConstMsg p -> LimitT m p
forall a (m :: * -> *).
(Decerialize a, ReadCtx m ConstMsg) =>
Cerial ConstMsg a -> m a
decerialize
Either SomeException r
result <- m r -> m (Either SomeException r)
forall (m :: * -> *) e a.
(MonadCatch m, Exception e) =>
m a -> m (Either e a)
try (m r -> m (Either SomeException r))
-> m r -> m (Either SomeException r)
forall a b. (a -> b) -> a -> b
$ cap -> p -> m r
f cap
cap p
param
case Either SomeException r
result of
Right r
val -> do
Struct ConstMsg
struct <- WordCount -> LimitT m (Struct ConstMsg) -> m (Struct ConstMsg)
forall (m :: * -> *) a.
MonadThrow m =>
WordCount -> LimitT m a -> m a
evalLimitT WordCount
defaultLimit (LimitT m (Struct ConstMsg) -> m (Struct ConstMsg))
-> LimitT m (Struct ConstMsg) -> m (Struct ConstMsg)
forall a b. (a -> b) -> a -> b
$
r -> LimitT m (MutMsg s)
forall (m :: * -> *) s a.
(MonadLimit m, WriteCtx m s, Cerialize s a,
ToStruct (MutMsg s) (Cerial (MutMsg s) a)) =>
a -> m (MutMsg s)
valueToMsg r
val LimitT m (MutMsg s)
-> (MutMsg s -> LimitT m ConstMsg) -> LimitT m ConstMsg
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= MutMsg s -> LimitT m ConstMsg
forall a (m :: * -> *) s.
(Thaw a, PrimMonad m, PrimState m ~ s) =>
Mutable s a -> m a
freeze LimitT m ConstMsg
-> (ConstMsg -> LimitT m (Struct ConstMsg))
-> LimitT m (Struct ConstMsg)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ConstMsg -> LimitT m (Struct ConstMsg)
forall (m :: * -> *) msg. ReadCtx m msg => msg -> m (Struct msg)
Untyped.rootPtr
STM () -> m ()
forall (m :: * -> *) a. MonadSTM m => STM a -> m a
liftSTM (STM () -> m ()) -> STM () -> m ()
forall a b. (a -> b) -> a -> b
$ Fulfiller (Maybe (Ptr ConstMsg)) -> Maybe (Ptr ConstMsg) -> STM ()
forall (m :: * -> *) a. MonadSTM m => Fulfiller a -> a -> m ()
fulfill Fulfiller (Maybe (Ptr ConstMsg))
reply (Ptr ConstMsg -> Maybe (Ptr ConstMsg)
forall a. a -> Maybe a
Just (Struct ConstMsg -> Ptr ConstMsg
forall msg. Struct msg -> Ptr msg
Untyped.PtrStruct Struct ConstMsg
struct))
Left SomeException
e ->
STM () -> m ()
forall (m :: * -> *) a. MonadSTM m => STM a -> m a
liftSTM (STM () -> m ()) -> STM () -> m ()
forall a b. (a -> b) -> a -> b
$ Fulfiller (Maybe (Ptr ConstMsg)) -> Exception -> STM ()
forall (m :: * -> *) a.
MonadSTM m =>
Fulfiller a -> Exception -> m ()
breakPromise Fulfiller (Maybe (Ptr ConstMsg))
reply (Bool -> SomeException -> Exception
wrapException Bool
False SomeException
e)
}
rawHandler ::
( MonadCatch m
, MonadSTM m
, PrimMonad m
, s ~ PrimState m
, Decerialize p
, FromPtr ConstMsg (Cerial ConstMsg p)
, Decerialize r
, ToStruct ConstMsg (Cerial ConstMsg r)
) =>
(cap -> Cerial ConstMsg p -> m (Cerial ConstMsg r))
-> cap
-> MethodHandler m p r
rawHandler :: (cap -> Cerial ConstMsg p -> m (Cerial ConstMsg r))
-> cap -> MethodHandler m p r
rawHandler cap -> Cerial ConstMsg p -> m (Cerial ConstMsg r)
f cap
cap = MethodHandler :: forall (m :: * -> *) p r.
(Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ())
-> MethodHandler m p r
MethodHandler
{ handleMethod :: Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ()
handleMethod = \Maybe (Ptr ConstMsg)
ptr Fulfiller (Maybe (Ptr ConstMsg))
reply -> do
Cerial ConstMsg p
cerial <- WordCount -> LimitT m (Cerial ConstMsg p) -> m (Cerial ConstMsg p)
forall (m :: * -> *) a.
MonadThrow m =>
WordCount -> LimitT m a -> m a
evalLimitT WordCount
defaultLimit (LimitT m (Cerial ConstMsg p) -> m (Cerial ConstMsg p))
-> LimitT m (Cerial ConstMsg p) -> m (Cerial ConstMsg p)
forall a b. (a -> b) -> a -> b
$ ConstMsg -> Maybe (Ptr ConstMsg) -> LimitT m (Cerial ConstMsg p)
forall msg a (m :: * -> *).
(FromPtr msg a, ReadCtx m msg) =>
msg -> Maybe (Ptr msg) -> m a
fromPtr ConstMsg
Message.empty Maybe (Ptr ConstMsg)
ptr
Either SomeException (Cerial ConstMsg r)
result <- m (Cerial ConstMsg r)
-> m (Either SomeException (Cerial ConstMsg r))
forall (m :: * -> *) e a.
(MonadCatch m, Exception e) =>
m a -> m (Either e a)
try (m (Cerial ConstMsg r)
-> m (Either SomeException (Cerial ConstMsg r)))
-> m (Cerial ConstMsg r)
-> m (Either SomeException (Cerial ConstMsg r))
forall a b. (a -> b) -> a -> b
$ cap -> Cerial ConstMsg p -> m (Cerial ConstMsg r)
f cap
cap Cerial ConstMsg p
cerial
case Either SomeException (Cerial ConstMsg r)
result of
Right Cerial ConstMsg r
val -> STM () -> m ()
forall (m :: * -> *) a. MonadSTM m => STM a -> m a
liftSTM (STM () -> m ()) -> STM () -> m ()
forall a b. (a -> b) -> a -> b
$ Fulfiller (Maybe (Ptr ConstMsg)) -> Maybe (Ptr ConstMsg) -> STM ()
forall (m :: * -> *) a. MonadSTM m => Fulfiller a -> a -> m ()
fulfill Fulfiller (Maybe (Ptr ConstMsg))
reply (Ptr ConstMsg -> Maybe (Ptr ConstMsg)
forall a. a -> Maybe a
Just (Struct ConstMsg -> Ptr ConstMsg
forall msg. Struct msg -> Ptr msg
Untyped.PtrStruct (Cerial ConstMsg r -> Struct ConstMsg
forall msg a. ToStruct msg a => a -> Struct msg
toStruct Cerial ConstMsg r
val)))
Left SomeException
e -> STM () -> m ()
forall (m :: * -> *) a. MonadSTM m => STM a -> m a
liftSTM (STM () -> m ()) -> STM () -> m ()
forall a b. (a -> b) -> a -> b
$ Fulfiller (Maybe (Ptr ConstMsg)) -> Exception -> STM ()
forall (m :: * -> *) a.
MonadSTM m =>
Fulfiller a -> Exception -> m ()
breakPromise Fulfiller (Maybe (Ptr ConstMsg))
reply (Bool -> SomeException -> Exception
wrapException Bool
False SomeException
e)
}
rawAsyncHandler ::
( MonadCatch m
, MonadSTM m
, PrimMonad m
, s ~ PrimState m
, Decerialize p
, FromPtr ConstMsg (Cerial ConstMsg p)
, Decerialize r
, ToStruct ConstMsg (Cerial ConstMsg r)
) =>
(cap -> Cerial ConstMsg p -> Fulfiller (Cerial ConstMsg r) -> m ())
-> cap
-> MethodHandler m p r
rawAsyncHandler :: (cap -> Cerial ConstMsg p -> Fulfiller (Cerial ConstMsg r) -> m ())
-> cap -> MethodHandler m p r
rawAsyncHandler cap -> Cerial ConstMsg p -> Fulfiller (Cerial ConstMsg r) -> m ()
f cap
cap = MethodHandler :: forall (m :: * -> *) p r.
(Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ())
-> MethodHandler m p r
MethodHandler
{ handleMethod :: Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ()
handleMethod = \Maybe (Ptr ConstMsg)
ptr Fulfiller (Maybe (Ptr ConstMsg))
reply -> do
Fulfiller (Cerial ConstMsg r)
fulfiller <- (Either Exception (Cerial ConstMsg r) -> STM ())
-> m (Fulfiller (Cerial ConstMsg r))
forall (m :: * -> *) a.
MonadSTM m =>
(Either Exception a -> STM ()) -> m (Fulfiller a)
newCallback ((Either Exception (Cerial ConstMsg r) -> STM ())
-> m (Fulfiller (Cerial ConstMsg r)))
-> (Either Exception (Cerial ConstMsg r) -> STM ())
-> m (Fulfiller (Cerial ConstMsg r))
forall a b. (a -> b) -> a -> b
$ \case
Left Exception
e -> Fulfiller (Maybe (Ptr ConstMsg)) -> Exception -> STM ()
forall (m :: * -> *) a.
MonadSTM m =>
Fulfiller a -> Exception -> m ()
breakPromise Fulfiller (Maybe (Ptr ConstMsg))
reply Exception
e
Right Cerial ConstMsg r
v -> Fulfiller (Maybe (Ptr ConstMsg)) -> Maybe (Ptr ConstMsg) -> STM ()
forall (m :: * -> *) a. MonadSTM m => Fulfiller a -> a -> m ()
fulfill Fulfiller (Maybe (Ptr ConstMsg))
reply (Maybe (Ptr ConstMsg) -> STM ()) -> Maybe (Ptr ConstMsg) -> STM ()
forall a b. (a -> b) -> a -> b
$ Ptr ConstMsg -> Maybe (Ptr ConstMsg)
forall a. a -> Maybe a
Just (Struct ConstMsg -> Ptr ConstMsg
forall msg. Struct msg -> Ptr msg
Untyped.PtrStruct (Cerial ConstMsg r -> Struct ConstMsg
forall msg a. ToStruct msg a => a -> Struct msg
toStruct Cerial ConstMsg r
v))
Cerial ConstMsg p
cerial <- WordCount -> LimitT m (Cerial ConstMsg p) -> m (Cerial ConstMsg p)
forall (m :: * -> *) a.
MonadThrow m =>
WordCount -> LimitT m a -> m a
evalLimitT WordCount
defaultLimit (LimitT m (Cerial ConstMsg p) -> m (Cerial ConstMsg p))
-> LimitT m (Cerial ConstMsg p) -> m (Cerial ConstMsg p)
forall a b. (a -> b) -> a -> b
$ ConstMsg -> Maybe (Ptr ConstMsg) -> LimitT m (Cerial ConstMsg p)
forall msg a (m :: * -> *).
(FromPtr msg a, ReadCtx m msg) =>
msg -> Maybe (Ptr msg) -> m a
fromPtr ConstMsg
Message.empty Maybe (Ptr ConstMsg)
ptr
cap -> Cerial ConstMsg p -> Fulfiller (Cerial ConstMsg r) -> m ()
f cap
cap Cerial ConstMsg p
cerial Fulfiller (Cerial ConstMsg r)
fulfiller
}
toUntypedHandler
:: MethodHandler m p r
-> MethodHandler m (Maybe (Ptr ConstMsg)) (Maybe (Ptr ConstMsg))
toUntypedHandler :: MethodHandler m p r
-> MethodHandler m (Maybe (Ptr ConstMsg)) (Maybe (Ptr ConstMsg))
toUntypedHandler MethodHandler{Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ()
handleMethod :: Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ()
handleMethod :: forall (m :: * -> *) p r.
MethodHandler m p r
-> Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ()
..} = MethodHandler :: forall (m :: * -> *) p r.
(Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ())
-> MethodHandler m p r
MethodHandler{Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ()
handleMethod :: Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ()
handleMethod :: Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ()
..}
fromUntypedHandler
:: MethodHandler m (Maybe (Ptr ConstMsg)) (Maybe (Ptr ConstMsg))
-> MethodHandler m p r
fromUntypedHandler :: MethodHandler m (Maybe (Ptr ConstMsg)) (Maybe (Ptr ConstMsg))
-> MethodHandler m p r
fromUntypedHandler MethodHandler{Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ()
handleMethod :: Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ()
handleMethod :: forall (m :: * -> *) p r.
MethodHandler m p r
-> Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ()
..} = MethodHandler :: forall (m :: * -> *) p r.
(Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ())
-> MethodHandler m p r
MethodHandler{Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ()
handleMethod :: Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ()
handleMethod :: Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ()
..}
untypedHandler
:: (Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ())
-> MethodHandler m (Maybe (Ptr ConstMsg)) (Maybe (Ptr ConstMsg))
untypedHandler :: (Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ())
-> MethodHandler m (Maybe (Ptr ConstMsg)) (Maybe (Ptr ConstMsg))
untypedHandler = (Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ())
-> MethodHandler m (Maybe (Ptr ConstMsg)) (Maybe (Ptr ConstMsg))
forall (m :: * -> *) p r.
(Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ())
-> MethodHandler m p r
MethodHandler
methodThrow :: MonadIO m => RpcGen.Exception -> MethodHandler m p r
methodThrow :: Exception -> MethodHandler m p r
methodThrow Exception
exn = MethodHandler :: forall (m :: * -> *) p r.
(Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ())
-> MethodHandler m p r
MethodHandler
{ handleMethod :: Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ()
handleMethod = \Maybe (Ptr ConstMsg)
_ Fulfiller (Maybe (Ptr ConstMsg))
fulfiller -> IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ Fulfiller (Maybe (Ptr ConstMsg)) -> Exception -> IO ()
forall (m :: * -> *) a.
MonadSTM m =>
Fulfiller a -> Exception -> m ()
breakPromise Fulfiller (Maybe (Ptr ConstMsg))
fulfiller Exception
exn
}
methodUnimplemented :: MonadIO m => MethodHandler m p r
methodUnimplemented :: MethodHandler m p r
methodUnimplemented = Exception -> MethodHandler m p r
forall (m :: * -> *) p r.
MonadIO m =>
Exception -> MethodHandler m p r
methodThrow Exception
eMethodUnimplemented
class Monad m => Server m a | a -> m where
shutdown :: a -> m ()
shutdown a
_ = () -> m ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ()
unwrap :: Typeable b => a -> Maybe b
unwrap a
_ = Maybe b
forall a. Maybe a
Nothing
data ServerOps m = ServerOps
{ ServerOps m
-> Word64
-> Word16
-> MethodHandler m (Maybe (Ptr ConstMsg)) (Maybe (Ptr ConstMsg))
handleCall
:: Word64
-> Word16
-> MethodHandler m (Maybe (Ptr ConstMsg)) (Maybe (Ptr ConstMsg))
, ServerOps m -> m ()
handleStop :: m ()
, ServerOps m -> forall a. Typeable a => Maybe a
handleCast :: forall a. Typeable a => Maybe a
}
data CallInfo = CallInfo
{ CallInfo -> Word64
interfaceId :: !Word64
, CallInfo -> Word16
methodId :: !Word16
, CallInfo -> Maybe (Ptr ConstMsg)
arguments :: Maybe (Ptr ConstMsg)
, CallInfo -> Fulfiller (Maybe (Ptr ConstMsg))
response :: Fulfiller (Maybe (Ptr ConstMsg))
}
runServer :: TCloseQ.Q CallInfo -> ServerOps IO -> IO ()
runServer :: Q CallInfo -> ServerOps IO -> IO ()
runServer Q CallInfo
q ServerOps IO
ops = IO ()
go IO () -> IO () -> IO ()
forall (m :: * -> *) a b. MonadMask m => m a -> m b -> m a
`finally` ServerOps IO -> IO ()
forall (m :: * -> *). ServerOps m -> m ()
handleStop ServerOps IO
ops
where
go :: IO ()
go = STM (Maybe CallInfo) -> IO (Maybe CallInfo)
forall a. STM a -> IO a
atomically (Q CallInfo -> STM (Maybe CallInfo)
forall a. Q a -> STM (Maybe a)
TCloseQ.read Q CallInfo
q) IO (Maybe CallInfo) -> (Maybe CallInfo -> IO ()) -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Maybe CallInfo
Nothing ->
() -> IO ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure ()
Just CallInfo{Word64
interfaceId :: Word64
interfaceId :: CallInfo -> Word64
interfaceId, Word16
methodId :: Word16
methodId :: CallInfo -> Word16
methodId, Maybe (Ptr ConstMsg)
arguments :: Maybe (Ptr ConstMsg)
arguments :: CallInfo -> Maybe (Ptr ConstMsg)
arguments, Fulfiller (Maybe (Ptr ConstMsg))
response :: Fulfiller (Maybe (Ptr ConstMsg))
response :: CallInfo -> Fulfiller (Maybe (Ptr ConstMsg))
response} -> do
MethodHandler IO (Maybe (Ptr ConstMsg)) (Maybe (Ptr ConstMsg))
-> Maybe (Ptr ConstMsg)
-> Fulfiller (Maybe (Ptr ConstMsg))
-> IO ()
forall (m :: * -> *) p r.
MethodHandler m p r
-> Maybe (Ptr ConstMsg) -> Fulfiller (Maybe (Ptr ConstMsg)) -> m ()
handleMethod
(ServerOps IO
-> Word64
-> Word16
-> MethodHandler IO (Maybe (Ptr ConstMsg)) (Maybe (Ptr ConstMsg))
forall (m :: * -> *).
ServerOps m
-> Word64
-> Word16
-> MethodHandler m (Maybe (Ptr ConstMsg)) (Maybe (Ptr ConstMsg))
handleCall ServerOps IO
ops Word64
interfaceId Word16
methodId)
Maybe (Ptr ConstMsg)
arguments
Fulfiller (Maybe (Ptr ConstMsg))
response
IO ()
go