handlers

package
v0.0.0-...-be95f36 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2016 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package handlers is where the HTTP server work is done.

Index

Constants

View Source
const STATIC_ROOT string = "html/static/"
View Source
const STATIC_URL string = "http://redskull.iamtherealbill.com/static/"

Variables

View Source
var NodeMaster = new(common.NodeStore)

NodeMaster is deprecated. Previously/currently used for storing node connections. It needs refactored to use the constellation-wide node routines

View Source
var TemplateBase string

Functions

func APIAddSlave

func APIAddSlave(c web.C, w http.ResponseWriter, r *http.Request)

APIAddSlave is the API call handler for adding a slave

func APIFailover

func APIFailover(c web.C, w http.ResponseWriter, r *http.Request)

func APIGetMaster

func APIGetMaster(c web.C, w http.ResponseWriter, r *http.Request)

func APIGetPod

func APIGetPod(c web.C, w http.ResponseWriter, r *http.Request)

func APIGetPodMap

func APIGetPodMap(c web.C, w http.ResponseWriter, r *http.Request)

func APIGetPods

func APIGetPods(c web.C, w http.ResponseWriter, r *http.Request)

func APIGetSlaves

func APIGetSlaves(c web.C, w http.ResponseWriter, r *http.Request)

func APIMonitorPod

func APIMonitorPod(c web.C, w http.ResponseWriter, r *http.Request)

func APIRemovePod

func APIRemovePod(c web.C, w http.ResponseWriter, r *http.Request)

func AddNode

func AddNode(c web.C, w http.ResponseWriter, r *http.Request)

AddNode isn't currently used but would add a non-master, non-slave node. This will be refactored out to a provisioning layer

func AddNodeHTMLProcessor

func AddNodeHTMLProcessor(c web.C, w http.ResponseWriter, r *http.Request)

AddNodeHTMLProcessor is the target for the AddNode form's action

func AddPodForm

func AddPodForm(c web.C, w http.ResponseWriter, r *http.Request)

AddPodForm displays the form for adding a pod

func AddPodHTML

func AddPodHTML(c web.C, w http.ResponseWriter, r *http.Request)

AddPodHTML is the action target for adding a pod. It does the heavy lifting

func AddPodJSON

func AddPodJSON(c web.C, w http.ResponseWriter, r *http.Request)

func AddSentinelForm

func AddSentinelForm(c web.C, w http.ResponseWriter, r *http.Request)

AddSentinelForm displays the form for adding a sentinel

func AddSentinelHTML

func AddSentinelHTML(c web.C, w http.ResponseWriter, r *http.Request)

AddSentinelHTML does the heavy lifting of adding a sentinel. It is the action target for the sentinel add form

func AddSlaveHTML

func AddSlaveHTML(c web.C, w http.ResponseWriter, r *http.Request)

AddSlaveHTML shows the slave addition form

func AddSlaveHTMLProcessor

func AddSlaveHTMLProcessor(c web.C, w http.ResponseWriter, r *http.Request)

AddSlaveHTMLProcessor is the action target for the AddSlaveHTML form

func BalancePodProcessor

func BalancePodProcessor(c web.C, w http.ResponseWriter, r *http.Request)

BalancePodProcessor calls the constellation's BalancePod function for the pod

func Clone

func Clone(c web.C, w http.ResponseWriter, r *http.Request)

Clone is not currently exposed as it comes from the first incarnation of the idea of a Redis manager. It will likely be incorporated into the pod-level handlers and exposed through that route.

func CloneServer

func CloneServer(originHost, cloneHost string, promoteWhenComplete, reconfigureSlaves bool, syncTimeout float64, roleRequired string) (result map[string]string)

TODO?: rename/copy this to have MigratePodToNewPod and CloneServer ? CloneServer does the heavy lifting to clone one Redis instance to another.

func CommifyFloat

func CommifyFloat(bytes float64) string

CommifyFloat turns a float into a string with comma separation

func ConstellationInfoHTML

func ConstellationInfoHTML(c web.C, w http.ResponseWriter, r *http.Request)

func ConstellationInfoJSON

func ConstellationInfoJSON(c web.C, w http.ResponseWriter, r *http.Request)

func Dashboard

func Dashboard(c web.C, w http.ResponseWriter, r *http.Request)

Dashboard shows the dashboard

func DoFailoverHTML

func DoFailoverHTML(c web.C, w http.ResponseWriter, r *http.Request)

