Safe Haskell | None |
---|---|
Language | Haskell2010 |
Metro.Server
Documentation
startServer :: (MonadUnliftIO m, Transport tp, Show nid, Eq nid, Hashable nid, Eq k, Hashable k, GetPacketId k rpkt, RecvPacket rpkt, Servable serv) => ServerEnv serv u nid k rpkt tp -> SessionT u nid k rpkt tp m () -> m () Source #
startServer_ :: (MonadUnliftIO m, Transport tp, Show nid, Eq nid, Hashable nid, Eq k, Hashable k, GetPacketId k rpkt, RecvPacket rpkt, Servable serv) => ServerEnv serv u nid k rpkt tp -> (rpkt -> m Bool) -> SessionT u nid k rpkt tp m () -> m () Source #
data ServerEnv serv u nid k rpkt tp Source #
Instances
Monad m => MonadReader (ServerEnv serv u nid k rpkt tp) (ServerT serv u nid k rpkt tp m) Source # | |
Defined in Metro.Server Methods ask :: ServerT serv u nid k rpkt tp m (ServerEnv serv u nid k rpkt tp) # local :: (ServerEnv serv u nid k rpkt tp -> ServerEnv serv u nid k rpkt tp) -> ServerT serv u nid k rpkt tp m a -> ServerT serv u nid k rpkt tp m a # reader :: (ServerEnv serv u nid k rpkt tp -> a) -> ServerT serv u nid k rpkt tp m a # |
data ServerT serv u nid k rpkt tp m a Source #
Instances
MonadTrans (ServerT serv u nid k rpkt tp) Source # | |
Defined in Metro.Server | |
Monad m => MonadReader (ServerEnv serv u nid k rpkt tp) (ServerT serv u nid k rpkt tp m) Source # | |
Defined in Metro.Server Methods ask :: ServerT serv u nid k rpkt tp m (ServerEnv serv u nid k rpkt tp) # local :: (ServerEnv serv u nid k rpkt tp -> ServerEnv serv u nid k rpkt tp) -> ServerT serv u nid k rpkt tp m a -> ServerT serv u nid k rpkt tp m a # reader :: (ServerEnv serv u nid k rpkt tp -> a) -> ServerT serv u nid k rpkt tp m a # | |
Monad m => Monad (ServerT serv u nid k rpkt tp m) Source # | |
Defined in Metro.Server | |
Functor m => Functor (ServerT serv u nid k rpkt tp m) Source # | |
Applicative m => Applicative (ServerT serv u nid k rpkt tp m) Source # | |
Defined in Metro.Server Methods pure :: a -> ServerT serv u nid k rpkt tp m a # (<*>) :: ServerT serv u nid k rpkt tp m (a -> b) -> ServerT serv u nid k rpkt tp m a -> ServerT serv u nid k rpkt tp m b # liftA2 :: (a -> b -> c) -> ServerT serv u nid k rpkt tp m a -> ServerT serv u nid k rpkt tp m b -> ServerT serv u nid k rpkt tp m c # (*>) :: ServerT serv u nid k rpkt tp m a -> ServerT serv u nid k rpkt tp m b -> ServerT serv u nid k rpkt tp m b # (<*) :: ServerT serv u nid k rpkt tp m a -> ServerT serv u nid k rpkt tp m b -> ServerT serv u nid k rpkt tp m a # | |
MonadIO m => MonadIO (ServerT serv u nid k rpkt tp m) Source # | |
Defined in Metro.Server | |
MonadUnliftIO m => MonadUnliftIO (ServerT serv u nid k rpkt tp m) Source # | |
Defined in Metro.Server |
class Servable serv where Source #
Methods
newServer :: MonadIO m => ServerConfig serv -> m serv Source #
servOnce :: MonadUnliftIO m => serv -> (Maybe (SID serv, TransportConfig (STP serv)) -> m ()) -> m () Source #
onConnEnter :: MonadIO m => serv -> SID serv -> m () Source #
onConnLeave :: MonadIO m => serv -> SID serv -> m () Source #
getNodeEnvList :: ServerEnv serv u nid k rpkt tp -> IOHashMap nid (NodeEnv1 u nid k rpkt tp) Source #
initServerEnv :: (MonadIO m, Servable serv) => ServerConfig serv -> IO k -> (TransportConfig (STP serv) -> TransportConfig tp) -> (SID serv -> ConnEnv tp -> IO (Maybe (nid, u))) -> m (ServerEnv serv u nid k rpkt tp) Source #
setServerName :: String -> ServerEnv serv u nid k rpkt tp -> ServerEnv serv u nid k rpkt tp Source #
setNodeMode :: NodeMode -> ServerEnv serv u nid k rpkt tp -> ServerEnv serv u nid k rpkt tp Source #
setSessionMode :: SessionMode -> ServerEnv serv u nid k rpkt tp -> ServerEnv serv u nid k rpkt tp Source #
setOnNodeLeave :: MonadIO m => ServerEnv serv u nid k rpkt tp -> (nid -> u -> IO ()) -> m () Source #
runServerT :: ServerEnv serv u nid k rpkt tp -> ServerT serv u nid k rpkt tp m a -> m a Source #
handleConn :: (MonadUnliftIO m, Transport tp, Show nid, Eq nid, Hashable nid, Eq k, Hashable k, GetPacketId k rpkt, RecvPacket rpkt, Servable serv) => String -> SID serv -> ConnEnv tp -> nid -> u -> (rpkt -> m Bool) -> SessionT u nid k rpkt tp m () -> ServerT serv u nid k rpkt tp m (NodeEnv1 u nid k rpkt tp, Async ()) Source #