contextreg

package
v2.55.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0, BSD-3-Clause, MIT Imports: 3 Imported by: 0

Documentation

Overview

Package contextreg contains the global registrations of functions for extracting ptransform annotations or environment resource hints from context.Context attached to scopes.

For beam internal use only. API subject to change.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EnvironmentMetadata

type EnvironmentMetadata struct {
	ResourceHints map[string][]byte
}

EnvironmentMetadata represent additional information on environmental requirements to be added to the Pipeline proto graph.

type Registry

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

Registry contains a set of registrations for extracting annotations and hints from a context.Context.

This type is exported to allow simpler testing of new extractors, and their interaction with the registry.

func Default

func Default() *Registry

Default is the default registry for context extractors.

func (*Registry) EnvExtrator

func (r *Registry) EnvExtrator(ext func(context.Context) EnvironmentMetadata)

EnvExtrator registers an environment metadata extractor to this registry. When non-empty extraction occurs, a new environment will be derived from the parent scopes environment.

func (*Registry) ExtractEnvironmentMetadata

func (r *Registry) ExtractEnvironmentMetadata(ctx context.Context) EnvironmentMetadata

ExtractEnvironmentMetadata runs all registered environment extractors on the provided context, and returns the resulting metadata.

A metadata field will be nil if there's no data. A nil context bypasses extractor execution.

func (*Registry) ExtractTransformMetadata

func (r *Registry) ExtractTransformMetadata(ctx context.Context) TransformMetadata

ExtractTransformMetadata runs all registered transform extractors on the provided context, and returns the resulting metadata.

A metadata field will be nil if there's no data. A nil context bypasses extractor execution.

func (*Registry) TransformExtractor

func (r *Registry) TransformExtractor(ext func(context.Context) TransformMetadata)

TransformExtractor registers a transform metadata extractor to this registry. These will be set on the current composite transform scope. They are accessible to runners via the transform hypergraph.

type TransformMetadata

type TransformMetadata struct {
	Annotations map[string][]byte
}

TransformMetadata represents additional information on transforms to be added to the Pipeline proto graph.

Jump to

Keyboard shortcuts

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