starlarkutil

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ThreadContextKey is the name of the Starlark thread-local that we use to
	// pass context around.
	ThreadContextKey = "tidbyt.dev/pixlet/starlarkutil/$ctx"
)
View Source
const (
	// ThreadOnExitKey is the key used to store functions that should be called
	// when a thread exits.
	ThreadOnExitKey = "tidbyt.dev/pixlet/runtime/on_exit"
)

Variables

This section is empty.

Functions

func AddOnExit added in v0.32.0

func AddOnExit(thread *starlark.Thread, fn threadOnExitFunc)

func AttachThreadContext

func AttachThreadContext(ctx context.Context, thread *starlark.Thread)

AttachThreadContext attaches context to a Starlark thread so that it can be retrieved latter with `ThreadContext`.

func RunOnExitFuncs added in v0.32.0

func RunOnExitFuncs(thread *starlark.Thread)

func ThreadContext

func ThreadContext(thread *starlark.Thread) context.Context

ThreadContext returns the context that was attached to a Starlark thread by `AttachThreadContext`. If no context is attached to the thread, it returns a new, empty context.

Types

This section is empty.

Jump to

Keyboard shortcuts

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