handler

package module
v0.0.0-...-d70acd0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: Apache-2.0 Imports: 11 Imported by: 150

Documentation

Index

Constants

View Source
const (
	Key         = key("session")
	InputKey    = inputKey("input")
	DataSyncKey = syncKey("dataSync")
)

Variables

This section is empty.

Functions

func IsCacheWarmup

func IsCacheWarmup(ctx context.Context) bool

func WithCacheWarmup

func WithCacheWarmup(ctx context.Context, phase WarmupPhase) context.Context

WithCacheWarmup marks a trusted runtime-owned warmup phase. Transport values must never be converted into this context capability.

Types

type DataSync

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

DataSync represents data sync

func NewDataSync

func NewDataSync() *DataSync

func (*DataSync) Delete

func (d *DataSync) Delete(key string)

func (*DataSync) Get

func (d *DataSync) Get(key string) *sync.RWMutex

func (*DataSync) Put

func (d *DataSync) Put(key string)

func (*DataSync) Wait

func (d *DataSync) Wait(key string) bool

type Factory

type Factory interface {
	New(ctx context.Context, options ...Option) (Handler, error)
}

type Handler

type Handler interface {
	Exec(ctx context.Context, session Session) (interface{}, error)
}

type InvocationInfo

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

InvocationInfo is immutable execution metadata propagated through context. Private fields prevent consumers from changing the capability selected by the runtime after retrieving it.

func InvocationFromContext

func InvocationFromContext(ctx context.Context) *InvocationInfo

InvocationFromContext returns request metadata when no explicit invocation descriptor has been installed.

func (*InvocationInfo) IsCacheWarmup

func (i *InvocationInfo) IsCacheWarmup() bool

func (*InvocationInfo) MayBypassRowAuthorization

func (i *InvocationInfo) MayBypassRowAuthorization() bool

MayBypassRowAuthorization reports an explicit runtime capability. Consumers should not infer authorization policy from IsCacheWarmup alone.

func (*InvocationInfo) Purpose

func (i *InvocationInfo) Purpose() InvocationPurpose

func (*InvocationInfo) WarmupPhase

func (i *InvocationInfo) WarmupPhase() WarmupPhase

type InvocationPurpose

type InvocationPurpose uint8

InvocationPurpose identifies why a handler or predicate is executing.

const (
	InvocationPurposeRequest InvocationPurpose = iota
	InvocationPurposeCacheWarmup
)

type Option

type Option func(o *Options)

func WithArguments

func WithArguments(args []string) Option

WithArguments creates arguments option

func WithInputType

func WithInputType(inputType reflect.Type) Option

WithInputType creates inputType option

func WithLookupType

func WithLookupType(fn func(name string) (reflect.Type, error)) Option

WithLookupType creates lookupType option

func WithOutputType

func WithOutputType(outputType reflect.Type) Option

WithOutputType creates outputType option

type Options

type Options struct {
	Arguments  []string
	InputType  reflect.Type
	OutputType reflect.Type
	LookupType func(name string) (reflect.Type, error)
}

func NewOptions

func NewOptions(opts []Option) *Options

NewOptions creates an options

type Session

type Session interface {
	Validator() *validator.Service
	Differ() *differ.Service
	MessageBus() *mbus.Service
	Db(opts ...sqlx.Option) (*sqlx.Service, error)
	Stater() *state.Service
	FlushTemplate(ctx context.Context) error
	Session(ctx context.Context, route *http.Route, opts ...state.Option) (Session, error)
	Http() http.Http
	Auth() auth.Auth
	Logger() logger.Logger
}

type WarmupPhase

type WarmupPhase uint8

WarmupPhase distinguishes warmup validation from the cache-filling phase.

const (
	WarmupPhaseNone WarmupPhase = iota
	WarmupPhasePrepare
	WarmupPhaseFill
)

Jump to

Keyboard shortcuts

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