Back to godoc.org
github.com/apache/beam / sdks / go / pkg / beam / core / runtime

package runtime

v2.22.0+incompatible
Latest Go to latest
Published: Jun 3, 2020 | License: Apache-2.0 | Module: github.com/apache/beam

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

var GlobalOptions = &Options{opt: make(map[string]string)}

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.

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

func LookupType(key string) (reflect.Type, bool)

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. Returns the external key for the function.

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

func RegisterType(t reflect.Type) string

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

func ResolveFunction(name string, t reflect.Type) (interface{}, error)

ResolveFunction resolves the runtime value of a given function by symbol name and type.

func TypeKey

func TypeKey(t reflect.Type) (string, bool)

TypeKey returns the external key of a given type. Returns false if not a candidate for registration.

type Options

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

Options are untyped options.

func (*Options) Export

func (o *Options) Export() RawOptions

Export returns a JSON-serializable copy of the options.

func (*Options) Get

func (o *Options) Get(key string) string

Get returns the value of the key. If the key has not been set, it returns "".

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) Set

func (o *Options) Set(key, value string)

Set defines the value of the given key. If the key is already defined, it panics.

type RawOptions

type RawOptions struct {
	Options map[string]string `json:"options"`
}

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"`
}

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
)
Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier