snappycompress

package
v0.0.0-...-94a9b73 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

README

Steps to run this sample:

  1. You need a Temporal service running. See details in README.md
  2. Compile the snappycompress plugin for tctl
go build -o ../bin/snappycompress-plugin plugin/main.go
  1. Run the following command to start the worker
go run worker/main.go
  1. Run the following command to start the example
go run starter/main.go
  1. Run the following command and see the compressed payloads
export PATH="../bin:$PATH" TEMPORAL_CLI_PLUGIN_DATA_CONVERTER=snappycompress-plugin
tctl workflow show --wid snappycompress_workflowID

Note: plugins should normally be available in your PATH, we include the current directory in the path here for ease of testing.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AlwaysCompressDataConverter = NewDataConverter(converter.GetDefaultDataConverter(), Options{AlwaysEncode: true})

AlwaysCompressDataConverter is a converter that will always perform compression even if the compressed size is larger than the original.

Functions

func Activity

func Activity(ctx context.Context, info map[string]string) (string, error)

func NewDataConverter

func NewDataConverter(underlying converter.DataConverter, options Options) converter.DataConverter

NewDataConverter creates a new data converter that wraps the given data converter with snappy compression.

func Workflow

func Workflow(ctx workflow.Context, name string) (string, error)

Workflow is a standard workflow definition. Note that the Workflow and Activity don't need to care that their inputs/results are being compressed.

Types

type Codec

type Codec struct {
	Options Options
}

Codec implements converter.PayloadEncoder for snappy compression.

func (*Codec) Decode

func (*Codec) Decode(payloads []*commonpb.Payload) ([]*commonpb.Payload, error)

Decode implements converter.PayloadCodec.Decode.

func (*Codec) Encode

func (e *Codec) Encode(payloads []*commonpb.Payload) ([]*commonpb.Payload, error)

Encode implements converter.PayloadCodec.Encode.

type Options

type Options struct {
	// If true, will always "compress" even if the compression results in a larger
	// sized payload.
	AlwaysEncode bool
}

Options are options for Snappy compression.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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