Added flag for specifying event queue path

Use the `--queuefilename path` command flag

For full in-memory queue use `--queuefilename :memory:`
This commit is contained in:
tidwall 2018-09-04 12:26:10 -07:00
parent 7efa55f175
commit 7e16ac536b
3 changed files with 16 additions and 2 deletions

View File

@ -77,7 +77,8 @@ Basic Options:
Advanced Options:
--pidfile path : file that contains the pid
--appendonly yes/no : AOF persistence (default: yes)
--appendonlyfile path : AOF path (default: data/appendonly.aof)
--appendfilename path : AOF path (default: data/appendonly.aof)
--queuefilename path : Event queue path (default:data/queue.db)
--http-transport yes/no : HTTP transport (default: yes)
--protected-mode yes/no : protected mode (default: yes)
@ -177,6 +178,13 @@ Developer Options:
os.Exit(1)
}
core.AppendFileName = os.Args[i]
case "--queuefilename", "-queuefilename":
i++
if i == len(os.Args) || os.Args[i] == "" {
fmt.Fprintf(os.Stderr, "queuefilename must have a value\n")
os.Exit(1)
}
core.QueueFileName = os.Args[i]
case "--http-transport", "-http-transport":
i++
if i < len(os.Args) {

View File

@ -125,6 +125,9 @@ func ListenAndServeEx(host string, port int, dir string, ln *net.Listener, http
if core.AppendFileName == "" {
core.AppendFileName = path.Join(dir, "appendonly.aof")
}
if core.QueueFileName == "" {
core.QueueFileName = path.Join(dir, "queue.db")
}
log.Infof("Server started, Tile38 version %s, git %s", core.Version, core.GitSHA)
c := &Controller{
@ -165,7 +168,7 @@ func ListenAndServeEx(host string, port int, dir string, ln *net.Listener, http
return err
}
// load the queue before the aof
qdb, err := buntdb.Open(path.Join(dir, "queue.db"))
qdb, err := buntdb.Open(core.QueueFileName)
if err != nil {
return err
}

View File

@ -14,3 +14,6 @@ var AppendOnly = "yes"
// AppendFileName allows for custom appendonly file path
var AppendFileName string
// QueueFileName allows for custom queue.db file path
var QueueFileName string