js

package
v0.0.0-...-e5281c0 Latest Latest
Warning

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

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

Documentation

Overview

This package implements vulcan controller and is based on Robert Krimen's Otto javascript magnificent interpreter.

Index

Constants

View Source
const SKIP_CONTEXT_CACHE = false
View Source
const SKIP_FILE_CACHE = false

Variables

This section is empty.

Functions

This section is empty.

Types

type CodeGetter

type CodeGetter interface {
	GetCode() (string, error)
	GetHash() (string, error)
}

type ContextPool

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

TODO(pquerna): Remove once Go 1.3 is out <https://code.google.com/p/go/issues/detail?id=4720>

func NewContextPool

func NewContextPool(ctrl *JsController) *ContextPool

func (*ContextPool) Get

func (p *ContextPool) Get() (*JsContext, error)

func (*ContextPool) New

func (p *ContextPool) New() (*JsContext, error)

func (*ContextPool) Put

func (p *ContextPool) Put(jsc *JsContext)

type FileGetter

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

func NewFileGetter

func NewFileGetter(path string) *FileGetter

func (*FileGetter) GetCode

func (fg *FileGetter) GetCode() (string, error)

func (*FileGetter) GetHash

func (fg *FileGetter) GetHash() (string, error)

type JsContext

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

func NewJsContext

func NewJsContext() *JsContext

func (*JsContext) Release

func (jsc *JsContext) Release()

type JsController

type JsController struct {
	// Discovery service interface, Zookeeper or Etcd can hide behind
	// the simple interface.
	DiscoveryService discovery.Service
	// Code getter is responsible for fetching the request from file,
	// hardcoded string or discovery service.
	CodeGetter CodeGetter
	// Client allows controlller to issue concurrent get requests
	// within the javascript handler.
	Client client.Client
	// contains filtered or unexported fields
}

func (*JsController) ConvertError

func (ctrl *JsController) ConvertError(req *http.Request, inError error) (response *netutils.HttpError, err error)

func (*JsController) GetInstructions

func (ctrl *JsController) GetInstructions(req *http.Request) (interface{}, error)

type ResponseWriter

type ResponseWriter struct {
	Headers http.Header
	Code    int
	Bytes   *bytes.Buffer
}

func NewResponseWriter

func NewResponseWriter() *ResponseWriter

func (*ResponseWriter) Header

func (w *ResponseWriter) Header() http.Header

func (*ResponseWriter) ToReply

func (w *ResponseWriter) ToReply() map[string]interface{}

func (*ResponseWriter) Write

func (w *ResponseWriter) Write(b []byte) (int, error)

func (*ResponseWriter) WriteHeader

func (w *ResponseWriter) WriteHeader(code int)

type StringGetter

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

func NewStringGetter

func NewStringGetter(code string) *StringGetter

func (*StringGetter) GetCode

func (sg *StringGetter) GetCode() (string, error)

func (*StringGetter) GetHash

func (sg *StringGetter) GetHash() (string, error)

Jump to

Keyboard shortcuts

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