RedMon

package
v0.0.0-...-705e2cb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2018 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

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) Die

func (R *RedMon) Die() bool

Die Kill the Redis Proc

func (*RedMon) GetRedisInfo

func (R *RedMon) GetRedisInfo(Section string, Subsection string) string

GetRedisInfo Connect to the Redis Proc and collect info we need

func (*RedMon) IsSyncComplete

func (R *RedMon) IsSyncComplete() bool

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

func (R *RedMon) MakeMaster() bool

MakeMaster Make a Proc as a master (ie: supply the command "slaveof no on" to the Proc

func (*RedMon) Monitor

func (R *RedMon) Monitor() bool

Monitor Primary monitor thread started for every PROC

func (*RedMon) Start

func (R *RedMon) Start() bool

Start the redis Proc be it Master or Slave

func (*RedMon) StartMaster

func (R *RedMon) StartMaster() bool

StartMaster Start the Proc as a master

func (*RedMon) StartSlave

func (R *RedMon) StartSlave() bool

StartSlave start the proc as a slave, should be called to point to a valid master

func (*RedMon) StartSlaveAndMakeMaster

func (R *RedMon) StartSlaveAndMakeMaster() bool

StartSlaveAndMakeMaster Start is as a slave and make it as a master, should be done for replication or adding a new slave

func (*RedMon) Stop

func (R *RedMon) Stop() bool

Stop we have been told to stop the Redis

func (*RedMon) TargetNewMaster

func (R *RedMon) TargetNewMaster(Msg string) bool

TargetNewMaster Make this Proc now target a new master, should be done when a new slave is promoted

func (*RedMon) UpdateStats

func (R *RedMon) UpdateStats() bool

UpdateStats Update the stats structure and flush it to the Store/DB

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL