Documentation ¶
Index ¶
- Constants
- Variables
- func Initialize(dbtype string, config string) (bool, error)
- type InMem
- type Instance
- type Instance_Json
- type Offer
- type Proc
- func (P *Proc) Load() bool
- func (P *Proc) LoadMsg() bool
- func (P *Proc) LoadStats() bool
- func (P *Proc) LoadType() bool
- func (P *Proc) Sync() bool
- func (P *Proc) SyncMsg() bool
- func (P *Proc) SyncStats() bool
- func (P *Proc) SyncType() bool
- func (P *Proc) ToJson() string
- func (P *Proc) ToJsonStats(stats Stats) string
- type Proc_Json
- type Rec
- type Stats
- type TaskCreate
- type TaskUpdate
Constants ¶
const ( ETC_BASE_DIR = "/MrRedis" ETC_INST_DIR = ETC_BASE_DIR + "/Instances" ETC_CONF_DIR = ETC_BASE_DIR + "/Config" )
global Constants releated to ETCD
const ( INST_STATUS_CREATING = "CREATING" INST_STATUS_RUNNING = "RUNNING" INST_STATUS_DISABLED = "DISABLED" INST_STATUS_DELETED = "DELETED" )
Global constants for Instnace Status CREATING/ACTIVE/DELETED/DISABLED
const ( INST_TYPE_SINGLE = "S" //A Single instance redis-server INST_TYPE_MASTER_SLAVE = "MS" //A redis instnace with master-slave )
Const for instance type
const ( PROC_TYPE_MASTER = "M" PROC_TYPE_SLAVE = "S" )
const for type of the redis-server
Variables ¶
var ( Gdb store.DB //Golabal variables related to db connection/instace MemDb *InMem //In memory store OfferList *list.List //list for having offer Cchan chan TaskCreate //Channel for Creator Mchan chan *TaskUpdate //Channel for Maintainer Dchan chan *Proc //Channel for Destroyer )
Functions ¶
Types ¶
type InMem ¶
type Instance ¶
type Instance struct { Name string //Name of the instance Type string //Type of the instance "Single Instance = S; Master-Slave = MS; Cluster = C" Capacity int //Capacity of the Instance in MB Masters int //Number of masters in this Instance Slaves int //Number of slaves in this Instance ExpMasters int //Expected number of Masters ExpSlaves int //Expected number of Slaves Status string //Status of this instance "CREATING/RUNNING/DISABLED" Mname string //Name / task id of the master redis proc Snames []string //Name of the slave Procs map[string]*Proc //An array of redis procs to be filled later }
func LoadInstance ¶
func NewInstance ¶
func (*Instance) SyncMasters ¶
func (*Instance) SyncSlaves ¶
func (*Instance) SyncStatus ¶
type Instance_Json ¶
type Offer ¶
type Proc ¶
type Proc struct { Instance string //Name of the instance it belongs to Nodename string //Node name at which this should start syncing its details to MemCap int //Maximum Memory this instance can go to MemUsed int //Current usage of the memory Pid int //Unix Process id of this running instance ID string //UUID that was generated for this PROC State string //Current state of the process Active/Dead/Crashed etc., Type string //Type of the PROC master/Slave etc., SlaveOf string //Slave of which redis master Stats string //All other statistics apart from Memory usage to be stored as a json/string Msg string //Message we will revive fromt he scheduler and action to be taken on it IP string //IP address of the slave at which this redis-server proc is running Port string //Port number at which this PROC is bound to EID string //Executor ID of this PROC .. Just in case we need to send a framework messsage SID string //Slave ID of this PROC .. Just in case we need to send a framework message }
A standalone redis KV store is usually started in any slave (Linux) like below $./redis-server -p <PORT> ..... {OPTIONS} This stand alone redis-server will be an actual unix process bound to a particular port witha PID A redis Master Slave setup will have two such "redis-server" processes running in either the same machine or two different machines A redis KV with one master and 3 slaves will have a total of 4 "redis-server" processes running The below structure "Proc" is a representation of such a running 'redis-server' process started via this framework This started/running "Proc" could be a Master/Standalone instance or could be a Slave of another "redis-server' running as a master
func (*Proc) ToJsonStats ¶
type Stats ¶
ToDo the whole stats structure could be a json structure reflecting all the fields what redis info returns currently one field has many new line saperated values;ToDO will this work if returned in API?
type TaskCreate ¶
type TaskCreate struct { M bool //Is this a master or slave I *Instance C int //count of number of instnace to be created }
func CreateMaster ¶
func CreateMaster(i *Instance) TaskCreate
func CreateSlaves ¶
func CreateSlaves(i *Instance, c int) TaskCreate
func NewTaskCreate ¶
func NewTaskCreate(m bool, i *Instance, c int) TaskCreate