runtime

package
v2.5.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2018 License: Apache-2.0, BSD-3-Clause, MIT Imports: 6 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
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.

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 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.

Types

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

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

Directories

Path Synopsis
Package coderx contains primitive coders.
Package coderx contains primitive coders.
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 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.
v1
Package v1 is a generated protocol buffer package.
Package v1 is a generated protocol buffer package.
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.
session
Package session is a generated protocol buffer package.
Package session is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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