From c8469290bde44a39863e64142ef40ea0fa040700 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 13 Sep 2016 11:57:55 -0400 Subject: adding some server disk usage tuning options --- CmdLine.hs | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) (limited to 'CmdLine.hs') diff --git a/CmdLine.hs b/CmdLine.hs index c3b8256..067d726 100644 --- a/CmdLine.hs +++ b/CmdLine.hs @@ -22,9 +22,9 @@ data CmdLine = CmdLine , gui :: Bool , testMode :: Bool , customShareParams :: Maybe ShareParams - , serverConfig :: ServerConfig , name :: Maybe Name , othername :: Maybe Name + , serverConfig :: ServerConfig } data Mode = Backup | Restore | UploadQueued | Server | Benchmark | Test @@ -33,6 +33,8 @@ data Mode = Backup | Restore | UploadQueued | Server | Benchmark | Test data ServerConfig = ServerConfig { serverPort :: Port , serverAddress :: String + , diskReserveMb :: Int + , monthsToFillHalfDisk :: Int } parse :: Parser CmdLine @@ -109,6 +111,16 @@ parse = CmdLine <> metavar "N" <> help ("Configure the number of shares needed to restore. (default: " ++ show (neededObjects (shareParams defaultTunables)) ++ ") (When this option is used to back up a key, it must also be provided at restore time.)") ) + nameopt = optional $ Name . BU8.fromString <$> strOption + ( long "name" + <> metavar "N" + <> help "Specify name used for key backup/restore, avoiding the usual prompt." + ) + othernameopt = optional $ Name . BU8.fromString <$> strOption + ( long "othername" + <> metavar "N" + <> help "Specify other name used for key backup/restore, avoiding the usual prompt." + ) serverconfig = ServerConfig <$> option auto ( long "port" @@ -124,16 +136,20 @@ parse = CmdLine <> showDefault <> help "Address for server to bind to. (Use \"*\" to bind to all addresses.)" ) - nameopt = optional $ Name . BU8.fromString <$> strOption - ( long "name" - <> metavar "N" - <> help "Specify name used for key backup/restore, avoiding the usual prompt." - ) - othernameopt = optional $ Name . BU8.fromString <$> strOption - ( long "othername" - <> metavar "N" - <> help "Specify other name used for key backup/restore, avoiding the usual prompt." - ) + <*> option auto + ( long "disk-reserve" + <> metavar "N" + <> value 256 + <> showDefault + <> help "Server refuses to store objects if less than this much disk space (in megabytes) is free" + ) + <*> option auto + ( long "months-to-fill-half-disk" + <> metavar "N" + <> value 12 + <> showDefault + <> help "Server rate-limits requests and requires proof of work, to avoid too many objects being stored. This is an lower bound on how long it could possibly take for half of the current disk space to be filled." + ) get :: IO CmdLine get = execParser opts -- cgit v1.2.3