Documentation ¶
Index ¶
- Constants
- Variables
- type DebugState
- type Debugger
- type DefaultDebugger
- type Interpreter
- func (i *Interpreter) IdentValue(val string, withCondition bool) (value.Value, error)
- func (i *Interpreter) ProcessAddStatement(stmt *ast.AddStatement) error
- func (i *Interpreter) ProcessBlockStatement(statements []ast.Statement, ds DebugState) (State, DebugState, error)
- func (i *Interpreter) ProcessCallStatement(stmt *ast.CallStatement, ds DebugState) (State, error)
- func (i *Interpreter) ProcessDeclarations(statements []ast.Statement) error
- func (i *Interpreter) ProcessDeclareStatement(stmt *ast.DeclareStatement) error
- func (i *Interpreter) ProcessDeliver() error
- func (i *Interpreter) ProcessError() error
- func (i *Interpreter) ProcessErrorStatement(stmt *ast.ErrorStatement) error
- func (i *Interpreter) ProcessEsiStatement(stmt *ast.EsiStatement) error
- func (i *Interpreter) ProcessExpression(exp ast.Expression, withCondition bool) (value.Value, error)
- func (i *Interpreter) ProcessFetch() error
- func (i *Interpreter) ProcessFunctionCallExpression(exp *ast.FunctionCallExpression, withCondition bool) (value.Value, error)
- func (i *Interpreter) ProcessFunctionCallStatement(stmt *ast.FunctionCallStatement, ds DebugState) (State, error)
- func (i *Interpreter) ProcessFunctionReturnStatement(stmt *ast.ReturnStatement) (value.Value, State, error)
- func (i *Interpreter) ProcessFunctionSubroutine(sub *ast.SubroutineDeclaration, ds DebugState) (value.Value, State, error)
- func (i *Interpreter) ProcessGroupedExpression(exp *ast.GroupedExpression) (value.Value, error)
- func (i *Interpreter) ProcessHash() error
- func (i *Interpreter) ProcessHit() error
- func (i *Interpreter) ProcessIfExpression(exp *ast.IfExpression) (value.Value, error)
- func (i *Interpreter) ProcessIfStatement(stmt *ast.IfStatement, ds DebugState) (State, error)
- func (i *Interpreter) ProcessInfixExpression(exp *ast.InfixExpression, withCondition bool) (value.Value, error)
- func (i *Interpreter) ProcessInit(r *http.Request) error
- func (i *Interpreter) ProcessLog() error
- func (i *Interpreter) ProcessLogStatement(stmt *ast.LogStatement) error
- func (i *Interpreter) ProcessMiss() error
- func (i *Interpreter) ProcessPass() error
- func (i *Interpreter) ProcessPrefixExpression(exp *ast.PrefixExpression, withCondition bool) (value.Value, error)
- func (i *Interpreter) ProcessRecv() error
- func (i *Interpreter) ProcessRemoveStatement(stmt *ast.RemoveStatement) error
- func (i *Interpreter) ProcessReturnStatement(stmt *ast.ReturnStatement) State
- func (i *Interpreter) ProcessSetStatement(stmt *ast.SetStatement) error
- func (i *Interpreter) ProcessSubroutine(sub *ast.SubroutineDeclaration, ds DebugState) (State, error)
- func (i *Interpreter) ProcessSyntheticBase64Statement(stmt *ast.SyntheticBase64Statement) error
- func (i *Interpreter) ProcessSyntheticStatement(stmt *ast.SyntheticStatement) error
- func (i *Interpreter) ProcessTestSubroutine(scope context.Scope, sub *ast.SubroutineDeclaration) error
- func (i *Interpreter) ProcessUnsetStatement(stmt *ast.UnsetStatement) error
- func (i *Interpreter) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (i *Interpreter) SetScope(scope context.Scope)
- func (i *Interpreter) TestProcessInit(r *http.Request) error
- type State
Constants ¶
View Source
const ( DIRECTORTYPE_RANDOM = "random" DIRECTORTYPE_FALLBACK = "fallback" DIRECTORTYPE_HASH = "hash" DIRECTORTYPE_CLIENT = "client" DIRECTORTYPE_CHASH = "chash" )
View Source
const HTTPS_SCHEME = "https"
Variables ¶
View Source
var ( ErrQuorumWeightNotReached = errors.New("Quorum weight not reached") ErrAllBackendsFailed = errors.New("All backend failed") )
Functions ¶
This section is empty.
Types ¶
type DebugState ¶
type DebugState int
const ( DebugPass DebugState = iota DebugStepIn DebugStepOver DebugStepOut )
type DefaultDebugger ¶
type DefaultDebugger struct{}
Default debugger, simply output message to stdout
func (DefaultDebugger) Message ¶
func (d DefaultDebugger) Message(msg string)
func (DefaultDebugger) Run ¶
func (d DefaultDebugger) Run(node ast.Node) DebugState
type Interpreter ¶
type Interpreter struct { Debugger Debugger // contains filtered or unexported fields }
func New ¶
func New(options ...context.Option) *Interpreter
func (*Interpreter) IdentValue ¶
func (*Interpreter) ProcessAddStatement ¶
func (i *Interpreter) ProcessAddStatement(stmt *ast.AddStatement) error
func (*Interpreter) ProcessBlockStatement ¶
func (i *Interpreter) ProcessBlockStatement(statements []ast.Statement, ds DebugState) (State, DebugState, error)
func (*Interpreter) ProcessCallStatement ¶
func (i *Interpreter) ProcessCallStatement(stmt *ast.CallStatement, ds DebugState) (State, error)
func (*Interpreter) ProcessDeclarations ¶
func (i *Interpreter) ProcessDeclarations(statements []ast.Statement) error
func (*Interpreter) ProcessDeclareStatement ¶
func (i *Interpreter) ProcessDeclareStatement(stmt *ast.DeclareStatement) error
func (*Interpreter) ProcessDeliver ¶
func (i *Interpreter) ProcessDeliver() error
func (*Interpreter) ProcessError ¶
func (i *Interpreter) ProcessError() error
func (*Interpreter) ProcessErrorStatement ¶
func (i *Interpreter) ProcessErrorStatement(stmt *ast.ErrorStatement) error
func (*Interpreter) ProcessEsiStatement ¶
func (i *Interpreter) ProcessEsiStatement(stmt *ast.EsiStatement) error
func (*Interpreter) ProcessExpression ¶
func (i *Interpreter) ProcessExpression(exp ast.Expression, withCondition bool) (value.Value, error)
Evaluate expression withCondition boolean is special flag for evaluating expression, used for if condition, parenthesis wrapped expression. On if condition, prefix expression could use "!" prefix operator for null value.
For example:
withCondition: true -> if (!req.http.Foo) { ... } // Valid, req.http.Foo is nullable string but can be inverse as false withCondition: false -> set var.bool = (!req.http.Foo); // Complicated but valid, "!" prefix operator could use for right expression withCondition: false -> set var.bool = !req.http.Foo; // Invalid, bare "!" prefix operator could not use for right expression
func (*Interpreter) ProcessFetch ¶
func (i *Interpreter) ProcessFetch() error
func (*Interpreter) ProcessFunctionCallExpression ¶
func (i *Interpreter) ProcessFunctionCallExpression(exp *ast.FunctionCallExpression, withCondition bool) (value.Value, error)
func (*Interpreter) ProcessFunctionCallStatement ¶
func (i *Interpreter) ProcessFunctionCallStatement(stmt *ast.FunctionCallStatement, ds DebugState) (State, error)
func (*Interpreter) ProcessFunctionReturnStatement ¶
func (i *Interpreter) ProcessFunctionReturnStatement(stmt *ast.ReturnStatement) (value.Value, State, error)
func (*Interpreter) ProcessFunctionSubroutine ¶
func (i *Interpreter) ProcessFunctionSubroutine(sub *ast.SubroutineDeclaration, ds DebugState) (value.Value, State, error)
func (*Interpreter) ProcessGroupedExpression ¶
func (i *Interpreter) ProcessGroupedExpression(exp *ast.GroupedExpression) (value.Value, error)
func (*Interpreter) ProcessHash ¶
func (i *Interpreter) ProcessHash() error
func (*Interpreter) ProcessHit ¶
func (i *Interpreter) ProcessHit() error
func (*Interpreter) ProcessIfExpression ¶
func (i *Interpreter) ProcessIfExpression(exp *ast.IfExpression) (value.Value, error)
func (*Interpreter) ProcessIfStatement ¶
func (i *Interpreter) ProcessIfStatement(stmt *ast.IfStatement, ds DebugState) (State, error)
func (*Interpreter) ProcessInfixExpression ¶
func (i *Interpreter) ProcessInfixExpression(exp *ast.InfixExpression, withCondition bool) (value.Value, error)
func (*Interpreter) ProcessInit ¶
func (i *Interpreter) ProcessInit(r *http.Request) error
func (*Interpreter) ProcessLog ¶
func (i *Interpreter) ProcessLog() error
func (*Interpreter) ProcessLogStatement ¶
func (i *Interpreter) ProcessLogStatement(stmt *ast.LogStatement) error
func (*Interpreter) ProcessMiss ¶
func (i *Interpreter) ProcessMiss() error
func (*Interpreter) ProcessPass ¶
func (i *Interpreter) ProcessPass() error
func (*Interpreter) ProcessPrefixExpression ¶
func (i *Interpreter) ProcessPrefixExpression(exp *ast.PrefixExpression, withCondition bool) (value.Value, error)
func (*Interpreter) ProcessRecv ¶
func (i *Interpreter) ProcessRecv() error
func (*Interpreter) ProcessRemoveStatement ¶
func (i *Interpreter) ProcessRemoveStatement(stmt *ast.RemoveStatement) error
func (*Interpreter) ProcessReturnStatement ¶
func (i *Interpreter) ProcessReturnStatement(stmt *ast.ReturnStatement) State
func (*Interpreter) ProcessSetStatement ¶
func (i *Interpreter) ProcessSetStatement(stmt *ast.SetStatement) error
func (*Interpreter) ProcessSubroutine ¶
func (i *Interpreter) ProcessSubroutine(sub *ast.SubroutineDeclaration, ds DebugState) (State, error)
func (*Interpreter) ProcessSyntheticBase64Statement ¶
func (i *Interpreter) ProcessSyntheticBase64Statement(stmt *ast.SyntheticBase64Statement) error
func (*Interpreter) ProcessSyntheticStatement ¶
func (i *Interpreter) ProcessSyntheticStatement(stmt *ast.SyntheticStatement) error
func (*Interpreter) ProcessTestSubroutine ¶
func (i *Interpreter) ProcessTestSubroutine(scope context.Scope, sub *ast.SubroutineDeclaration) error
func (*Interpreter) ProcessUnsetStatement ¶
func (i *Interpreter) ProcessUnsetStatement(stmt *ast.UnsetStatement) error
func (*Interpreter) ServeHTTP ¶
func (i *Interpreter) ServeHTTP(w http.ResponseWriter, r *http.Request)
Implements http.Handler
func (*Interpreter) SetScope ¶
func (i *Interpreter) SetScope(scope context.Scope)
func (*Interpreter) TestProcessInit ¶
func (i *Interpreter) TestProcessInit(r *http.Request) error
type State ¶
type State string
const ( NONE State = "" LOOKUP State = "lookup" PASS State = "pass" HASH State = "hash" ERROR State = "error" RESTART State = "restart" DELIVER State = "deliver" FETCH State = "fetch" DELIVER_STALE State = "deliver_stale" LOG State = "log" END State = "end" INTERNAL_ERROR State = "_internal_error_" )
Source Files ¶
Click to show internal directories.
Click to hide internal directories.