Documentation

Overview

Package yarpcgrpccompressor provides an adapter for YARPC compressors to gRPC compressors.

The only distinction is that YARPC's Decompressor returns an io.ReadCloser instead of a mere io.Reader. gRPC does not call Close, so must infer the end of stream by returning the reader to the reader pool when Read returns io.EOF. This wrapper uses the io.EOF to trigger and automatic Close.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(compressor transport.Compressor) encoding.Compressor

New adapts a YARPC compressor to a gRPC compressor.

Types

type Compressor

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

Compressor is a gRPC compressor that wraps a YARPC compressor.

func (*Compressor) Compress

func (c *Compressor) Compress(w io.Writer) (io.WriteCloser, error)

Compress wraps a writer with a compressing writer.

func (*Compressor) Decompress

func (c *Compressor) Decompress(r io.Reader) (io.Reader, error)

Decompress wraps a reader with a decompressing reader.

func (*Compressor) Name

func (c *Compressor) Name() string

Name returns the name of the underlying compressor.

Source Files