app

package
v0.0.0-...-12949dc Latest Latest
Warning

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

Go to latest
Published: May 20, 2018 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const APIVERSION string = "/v1"

APIVERSION current supported version

Variables

This section is empty.

Functions

func BlockHandler

func BlockHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

BlockHandler will pass the call from /debug/pprof/block to pprof

func CmdlineHandler

func CmdlineHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

CmdlineHandler will pass the call from /debug/pprof/cmdline to pprof

func DeleteContext

func DeleteContext(ctx *Context) error

DeleteContext app context and HTTP Server

func Execute

func Execute() error

Execute starts application and waits for ctrl+c

func GoroutineHandler

func GoroutineHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

GoroutineHandler will pass the call from /debug/pprof/goroutine to pprof

func HealthCheckHandler

func HealthCheckHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

HealthCheckHandler provides health check for external monitoring applications

func HeapHandler

func HeapHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

HeapHandler will pass the call from /debug/pprof/heap to pprof

func IndexHandler

func IndexHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

IndexHandler will pass the call from /debug/pprof to pprof

func LoggerMiddleware

func LoggerMiddleware(next httprouter.Handle) httprouter.Handle

LoggerMiddleware Handler

func MutexHandler

func MutexHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

MutexHandler will pass the call from /debug/pprof/mutex to pprof

func NewAppRouter

func NewAppRouter(ctx *Context) http.Handler

NewAppRouter registers multiple logged routes

func ProfileHandler

func ProfileHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

ProfileHandler will pass the call from /debug/pprof/profile to pprof

func SymbolHandler

func SymbolHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

SymbolHandler will pass the call from /debug/pprof/symbol to pprof

func ThreadCreateHandler

func ThreadCreateHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

ThreadCreateHandler will pass the call from /debug/pprof/threadcreate to pprof

func TraceHandler

func TraceHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params)

TraceHandler will pass the call from /debug/pprof/trace to pprof

Types

type Config

type Config struct {
	Port   string
	Stores []Store
}

Config context for this application

func (*Config) Initialize

func (cfg *Config) Initialize(name, dir string) error

Initialize AppConfig with sample yaml file provided above

func (*Config) Log

func (cfg *Config) Log()

Log AppConfig mainly used for debugging purposes

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context stores local and aggregate stores

func CreateContext

func CreateContext(configName, configDir string) (*Context, error)

CreateContext creates and sets up context, stores and starts HTTP Server

func CreateDefaultContext

func CreateDefaultContext() (*Context, error)

CreateDefaultContext creates and sets up default context, stores and starts HTTP Server

func (*Context) Create

func (ctx *Context) Create() error

Create App context creating router handling multiple REST API

func (*Context) InitializeStores

func (ctx *Context) InitializeStores() error

InitializeStores initializes all the predefined store in configuration

func (*Context) ShutdownStores

func (ctx *Context) ShutdownStores() error

ShutdownStores shutsdown all the predefined store in configuration

func (*Context) SyncAggregateURLs

func (ctx *Context) SyncAggregateURLs(store *CoreStores, aggregateURLs []string, syncIntervalsecs time.Duration)

SyncAggregateURLs performs sync of key values from remote stores Requires Extensive error checking, metrics, alerting

type CoreStores

type CoreStores struct {
	// contains filtered or unexported fields
}

CoreStores contains primary and optional backup store

type Route

type Route struct {
	Method   string
	RouteURI string
	Handler  httprouter.Handle
}

Route defines registration of different routes supported by app

type Store

type Store struct {
	Name            string
	Backup          string
	Backupdir       string
	AggregateURLs   []string
	SyncIntervalSec int
}

Store details for this application primary store is always inmemory with optional backup store along with backup directory also aggregte urls for aggregating multiple stores into the primary

Jump to

Keyboard shortcuts

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