server

package
v0.0.0-...-888a0f9 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInternalServerError = errors.New("Something unexpected happened on the server")
View Source
var Version = "0.1.77"

Version of IronFunctions

Functions

func DefaultEnqueue

func DefaultEnqueue(ctx context.Context, mq models.MessageQueue, task *models.Task) (*models.Task, error)

func ToEnvName

func ToEnvName(envtype, name string) string

Types

type AppCreateListener

type AppCreateListener interface {
	// BeforeAppCreate called right before creating App in the database
	BeforeAppCreate(ctx context.Context, app *models.App) error
	// AfterAppCreate called after creating App in the database
	AfterAppCreate(ctx context.Context, app *models.App) error
}

type AppDeleteListener

type AppDeleteListener interface {
	// BeforeAppDelete called right before deleting App in the database
	BeforeAppDelete(ctx context.Context, app *models.App) error
	// AfterAppDelete called after deleting App in the database
	AfterAppDelete(ctx context.Context, app *models.App) error
}

type AppUpdateListener

type AppUpdateListener interface {
	// BeforeAppUpdate called right before updating App in the database
	BeforeAppUpdate(ctx context.Context, app *models.App) error
	// AfterAppUpdate called after updating App in the database
	AfterAppUpdate(ctx context.Context, app *models.App) error
}

type Handle

type Handle func(http.ResponseWriter, *http.Request, Params)

type HandlerContext

type HandlerContext interface {
	// Context return the context object
	Context() context.Context

	// Request returns the underlying http.Request object
	Request() *http.Request

	// Datastore returns the models.Datastore object. Not that this has arbitrary key value store methods that can be used to store extra data
	Datastore() models.Datastore

	// Set and Get values on the context, this can be useful to change behavior for the rest of the request
	Set(key string, value interface{})
	Get(key string) (value interface{}, exists bool)
}

Each handler can modify the context here so when it gets passed along, it will use the new info. Not using Gin's Context so we don't lock ourselves into Gin, this is a subset of the Gin context.

type Param

type Param struct {
	Key   string
	Value string
}

type Params

type Params []Param

type RunnerListener

type RunnerListener interface {
	// BeforeDispatch called before a function run
	BeforeDispatch(ctx context.Context, route *models.Route) error
	// AfterDispatch called after a function run
	AfterDispatch(ctx context.Context, route *models.Route) error
}

type Server

type Server struct {
	Datastore models.Datastore
	Runner    *runner.Runner
	Router    *gin.Engine
	MQ        models.MessageQueue
	Enqueue   models.Enqueue
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, ds models.Datastore, mq models.MessageQueue, r *runner.Runner, tasks chan task.Request, enqueue models.Enqueue) *Server

func (*Server) AddAppCreateListener

func (s *Server) AddAppCreateListener(listener AppCreateListener)

AddAppCreateListener adds a listener that will be notified on App created.

func (*Server) AddAppDeleteListener

func (s *Server) AddAppDeleteListener(listener AppDeleteListener)

AddAppDeleteListener adds a listener that will be notified on App deleted.

func (*Server) AddAppUpdateListener

func (s *Server) AddAppUpdateListener(listener AppUpdateListener)

AddAppUpdateListener adds a listener that will be notified on App updated.

func (*Server) AddRunnerListener

func (s *Server) AddRunnerListener(listener RunnerListener)

AddRunListeners adds a listener that will be fired before and after a function run.

func (*Server) AddSpecialHandler

func (s *Server) AddSpecialHandler(handler SpecialHandler)

func (*Server) FireAfterAppCreate

func (s *Server) FireAfterAppCreate(ctx context.Context, app *models.App) error

func (*Server) FireAfterAppDelete

func (s *Server) FireAfterAppDelete(ctx context.Context, app *models.App) error

func (*Server) FireAfterAppUpdate

func (s *Server) FireAfterAppUpdate(ctx context.Context, app *models.App) error

func (*Server) FireAfterDispatch

func (s *Server) FireAfterDispatch(ctx context.Context, route *models.Route) error

func (*Server) FireBeforeAppCreate

func (s *Server) FireBeforeAppCreate(ctx context.Context, app *models.App) error

func (*Server) FireBeforeAppDelete

func (s *Server) FireBeforeAppDelete(ctx context.Context, app *models.App) error

func (*Server) FireBeforeAppUpdate

func (s *Server) FireBeforeAppUpdate(ctx context.Context, app *models.App) error

func (*Server) FireBeforeDispatch

func (s *Server) FireBeforeDispatch(ctx context.Context, route *models.Route) error

func (*Server) Run

func (s *Server) Run()

func (*Server) UseSpecialHandlers

func (s *Server) UseSpecialHandlers(ginC *gin.Context) error

type SpecialHandler

type SpecialHandler interface {
	Handle(c HandlerContext) error
}

type SpecialHandlerContext

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

func (*SpecialHandlerContext) Context

func (c *SpecialHandlerContext) Context() context.Context

func (*SpecialHandlerContext) Datastore

func (c *SpecialHandlerContext) Datastore() models.Datastore

func (*SpecialHandlerContext) Get

func (c *SpecialHandlerContext) Get(key string) (value interface{}, exists bool)

func (*SpecialHandlerContext) Request

func (c *SpecialHandlerContext) Request() *http.Request

func (*SpecialHandlerContext) Set

func (c *SpecialHandlerContext) Set(key string, value interface{})

Jump to

Keyboard shortcuts

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