DoFailoverHTML is how the UI initiates a failover for a pod

func DoFailoverJSON

func DoFailoverJSON(ctx web.C, w http.ResponseWriter, r *http.Request) (err error)

func GetNodeJSON

func GetNodeJSON(c web.C, w http.ResponseWriter, r *http.Request)

GetNodeJSON returns the JSON output of the data known about a node

func HumanizeBigBytes

func HumanizeBigBytes(bytes int64) string

HumanizeBigBytes transforms a uint64 to a human readable string such as "100Kb"

func HumanizeBytes

func HumanizeBytes(bytes int) string

HumanizeBytes transforms an int to a human readable string such as "100Kb"

func HumanizeCallStats

func HumanizeCallStats(micros float64) (res string)

HumanizeCallStats is used to convert Redis' calls stats to something humans can easily read. This means converting microseconds to milliseconds where appropriate, adding commas, and hopefully soon upconverting to seconds, minutes, hours, days, etc. where approriate

func HumanizeSlowlog

func HumanizeSlowlog(micros int64) (res string)

HumanizeSlowlog is used to convert Redis' calls stats to something humans can easily read. This means converting microseconds to milliseconds where appropriate, adding commas, and hopefully soon upconverting to seconds, minutes, hours, days, etc. where approriate

func Info

func Info(c web.C, w http.ResponseWriter, r *http.Request)

Info is deprecated in favor of the cluster level node routines

func IntFromFloat64

func IntFromFloat64(incoming float64) (i int)

IntFromFloat64 provides a convenience function fo convert an int to a float insert screed about how you probably should not do it but sometimes you need to here.

func OkToBool

func OkToBool(ok string) bool

Turn an "ok" string into a boolean

func RebalanceHTML

func RebalanceHTML(c web.C, w http.ResponseWriter, r *http.Request)

WEB UI CALL

func RebalanceJSON

func RebalanceJSON(c web.C, w http.ResponseWriter, r *http.Request)

func RemovePodHTML

func RemovePodHTML(c web.C, w http.ResponseWriter, r *http.Request)

RemovePodHTML is the action target for adding a pod. It does the heavy lifting

func ResetPodProcessor

func ResetPodProcessor(c web.C, w http.ResponseWriter, r *http.Request)

ResetPodProcessor is called to reset the pod's slave&sentinel configuration

func Root

func Root(c web.C, w http.ResponseWriter, r *http.Request)

Root shows the index page of Red Skull, if you didn't want to display the dashboard at the root.

func SetConstellation

func SetConstellation(con actions.Constellation)

func ShowNode

func ShowNode(c web.C, w http.ResponseWriter, r *http.Request)

ShowNode handles the individual node display

func ShowNodes

func ShowNodes(c web.C, w http.ResponseWriter, r *http.Request)

ShowNodes shows the node listing page

func ShowPod

func ShowPod(c web.C, w http.ResponseWriter, r *http.Request)

ShowPod shows the view for a specific pod

func ShowPods

func ShowPods(c web.C, w http.ResponseWriter, r *http.Request)

ShowPods shows the pods view page

func Static

func Static(c web.C, w http.ResponseWriter, req *http.Request)

Static serves static content such as images, JS and CSS files

Types

type ErrorMetrics

type ErrorMetrics struct {
	NoQuorum         int
	MissingSentinels int
	TooManySentinels int
	NoValidSlave     int
	InvalidAuth      int
	TotalErrorPods   int
	ConnectionError  int
	NoFailover       int
	Groups           map[string][]interface{}
}

ErrorMetrics is a struct used by the UI to display the current breakdown of errors among the pod.

type InfoResponse

type InfoResponse struct {
	Status        string
	StatusMessage string
	Data          interface{}
}

InfoResponse represents the information returned in an API call

type PageContext

type PageContext struct {
	Title         string
	SubTitle      string
	Data          interface{}
	Static        string
	ViewTemplate  string
	CurrentURL    string
	Constellation *actions.Constellation
	NodeMaster    common.NodeManager
	Pod           *common.RedisPod
	Node          *common.RedisNode
	Refresh       bool
	RefreshTime   int
	RefreshURL    string
	Error         error
}

PageContext holds all the contextual information a page will want to return, use, or display

func NewPageContext

func NewPageContext() (pc PageContext, err error)

NewPageContext instantiates and returns a PageContext with "global" data already set.

Jump to

Keyboard shortcuts

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