From 23dc65d0c3e3f58be2a9afa7ac1f80701d269070 Mon Sep 17 00:00:00 2001 From: YangKian <1207783292@qq.com> Date: Wed, 19 Jun 2024 17:49:44 +0800 Subject: [PATCH] add config --- conf/hstream.yaml | 4 ++++ hstream/src/HStream/Server/Config.hs | 6 ++++++ hstream/src/HStream/Server/Configuration/Cli.hs | 9 +++++++++ 3 files changed, 19 insertions(+) diff --git a/conf/hstream.yaml b/conf/hstream.yaml index ad8387959..6f83e6848 100644 --- a/conf/hstream.yaml +++ b/conf/hstream.yaml @@ -141,6 +141,10 @@ hserver: las: hstreamdb/sink-las:latest elasticsearch: hstreamdb/sink-elasticsearch:latest + cache-store: + # the cache store work directory + cache-store-path: /data/cache-store + # Internal grpc settings (typically, there's no need to modify these) #grpc: # channel-args: diff --git a/hstream/src/HStream/Server/Config.hs b/hstream/src/HStream/Server/Config.hs index 068b3f9ea..30024a97f 100644 --- a/hstream/src/HStream/Server/Config.hs +++ b/hstream/src/HStream/Server/Config.hs @@ -126,6 +126,8 @@ data ServerOpts = ServerOpts , _querySnapshotPath :: !FilePath , experimentalFeatures :: ![ExperimentalFeature] + , _cacheStorePath :: !FilePath + #ifndef HStreamUseGrpcHaskell , grpcChannelArgs :: ![HsGrpc.ChannelArg] #endif @@ -263,6 +265,10 @@ parseJSONToOptions CliOptions{..} obj = do let experimentalFeatures = cliExperimentalFeatures + cacheStoreCfg <- nodeCfgObj .:? "cache-store" .!= mempty + cacheStorePath <- cacheStoreCfg .:? "cache-store-path" .!= "/data/cache_store" + let _cacheStorePath = fromMaybe cacheStorePath cliCacheStorePath + #ifndef HStreamUseGrpcHaskell grpcCfg <- nodeCfgObj .:? "grpc" .!= mempty grpcChanArgsCfg <- grpcCfg .:? "channel-args" .!= mempty diff --git a/hstream/src/HStream/Server/Configuration/Cli.hs b/hstream/src/HStream/Server/Configuration/Cli.hs index 06c4a254f..76496154d 100644 --- a/hstream/src/HStream/Server/Configuration/Cli.hs +++ b/hstream/src/HStream/Server/Configuration/Cli.hs @@ -138,6 +138,7 @@ data CliOptions = CliOptions -- Experimental Features , cliExperimentalFeatures :: ![ExperimentalFeature] + , cliCacheStorePath :: !(Maybe FilePath) -- Internal options , cliStoreCompression :: !(Maybe Compression) @@ -182,6 +183,8 @@ cliOptionsParser = do cliExperimentalFeatures <- O.many experimentalFeatureParser + cliCacheStorePath <- optional cacheStorePathParser + cliStoreCompression <- optional storeCompressionParser return CliOptions{..} @@ -455,6 +458,12 @@ querySnapshotPathParser = strOption <> metavar "PATH" <> value "/data/query_snapshots" <> help "hstream query snapshot store path" +cacheStorePathParser :: O.Parser FilePath +cacheStorePathParser = strOption + $ long "cache-store-path" + <> metavar "PATH" <> value "/data/cache_store" + <> help "hstream cache store path" + data ExperimentalFeature = ExperimentalStreamV2 deriving (Show, Eq)