Documentation ¶
Overview ¶
Package runtime contains runtime hooks and utilities for pipeline options and type registration. Most functionality done in init and hence is available both during pipeline-submission and at runtime.
Index ¶
- Variables
- func Init()
- func Initialized() bool
- func LookupType(key string) (reflect.Type, bool)
- func RegisterFunction(fn interface{})
- func RegisterInit(hook func())
- func RegisterType(t reflect.Type) string
- func ResolveFunction(name string, t reflect.Type) (interface{}, error)
- func TypeKey(t reflect.Type) (string, bool)
- type Options
- type RawOptions
- type RawOptionsWrapper
- type SymbolResolver
Constants ¶
This section is empty.
Variables ¶
var GlobalOptions = NewOptions()
GlobalOptions are the global options for the active graph. Options can be defined at any time before execution and are re-created by the harness on remote execution workers. Global options should be used sparingly.
Functions ¶
func Init ¶
func Init()
Init is the hook that all user code must call after flags processing and other static initialization, for now.
func Initialized ¶
func Initialized() bool
Initialized exposes the initialization status for runners.
func LookupType ¶
LookupType looks up a type in the global type registry by external key.
func RegisterFunction ¶
func RegisterFunction(fn interface{})
RegisterFunction allows function registration. It is beneficial for performance and is needed for functions -- such as custom coders -- serialized during unit tests, where the underlying symbol table is not available. It should be called in `init()` only.
func RegisterInit ¶
func RegisterInit(hook func())
RegisterInit registers an Init hook. Hooks are expected to be able to figure out whether they apply on their own, notably if invoked in a remote execution environment. They are all executed regardless of the runner.
func RegisterType ¶
RegisterType inserts "external" types into a global type registry to bypass serialization and preserve full method information. It should be called in init() only. Returns the external key for the type.
func ResolveFunction ¶
ResolveFunction resolves the runtime value of a given function by symbol name and type.
Types ¶
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options are untyped options.
func NewOptions ¶ added in v2.35.0
func NewOptions() *Options
NewOptions provides an initialized set of options. It is only intended for framework and test use.
func (*Options) Export ¶
func (o *Options) Export() RawOptions
Export returns a JSON-serializable copy of the options.
func (*Options) Import ¶
func (o *Options) Import(opt RawOptions)
Import imports the options from previously exported data and makes the options read-only. It panics if import is called twice.
func (*Options) LoadOptionsFromFlags ¶ added in v2.37.0
LoadOptionsFromFlags adds any flags not defined in excludeFlags to the options. If the key is already defnined, it ignores that flag
type RawOptions ¶
RawOptions represents exported options as JSON-serializable data. Exact representation is subject to change.
type RawOptionsWrapper ¶
type RawOptionsWrapper struct { Options RawOptions `json:"beam:option:go_options:v1"` Runner string `json:"beam:option:runner:v1"` AppName string `json:"beam:option:app_name:v1"` Experiments []string `json:"beam:option:experiments:v1"` RetainDocker bool `json:"beam:option:retain_docker_containers:v1"` Parallelism int `json:"beam:option:parallelism:v1"` }
RawOptionsWrapper wraps RawOptions to the form expected by the harness. The extra layer is currently needed due to Dataflow expectations about this representation. Subject to change.
type SymbolResolver ¶
type SymbolResolver interface { // Sym2Addr returns the address pointer for a given symbol. Sym2Addr(string) (uintptr, error) }
SymbolResolver resolves a symbol to an unsafe address.
var ( // Resolver is the accessible symbol resolver the runtime uses to find functions. Resolver SymbolResolver )
Directories ¶
Path | Synopsis |
---|---|
Package coderx contains coders for primitive types that aren't included in the beam model.
|
Package coderx contains coders for primitive types that aren't included in the beam model. |
Package exec contains runtime plan representation and execution.
|
Package exec contains runtime plan representation and execution. |
optimized
Package optimized contains type-specialized shims for faster execution.
|
Package optimized contains type-specialized shims for faster execution. |
Package genx is a convenience package to better support the code generator.
|
Package genx is a convenience package to better support the code generator. |
Package graphx provides facilities to help with the serialization of pipelines into a serializable graph structure suitable for the worker.
|
Package graphx provides facilities to help with the serialization of pipelines into a serializable graph structure suitable for the worker. |
schema
Package schema contains utility functions for relating Go types and Beam Schemas.
|
Package schema contains utility functions for relating Go types and Beam Schemas. |
Package harness implements the SDK side of the Beam FnAPI.
|
Package harness implements the SDK side of the Beam FnAPI. |
init
Package init contains the harness initialization code defined by the FnAPI.
|
Package init contains the harness initialization code defined by the FnAPI. |
statecache
Package statecache implements the state caching feature described by the Beam Fn API The Beam State API and the intended caching behavior are described here: https://docs.google.com/document/d/1BOozW0bzBuz4oHJEuZNDOHdzaV5Y56ix58Ozrqm2jFg/edit#heading=h.7ghoih5aig5m
|
Package statecache implements the state caching feature described by the Beam Fn API The Beam State API and the intended caching behavior are described here: https://docs.google.com/document/d/1BOozW0bzBuz4oHJEuZNDOHdzaV5Y56ix58Ozrqm2jFg/edit#heading=h.7ghoih5aig5m |
Package pipelinex contains utilities for manipulating Beam proto pipelines.
|
Package pipelinex contains utilities for manipulating Beam proto pipelines. |
Package xlangx contains various low-level utilities needed for adding cross-language transforms to the pipeline.
|
Package xlangx contains various low-level utilities needed for adding cross-language transforms to the pipeline. |
expansionx
Package expansionx contains utilities for starting expansion services for cross-language transforms.
|
Package expansionx contains utilities for starting expansion services for cross-language transforms. |