proxy

package
v1.25.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 20 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFailureVisitorInterceptor

func NewFailureVisitorInterceptor(options FailureVisitorInterceptorOptions) (grpc.UnaryClientInterceptor, error)

NewFailureVisitorInterceptor creates a new gRPC interceptor for workflowservice messages.

func NewGRPCGatewayJSONPBMarshaler added in v1.24.0

func NewGRPCGatewayJSONPBMarshaler(marshaler *JSONPBMarshaler, unmarshaler *JSONPBUnmarshaler) runtime.Marshaler

NewGRPCGatewayJSONPBMarshaler creates a new gRPC gateway marshaler for the given marshaler/unmarshaler pair.

func NewPayloadVisitorInterceptor

func NewPayloadVisitorInterceptor(options PayloadVisitorInterceptorOptions) (grpc.UnaryClientInterceptor, error)

NewPayloadVisitorInterceptor creates a new gRPC interceptor for workflowservice messages.

func NewWorkflowServiceProxyServer

func NewWorkflowServiceProxyServer(options WorkflowServiceProxyOptions) (workflowservice.WorkflowServiceServer, error)

NewWorkflowServiceProxyServer creates a WorkflowServiceServer suitable for registering with a gRPC Server. Requests will be forwarded to the passed in WorkflowService Client. gRPC interceptors can be added on the Server or Client to adjust requests and responses.

func VisitFailures

func VisitFailures(ctx context.Context, msg proto.Message, options VisitFailuresOptions) error

VisitFailures calls the options.Visitor function for every Failure proto within msg.

func VisitPayloads

func VisitPayloads(ctx context.Context, msg proto.Message, options VisitPayloadsOptions) error

VisitPayloads calls the options.Visitor function for every Payload proto within msg.

Types

type FailureVisitorInterceptorOptions

type FailureVisitorInterceptorOptions struct {
	// Visit options for outbound messages
	Outbound *VisitFailuresOptions
	// Visit options for inbound messages
	Inbound *VisitFailuresOptions
}

FailureVisitorInterceptorOptions configures outbound/inbound interception of Failures within msgs.

type JSONPBMarshaler added in v1.24.0

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

JSONPBMarshaler is a protobuf JSON marshaler that supports Temporal-specific features. This is mostly equivalent to github.com/gogo/protobuf/jsonpb.Marshaler.

One feature is "shorthand payloads". During marshal when shorthand payloads are enabled (which is the default), JSON payloads are represented as their actual data instead of the protobuf default which would be a base64'd data field and base64'd metadata fields. For JSON proto payloads, the same occurs but a special field in the object of "_protoMessageType" is present with the qualified protobuf message name.

func NewJSONPBMarshaler added in v1.24.0

func NewJSONPBMarshaler(options JSONPBMarshalerOptions) (*JSONPBMarshaler, error)

NewJSONPBMarshaler creates a marshaler that supports Temporal-specific features. See JSONPBMarshaler for more detail.

func (*JSONPBMarshaler) Marshal added in v1.24.0

func (j *JSONPBMarshaler) Marshal(out io.Writer, pb proto.Message) error

Marshal is the Temporal-specific equivalent of github.com/gogo/protobuf/jsonpb.Marshaler.Marshal.

func (*JSONPBMarshaler) MarshalToString added in v1.24.0

func (j *JSONPBMarshaler) MarshalToString(pb proto.Message) (string, error)

Marshal is the Temporal-specific equivalent of github.com/gogo/protobuf/jsonpb.Marshaler.MarshalToString.

type JSONPBMarshalerOptions added in v1.24.0

type JSONPBMarshalerOptions struct {
	// Whether to render enum values as integers, as opposed to string values.
	EnumsAsInts bool

	// Whether to render fields with zero values.
	EmitDefaults bool

	// A string to indent each level by. The presence of this field will
	// also cause a space to appear between the field separator and
	// value, and for newlines to be appear between fields and array
	// elements.
	Indent string

	// Whether to use the original (.proto) name for fields.
	OrigName bool

	// A custom URL resolver to use when marshaling Any messages to JSON.
	// If unset, the default resolution strategy is to extract the
	// fully-qualified type name from the type URL and pass that to
	// proto.MessageType(string).
	AnyResolver gogojsonpb.AnyResolver

	// If true, this will never marshal to shorthand payloads. See
	// [JSONPBMarshaler] for more detail.
	DisablePayloadShorthand bool
}

