Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Codec ¶
type Codec struct {
// contains filtered or unexported fields
}
func New ¶
New instantiates a Codec. WithURL is a required option.
An error may be returned if incompatible options are configured or if a connection to the remote payload storage service cannot be established.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithHTTPClient ¶
WithHTTPClient sets a custom http.Client.
If unspecified, http.DefaultClient will be used.
func WithHTTPRoundTripper ¶
func WithHTTPRoundTripper(rt http.RoundTripper) Option
WithHTTPRoundTripper sets custom Transport on the http.Client.
This may be used to implement use cases including authentication or tracing.
func WithMinBytes ¶
WithMinBytes configures the minimum size of an event payload needed to trigger encoding using the large payload codec. Any payload smaller than this value will be transparently persisted in workflow history.
The default value is 128000, or 128KB.
Setting this too low can lead to degraded performance, since decoding requires an additional network round trip per payload. This can add up quickly when replaying a workflow with a large number of events.
According to https://docs.temporal.io/workflows, the hard limit for workflow history size is 50k events and 50MB. A workflow with exactly 50k events can therefore in theory have an average event payload size of 1048 bytes.
In practice this worst case is very unlikely, since common workflow event types such as WorkflowTaskScheduled or WorkflowTaskCompleted do not include user defined payloads. If we estimate that one quarter of events have payloads just below the cutoff, then we can calculate how many events total would fit in one workflow's history (the point before which we must call ContinueAsNew):
AverageNonUserTaskBytes = 1024 (generous estimate for events like WorkflowTaskScheduled) CodecMinBytes = 128_000 AverageEventBytes = (AverageNonUserTaskBytes * 3 + CodecMinBytes) / 4 = 32_768 MaxHistoryEventBytes = 50_000_000 MaxHistoryEventCount = MaxHistoryEventBytes / AverageEventBytes = 1525
func WithNamespace ¶
WithNamespace sets the Temporal namespace the client using this codec is connected to. This option is mandatory.
func WithURL ¶
WithURL sets the endpoint for the remote payload storage service. This option is mandatory.
func WithVersion ¶
WithVersion sets the version of the LPS API to use.