context

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LoggerKey        = "$$logger"
	RuleStartKey     = "$$ruleStart"
	RuleWaitGroupKey = "$$ruleWaitGroup"
	TraceStrategyKey = "$$TraceStrategyKey"
)
View Source
const (
	AlwaysTraceStrategy = iota
	HeadTraceStrategy
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultContext

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

func Background

func Background() *DefaultContext

func RuleBackground

func RuleBackground(ruleName string) *DefaultContext

func WithContext

func WithContext(ctx context.Context) *DefaultContext

func WithValue

func WithValue(parent *DefaultContext, key, val interface{}) *DefaultContext

func (*DefaultContext) Deadline

func (c *DefaultContext) Deadline() (deadline time.Time, ok bool)

Deadline Implement context interface

func (*DefaultContext) DeleteState

func (c *DefaultContext) DeleteState(key string) error

func (*DefaultContext) Done

func (c *DefaultContext) Done() <-chan struct{}

func (*DefaultContext) EnableTracer

func (c *DefaultContext) EnableTracer(enabled bool)

func (*DefaultContext) Err

func (c *DefaultContext) Err() error

func (*DefaultContext) GetContext

func (c *DefaultContext) GetContext() context.Context

func (*DefaultContext) GetCounter

func (c *DefaultContext) GetCounter(key string) (int, error)

func (*DefaultContext) GetInstanceId

func (c *DefaultContext) GetInstanceId() int

func (*DefaultContext) GetLogger

func (c *DefaultContext) GetLogger() api.Logger

func (*DefaultContext) GetOpId

func (c *DefaultContext) GetOpId() string

func (*DefaultContext) GetRootPath

func (c *DefaultContext) GetRootPath() string

func (*DefaultContext) GetRuleId

func (c *DefaultContext) GetRuleId() string

func (*DefaultContext) GetState

func (c *DefaultContext) GetState(key string) (interface{}, error)

func (*DefaultContext) GetStrategy

func (c *DefaultContext) GetStrategy() TraceStrategy

func (*DefaultContext) IncrCounter

func (c *DefaultContext) IncrCounter(key string, amount int) error

func (*DefaultContext) IsTraceEnabled

func (c *DefaultContext) IsTraceEnabled() bool

func (*DefaultContext) ParseJsonPath

func (c *DefaultContext) ParseJsonPath(prop string, data interface{}) (interface{}, error)

func (*DefaultContext) ParseTemplate

func (c *DefaultContext) ParseTemplate(prop string, data interface{}) (string, error)

ParseTemplate parse template string against data The templates are built only once and cached in the context by its raw string as the key If the prop string is not a template, a nil template is cached to indicate it has been parsed, and it will return the original string

func (*DefaultContext) PropagateTracer

func (c *DefaultContext) PropagateTracer(par *DefaultContext)

func (*DefaultContext) PutState

func (c *DefaultContext) PutState(key string, value interface{}) error

func (*DefaultContext) SaveState

func (c *DefaultContext) SaveState(checkpointId int64) error

func (*DefaultContext) SetError

func (c *DefaultContext) SetError(err error)

func (*DefaultContext) SetStrategy

func (c *DefaultContext) SetStrategy(s TraceStrategy)

func (*DefaultContext) Snapshot

func (c *DefaultContext) Snapshot() error

func (*DefaultContext) Value

func (c *DefaultContext) Value(key interface{}) interface{}

func (*DefaultContext) WithCancel

func (c *DefaultContext) WithCancel() (api.StreamContext, context.CancelFunc)

func (*DefaultContext) WithInstance

func (c *DefaultContext) WithInstance(instanceId int) api.StreamContext

func (*DefaultContext) WithMeta

func (c *DefaultContext) WithMeta(ruleId string, opId string, store api.Store) api.StreamContext

type DefaultFuncContext

type DefaultFuncContext struct {
	api.StreamContext
	// contains filtered or unexported fields
}

func NewDefaultFuncContext

func NewDefaultFuncContext(ctx api.StreamContext, id int) *DefaultFuncContext

func (*DefaultFuncContext) DeleteState

func (c *DefaultFuncContext) DeleteState(key string) error

func (*DefaultFuncContext) GetCounter

func (c *DefaultFuncContext) GetCounter(key string) (int, error)

func (*DefaultFuncContext) GetFuncId

func (c *DefaultFuncContext) GetFuncId() int

func (*DefaultFuncContext) GetState

func (c *DefaultFuncContext) GetState(key string) (interface{}, error)

func (*DefaultFuncContext) IncrCounter

func (c *DefaultFuncContext) IncrCounter(key string, amount int) error

func (*DefaultFuncContext) PutState

func (c *DefaultFuncContext) PutState(key string, value interface{}) error

type TraceStrategy

type TraceStrategy int

func StringToStrategy

func StringToStrategy(s string) TraceStrategy

type TraceStrategyWrapper

type TraceStrategyWrapper struct {
	sync.RWMutex
	Strategy TraceStrategy
}

Jump to

Keyboard shortcuts

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