Skip to content

Commit

Permalink
add config
Browse files Browse the repository at this point in the history
  • Loading branch information
YangKian committed Jun 19, 2024
1 parent 1de7b0b commit 23dc65d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions conf/hstream.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions hstream/src/HStream/Server/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ data ServerOpts = ServerOpts
, _querySnapshotPath :: !FilePath
, experimentalFeatures :: ![ExperimentalFeature]

, _cacheStorePath :: !FilePath

#ifndef HStreamUseGrpcHaskell
, grpcChannelArgs :: ![HsGrpc.ChannelArg]
#endif
Expand Down Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions hstream/src/HStream/Server/Configuration/Cli.hs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ data CliOptions = CliOptions

-- Experimental Features
, cliExperimentalFeatures :: ![ExperimentalFeature]
, cliCacheStorePath :: !(Maybe FilePath)

-- Internal options
, cliStoreCompression :: !(Maybe Compression)
Expand Down Expand Up @@ -182,6 +183,8 @@ cliOptionsParser = do

cliExperimentalFeatures <- O.many experimentalFeatureParser

cliCacheStorePath <- optional cacheStorePathParser

cliStoreCompression <- optional storeCompressionParser

return CliOptions{..}
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 23dc65d

Please sign in to comment.