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