Documentation ¶
Index ¶
- Constants
- Variables
- func GetClientNameAndVersion(ctx context.Context) (string, string)
- func GetValues(ctx context.Context, headerNames ...string) []string
- func NewDefaultVersionChecker() *versionChecker
- func NewVersionChecker(supportedClients map[string]string, serverVersion string) *versionChecker
- func Propagate(ctx context.Context) context.Context
- func SetCallerInfo(ctx context.Context, info CallerInfo) context.Context
- func SetVersions(ctx context.Context) context.Context
- func SetVersionsForTests(ctx context.Context, ...) context.Context
- type CallerInfo
- type VersionChecker
Constants ¶
const ( CallerTypeAPI = "api" CallerTypeBackground = "background" )
const ( ClientNameHeaderName = "client-name" ClientVersionHeaderName = "client-version" SupportedServerVersionsHeaderName = "supported-server-versions" SupportedFeaturesHeaderName = "supported-features" SupportedFeaturesHeaderDelim = "," )
const ( ClientNameServer = "temporal-server" ClientNameGoSDK = "temporal-go" ClientNameJavaSDK = "temporal-java" ClientNamePHPSDK = "temporal-php" ClientNameTypeScriptSDK = "temporal-typescript" ClientNameCLI = "temporal-cli" ClientNameUI = "temporal-ui" ServerVersion = "1.17.2" // SupportedServerVersions is used by CLI and inter role communication. SupportedServerVersions = ">=1.0.0 <2.0.0" // FeatureFollowsNextRunID means that the client supports following next execution run id for // completed/failed/timedout completion events when getting the final result of a workflow. FeatureFollowsNextRunID = "follows-next-run-id" )
Variables ¶
var ( // AllFeatures contains all known features. This list is used as the value of the supported // features header for internal server requests. There is an assumption that if a feature is // defined, then the server itself supports it. AllFeatures = strings.Join([]string{ FeatureFollowsNextRunID, }, SupportedFeaturesHeaderDelim) SupportedClients = map[string]string{ ClientNameGoSDK: "<2.0.0", ClientNameJavaSDK: "<2.0.0", ClientNamePHPSDK: "<2.0.0", ClientNameTypeScriptSDK: "<2.0.0", ClientNameCLI: "<2.0.0", ClientNameServer: "<2.0.0", ClientNameUI: "<3.0.0", } )
Functions ¶
func GetClientNameAndVersion ¶ added in v1.15.0
GetClientNameAndVersion extracts SDK name and version from context headers
func GetValues ¶
GetValues returns header values for passed header names. It always returns slice of the same size as number of passed header names.
func NewDefaultVersionChecker ¶ added in v1.0.0
func NewDefaultVersionChecker() *versionChecker
NewDefaultVersionChecker constructs a new VersionChecker using default versions from const.
func NewVersionChecker ¶
NewVersionChecker constructs a new VersionChecker
func Propagate ¶ added in v1.13.0
Propagate propagates version headers from incoming context to outgoing context. It copies all headers to outgoing context only if they are exist in incoming context and doesn't exist in outgoing context already.
func SetCallerInfo ¶ added in v1.17.2
func SetCallerInfo( ctx context.Context, info CallerInfo, ) context.Context
SetCallerInfo sets callerName and callerType value in incoming context if not already exists. TODO: consider only set the caller info to golang context instead of grpc metadata and propagate to grpc outgoing context upon making an rpc call
func SetVersions ¶
SetVersions sets headers for internal communications.
Types ¶
type CallerInfo ¶ added in v1.17.2
type CallerInfo struct {
CallerType string
}
func GetCallerInfo ¶ added in v1.17.2
func GetCallerInfo( ctx context.Context, ) CallerInfo
func NewCallerInfo ¶ added in v1.17.2
func NewCallerInfo( callerType string, ) CallerInfo