JSONPBMarshalerOptions is used for NewJSONPBMarshaler. Most of the options are copied from github.com/gogo/protobuf/jsonpb.Marshaler.

type JSONPBUnmarshaler added in v1.24.0

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

JSONPBUnmarshaler is a protobuf JSON unmarshaler that supports Temporal-specific features. This is mostly equivalent to github.com/gogo/protobuf/jsonpb.Unmarshaler.

One feature is "shorthand payloads". During unmarshal when a JSON is encountered that cannot be converted to a traditional protobuf JSON payload with metadata and data, it is assumed to be "shorthand". This means the JSON itself is the payload and it is turned into a payload with the proper metadata set. If the JSON is an object with a "_protoMessageType" field, it is assumed to be a proto JSON payload with that field containing the qualified message name.

func NewJSONPBUnmarshaler added in v1.24.0

func NewJSONPBUnmarshaler(options JSONPBUnmarshalerOptions) (*JSONPBUnmarshaler, error)

func (*JSONPBUnmarshaler) Unmarshal added in v1.24.0

func (j *JSONPBUnmarshaler) Unmarshal(r io.Reader, pb proto.Message) error

Unmarshal is the Temporal-specific equivalent of github.com/gogo/protobuf/jsonpb.Unmarshaler.Unmarshal.

func (*JSONPBUnmarshaler) UnmarshalNext added in v1.24.0

func (j *JSONPBUnmarshaler) UnmarshalNext(dec *json.Decoder, pb proto.Message) error

UnmarshalNext is the Temporal-specific equivalent of github.com/gogo/protobuf/jsonpb.Unmarshaler.UnmarshalNext.

type JSONPBUnmarshalerOptions added in v1.24.0

type JSONPBUnmarshalerOptions struct {
	// Whether to allow messages to contain unknown fields, as opposed to
	// failing to unmarshal.
	AllowUnknownFields bool

	// A custom URL resolver to use when unmarshaling Any messages from JSON.
	// If unset, the default resolution strategy is to extract the
	// fully-qualified type name from the type URL and pass that to
	// proto.MessageType(string).
	AnyResolver gogojsonpb.AnyResolver

	// If true, this will never unmarshal from shorthand payloads. See
	// [JSONPBUnmarshaler] for more detail.
	DisablePayloadShorthand bool
}

JSONPBUnmarshalerOptions is used for NewJSONPBUnmarshaler. Most of the options are copied from github.com/gogo/protobuf/jsonpb.Unmarshaler.

type PayloadVisitorInterceptorOptions

type PayloadVisitorInterceptorOptions struct {
	// Visit options for outbound messages
	Outbound *VisitPayloadsOptions
	// Visit options for inbound messages
	Inbound *VisitPayloadsOptions
}

PayloadVisitorInterceptorOptions configures outbound/inbound interception of Payloads within msgs.

type VisitFailuresContext

type VisitFailuresContext struct {
	context.Context
	// The parent message for this failure.
	Parent proto.Message
}

VisitFailuresContext provides Failure context for visitor functions.

type VisitFailuresOptions

type VisitFailuresOptions struct {
	// Context is the same for every call of a visit, callers should not store it.
	// Visitor is free to mutate the passed failure struct.
	Visitor func(*VisitFailuresContext, *failure.Failure) error
}

VisitFailuresOptions configure visitor behaviour.

type VisitPayloadsContext

type VisitPayloadsContext struct {
	context.Context
	// The parent message for this payload.
	Parent proto.Message
	// If true, a single payload is given and a single payload must be returned.
	SinglePayloadRequired bool
}

VisitPayloadsContext provides Payload context for visitor functions.

type VisitPayloadsOptions

type VisitPayloadsOptions struct {
	// Context is the same for every call of a visit, callers should not store it. This must never
	// return an empty set of payloads.
	Visitor func(*VisitPayloadsContext, []*common.Payload) ([]*common.Payload, error)
	// Don't visit search attribute payloads.
	SkipSearchAttributes bool
}

VisitPayloadsOptions configure visitor behaviour.

type WorkflowServiceProxyOptions

type WorkflowServiceProxyOptions struct {
	Client workflowservice.WorkflowServiceClient
}

WorkflowServiceProxyOptions provides options for configuring a WorkflowServiceProxyServer. Client is a WorkflowServiceClient used to forward requests received by the server to the Temporal Frontend.

Jump to

Keyboard shortcuts

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