Documentation
¶
Index ¶
- type RedMon
- func (R *RedMon) CheckMsg()
- func (R *RedMon) Die() bool
- func (R *RedMon) GetRedisInfo(Section string, Subsection string) string
- func (R *RedMon) IsSyncComplete() bool
- func (R *RedMon) MakeMaster() bool
- func (R *RedMon) Monitor() bool
- func (R *RedMon) Start() bool
- func (R *RedMon) StartMaster() bool
- func (R *RedMon) StartSlave() bool
- func (R *RedMon) StartSlaveAndMakeMaster() bool
- func (R *RedMon) Stop() bool
- func (R *RedMon) TargetNewMaster(Msg string) bool
- func (R *RedMon) UpdateStats() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RedMon ¶
type RedMon struct { P *typ.Proc //The Proc structure that should be used Pid int //The Pid of the running proc IP string //IP address the redis instance should bind to Port int //The port number of this redis instance to be started Ofile io.Writer //Stdout log file to be re-directed to this io.writer Efile io.Writer //stderr of the redis instance should be re-directed to this file MS_Sync bool //Make this as master after sync MonChan chan int //Cmd *exec.Cmd Container *docker.Dcontainer //A handle for the Container package Image string //Name of the Image that should be pulled Client *redisclient.Client //redis client library connection handler L *log.Logger //to redirect log outputs to a file }
RedMon This structure is used to implement a monitor thread/goroutine for a running Proc(redisProc) This structure should be extended only if more functionality is required on the Monitoring functionality A Redis Proc's objec is created within this and monitored hence forth
func NewRedMon ¶
func NewRedMon(tskName string, IP string, Port int, data string, L *log.Logger, Image string) *RedMon
NewRedMon Create a new monitor based on the Data sent along with the TaskInfo The data could have the following details Capacity Master => Just start this PROC send update as TASK_RUNNING and monitor henceforth Capacity SlaveOf IP:Port => This is a redis slave so start it as a slave, sync and then send TASK_RUNNING update then Monitor Capacity Master-SlaveOf IP:Port => This is a New master of the instance with an upgraded memory value so
Start as slave, Sync data, make it as master, send TASK_RUNNING update and start to Monitor
func (*RedMon) CheckMsg ¶
func (R *RedMon) CheckMsg()
CheckMsg constantly keep checking if there is a new message for this Proc
func (*RedMon) GetRedisInfo ¶
GetRedisInfo Connect to the Redis Proc and collect info we need
func (*RedMon) IsSyncComplete ¶
IsSyncComplete Should be called by the Monitors on Slave Procs, this gives the boolien anser if the sync is complegted or not
func (*RedMon) MakeMaster ¶
MakeMaster Make a Proc as a master (ie: supply the command "slaveof no on" to the Proc
func (*RedMon) StartMaster ¶
StartMaster Start the Proc as a master
func (*RedMon) StartSlave ¶
StartSlave start the proc as a slave, should be called to point to a valid master
func (*RedMon) StartSlaveAndMakeMaster ¶
StartSlaveAndMakeMaster Start is as a slave and make it as a master, should be done for replication or adding a new slave
func (*RedMon) TargetNewMaster ¶
TargetNewMaster Make this Proc now target a new master, should be done when a new slave is promoted
func (*RedMon) UpdateStats ¶
UpdateStats Update the stats structure and flush it to the Store/DB