headers

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2020 License: MIT Imports: 5 Imported by: 8

Documentation

Index

Constants

View Source
const (
	// ClientVersionHeaderName refers to the name of the gRPC metadata header that contains the client version.
	ClientVersionHeaderName = "temporal-client-version"

	// ClientFeatureVersionHeaderName refers to the name of the gRPC metadata header that contains the client feature set version.
	// The feature set version is sent from client represents the feature set of the client supports.
	// This can be used for client capability check, on Temporal server, for backward compatibility.
	ClientFeatureVersionHeaderName = "temporal-client-feature-version"

	// ClientImplHeaderName refers to the name of the gRPC metadata header that contains the client implementation.
	ClientImplHeaderName = "temporal-client-name"
)
View Source
const (
	// GoSDK is the header value for common.ClientImplHeaderName indicating a Go SDK.
	GoSDK = "temporal-go"
	// JavaSDK is the header value for common.ClientImplHeaderName indicating a Java SDK.
	JavaSDK = "temporal-java"
	// CLI is the header value for common.ClientImplHeaderName indicating a CLI client.
	CLI = "cli"

	// SupportedGoSDKVersion indicates the highest Go SDK version server will accept requests from.
	SupportedGoSDKVersion = "0.99.0"
	// SupportedJavaSDKVersion indicates the highest Java SDK version server will accept requests from.
	// TODO(maxim): Fix before the first prod release
	SupportedJavaSDKVersion = "0.99.0"
	// SupportedCLIVersion indicates the highest CLI version server will accept requests from.
	SupportedCLIVersion = "0.99.0"

	// BaseFeaturesFeatureVersion indicates the minimum client feature set version which supports all base features.
	BaseFeaturesFeatureVersion = "1.0.0"
)

Variables

This section is empty.

Functions

func GetValues

func GetValues(ctx context.Context, headerNames ...string) []string

GetValues returns header values for passed header names. It always returns slice of the same size as number of passed header names.

func NewVersionChecker

func NewVersionChecker() *versionChecker

NewVersionChecker constructs a new VersionChecker

func PropagateVersions

func PropagateVersions(ctx context.Context) context.Context

PropagateVersions propagates version headers from incoming context to outgoing context. It copies all version headers to outgoing context only if they are exist in incoming context and doesn't exist in outgoing context already.

func SetCLIVersions

func SetCLIVersions(ctx context.Context) context.Context

SetCLIVersions sets headers for CLI requests.

func SetVersions

func SetVersions(ctx context.Context) context.Context

SetVersions sets headers for internal communications.

func SetVersionsForTests

func SetVersionsForTests(ctx context.Context, clientVersion, clientImpl, clientFeatureVersion string) context.Context

SetVersionsForTests sets headers as they would be received from the client. Must be used in tests only.

Types

type VersionChecker

type VersionChecker interface {
	ClientSupported(ctx context.Context, enableClientVersionCheck bool) error
	SupportsBaseFeatures(clientFeatureVersion string) error
}

VersionChecker is used to check client/server compatibility and client's capabilities

Jump to

Keyboard shortcuts

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