mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-03-30 16:26:02 +00:00
rename Config to ServerConfig
This commit is contained in:
@@ -3,9 +3,9 @@ module Main where
|
||||
import Simplex.Messaging.Server (runSMPServer)
|
||||
import Simplex.Messaging.Server.Env.STM
|
||||
|
||||
cfg :: Config
|
||||
cfg :: ServerConfig
|
||||
cfg =
|
||||
Config
|
||||
ServerConfig
|
||||
{ tcpPort = "5223",
|
||||
tbqSize = 16,
|
||||
queueIdBytes = 12,
|
||||
|
||||
@@ -35,8 +35,8 @@ import UnliftIO.Exception
|
||||
import UnliftIO.IO
|
||||
import UnliftIO.STM
|
||||
|
||||
runSMPServer :: (MonadRandom m, MonadUnliftIO m) => Config -> m ()
|
||||
runSMPServer cfg@Config {tcpPort} = do
|
||||
runSMPServer :: (MonadRandom m, MonadUnliftIO m) => ServerConfig -> m ()
|
||||
runSMPServer cfg@ServerConfig {tcpPort} = do
|
||||
env <- newEnv cfg
|
||||
runReaderT smpServer env
|
||||
where
|
||||
|
||||
@@ -15,7 +15,7 @@ import Simplex.Messaging.Server.QueueStore.STM
|
||||
import Simplex.Messaging.Server.Transmission
|
||||
import UnliftIO.STM
|
||||
|
||||
data Config = Config
|
||||
data ServerConfig = ServerConfig
|
||||
{ tcpPort :: ServiceName,
|
||||
tbqSize :: Natural,
|
||||
queueIdBytes :: Int,
|
||||
@@ -23,7 +23,7 @@ data Config = Config
|
||||
}
|
||||
|
||||
data Env = Env
|
||||
{ config :: Config,
|
||||
{ config :: ServerConfig,
|
||||
server :: Server,
|
||||
queueStore :: QueueStore,
|
||||
msgStore :: STMMsgStore,
|
||||
@@ -66,7 +66,7 @@ newSubscription = do
|
||||
delivered <- newEmptyTMVar
|
||||
return Sub {subThread = NoSub, delivered}
|
||||
|
||||
newEnv :: (MonadUnliftIO m, MonadRandom m) => Config -> m Env
|
||||
newEnv :: (MonadUnliftIO m, MonadRandom m) => ServerConfig -> m Env
|
||||
newEnv config = do
|
||||
server <- atomically $ newServer (tbqSize config)
|
||||
queueStore <- atomically newQueueStore
|
||||
|
||||
@@ -31,9 +31,9 @@ testSMPClient client = do
|
||||
then client h
|
||||
else error "not connected"
|
||||
|
||||
cfg :: Config
|
||||
cfg :: ServerConfig
|
||||
cfg =
|
||||
Config
|
||||
ServerConfig
|
||||
{ tcpPort = testPort,
|
||||
tbqSize = 1,
|
||||
queueIdBytes = 12,
|
||||
|
||||
Reference in New Issue
Block a user