Package shimx specifies the templates for generating type assertion shims for Apache Beam Go SDK pipelines.
In particular, the shims are used by the Beam Go SDK to avoid reflection at runtime, which is the default mode of operation. The shims are specialized for the code in question, using type assertion to convert arguments as required, and invoke the user code.
Similar shims are required for emitters, and iterators in order to propagate values out of, and in to user functions respectively without reflection overhead.
Registering user types is required to support user types as PCollection types, while registering functions is required to avoid possibly expensive function resolution at worker start up, which defaults to using DWARF Symbol tables.
The generator largely relies on basic types and strings to ensure that it's usable by dynamic processes via reflection, or by any static analysis approach that is used in the future.
var ( ExecImport = "github.com/apache/beam/sdks/go/pkg/beam/core/runtime/exec" TypexImport = "github.com/apache/beam/sdks/go/pkg/beam/core/typex" ReflectxImport = "github.com/apache/beam/sdks/go/pkg/beam/core/util/reflectx" RuntimeImport = "github.com/apache/beam/sdks/go/pkg/beam/core/runtime" )
Beam imports that the generated code requires.
func FuncName ¶
FuncName returns a compilable Go identifier for a function, given valid type names as generated by Name. See https://golang.org/ref/spec#Identifiers for details.
type Emitter ¶
Emitter represents an emitter shim to be generated.
type Func ¶
Func represents a type assertion shim for function invocation to be generated.
type Input ¶
Input represents an iterator shim to be generated.
type Top ¶
Top is the top level inputs into the template file for generating shims.