Documentation ¶
Index ¶
Constants ¶
const ( DefaultPort = "6379" DefaultBinDir = "/usr/bin" DefaultDataDir = "/data" DefaultPassword = "" DefaultOpTimeout = 5 * time.Minute DefaultReplTimeout = 1 * time.Minute )
Variables ¶
var ( // ErrTimeout is returned when an operation times out. ErrTimeout = errors.New("timeout") // ErrRunning is returned when starting an already running process. ErrRunning = errors.New("redis already running") // ErrStopped is returned when stopping an already stopped process. ErrStopped = errors.New("redis already stopped") )
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct { Process *Process Heartbeater discoverd.Heartbeater Logger log15.Logger // contains filtered or unexported fields }
Handler represents an HTTP handler for the redis process.
type Process ¶
type Process struct { ID string Singleton bool Port string BinDir string DataDir string Password string OpTimeout time.Duration ReplTimeout time.Duration Logger log15.Logger WaitUpstream bool // contains filtered or unexported fields }
Process represents a running Redis process.
func NewProcess ¶
func NewProcess() *Process
NewProcess returns a new instance of Process with defaults.
func (*Process) ConfigPath ¶
ConfigPath returns the path to the redis.conf.
func (*Process) Info ¶
func (p *Process) Info() (*ProcessInfo, error)
Info returns information about the process.
func (*Process) RedisInfo ¶
RedisInfo executes an INFO command against a Redis server and returns the results.
func (*Process) Restore ¶
Restore stops the process, copies an RDB from r, and restarts the process. Redis automatically handles recovery when there's a dump.rdb file present.
type ProcessInfo ¶
type ProcessInfo struct {
Running bool `json:"running"`
}
ProcessInfo represents state about the process returned by Process.Info().
type RedisInfo ¶
type RedisInfo struct { Role string // role MasterHost string // master_host MasterPort int // master_port MasterLinkStatus string // master_link_status MasterLastIO time.Duration // master_last_io_seconds_ago MasterSyncInProgress bool // master_sync_in_progress MasterSyncLeftBytes int64 // master_sync_left_bytes MasterSyncLastIO time.Duration // master_sync_last_io_seconds_ago MasterLinkDownSince time.Duration // master_link_down_since_seconds ConnectedSlaves int // connected_slaves Slaves []string // slaveXXX }
RedisInfo represents the reply from an INFO command. Not all fields are listed.
func ParseRedisInfo ¶
ParseRedisInfo parses the response from an INFO command.
type Status ¶
type Status struct {
Process *ProcessInfo `json:"process"`
}
Status represents response to the /status endpoint.