mirror of https://github.com/tidwall/tile38.git
Added evio flag
This commit is contained in:
parent
933f243c6c
commit
161c6faff9
|
@ -80,6 +80,7 @@ Advanced Options:
|
|||
--http-transport yes/no : HTTP transport (default: yes)
|
||||
--protected-mode yes/no : protected mode (default: yes)
|
||||
--threads num : number of network threads (default: num cores)
|
||||
--evio yes/no : use the evio package (default: no)
|
||||
|
||||
Developer Options:
|
||||
--dev : enable developer mode
|
||||
|
@ -146,10 +147,10 @@ Developer Options:
|
|||
if i < len(os.Args) {
|
||||
switch strings.ToLower(os.Args[i]) {
|
||||
case "no":
|
||||
core.ProtectedMode = "no"
|
||||
core.ProtectedMode = false
|
||||
continue
|
||||
case "yes":
|
||||
core.ProtectedMode = "yes"
|
||||
core.ProtectedMode = true
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
@ -163,10 +164,10 @@ Developer Options:
|
|||
if i < len(os.Args) {
|
||||
switch strings.ToLower(os.Args[i]) {
|
||||
case "no":
|
||||
core.AppendOnly = "no"
|
||||
core.AppendOnly = false
|
||||
continue
|
||||
case "yes":
|
||||
core.AppendOnly = "yes"
|
||||
core.AppendOnly = true
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
@ -213,6 +214,20 @@ Developer Options:
|
|||
}
|
||||
fmt.Fprintf(os.Stderr, "http-transport must be 'yes' or 'no'\n")
|
||||
os.Exit(1)
|
||||
case "--evio", "-evio":
|
||||
i++
|
||||
if i < len(os.Args) {
|
||||
switch strings.ToLower(os.Args[i]) {
|
||||
case "no":
|
||||
core.Evio = false
|
||||
continue
|
||||
case "yes":
|
||||
core.Evio = true
|
||||
continue
|
||||
}
|
||||
}
|
||||
fmt.Fprintf(os.Stderr, "evio must be 'yes' or 'no'\n")
|
||||
os.Exit(1)
|
||||
}
|
||||
nargs = append(nargs, os.Args[i])
|
||||
}
|
||||
|
|
|
@ -7,10 +7,10 @@ var DevMode = false
|
|||
var ShowDebugMessages = false
|
||||
|
||||
// ProtectedMode forces Tile38 to default in protected mode.
|
||||
var ProtectedMode = "yes"
|
||||
var ProtectedMode = true
|
||||
|
||||
// AppendOnly allows for disabling the appendonly file.
|
||||
var AppendOnly = "yes"
|
||||
var AppendOnly = true
|
||||
|
||||
// AppendFileName allows for custom appendonly file path
|
||||
var AppendFileName string
|
||||
|
@ -20,3 +20,6 @@ var QueueFileName string
|
|||
|
||||
// NumThreads is the number of network threads to use.
|
||||
var NumThreads int
|
||||
|
||||
// Evio set the networking to use the evio package.
|
||||
var Evio = false
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package core
|
||||
|
||||
// Build variables
|
||||
var (
|
||||
Version = "0.0.0" // Placeholder for the version
|
||||
BuildTime = "" // Placeholder for the build time
|
||||
|
|
|
@ -36,8 +36,6 @@ import (
|
|||
"github.com/tidwall/tile38/internal/log"
|
||||
)
|
||||
|
||||
const useEvio = false
|
||||
|
||||
var errOOM = errors.New("OOM command not allowed when used memory > 'maxmemory'")
|
||||
|
||||
const goingLive = "going live"
|
||||
|
@ -237,7 +235,7 @@ func Serve(host string, port int, dir string, http bool) error {
|
|||
if err := server.migrateAOF(); err != nil {
|
||||
return err
|
||||
}
|
||||
if core.AppendOnly == "yes" {
|
||||
if core.AppendOnly == true {
|
||||
f, err := os.OpenFile(core.AppendFileName, os.O_CREATE|os.O_RDWR, 0600)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -272,14 +270,14 @@ func Serve(host string, port int, dir string, http bool) error {
|
|||
}()
|
||||
|
||||
// Start the network server
|
||||
if useEvio {
|
||||
if core.Evio {
|
||||
return server.evioServe()
|
||||
}
|
||||
return server.netServe()
|
||||
}
|
||||
|
||||
func (server *Server) isProtected() bool {
|
||||
if core.ProtectedMode == "no" {
|
||||
if core.ProtectedMode == false {
|
||||
// --protected-mode no
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue