compression

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package compression provides a set of compression algorithms found in several versions of Rendez-Vous for compressing large payloads

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Algorithm

type Algorithm interface {
	Compress(payload []byte) ([]byte, error)
	Decompress(payload []byte) ([]byte, error)
	Copy() Algorithm
}

Algorithm defines all the methods a compression algorithm should have

type Dummy

type Dummy struct{}

Dummy does no compression. Payloads are returned as-is

func NewDummyCompression

func NewDummyCompression() *Dummy

NewDummyCompression returns a new instance of the Dummy compression

func (*Dummy) Compress

func (d *Dummy) Compress(payload []byte) ([]byte, error)

Compress does nothing

func (*Dummy) Copy

func (d *Dummy) Copy() Algorithm

Copy returns a copy of the algorithm

func (*Dummy) Decompress

func (d *Dummy) Decompress(payload []byte) ([]byte, error)

Decompress does nothing

type LZO

type LZO struct{}

LZO implements packet payload compression using LZO

func NewLZOCompression

func NewLZOCompression() *LZO

NewLZOCompression returns a new instance of the LZO compression

func (*LZO) Compress

func (l *LZO) Compress(payload []byte) ([]byte, error)

Compress compresses the payload using LZO

func (*LZO) Copy

func (l *LZO) Copy() Algorithm

Copy returns a copy of the algorithm

func (*LZO) Decompress

func (l *LZO) Decompress(payload []byte) ([]byte, error)

Decompress decompresses the payload using LZO

type Zlib

type Zlib struct{}

Zlib implements packet payload compression using zlib

func NewZlibCompression

func NewZlibCompression() *Zlib

NewZlibCompression returns a new instance of the Zlib compression

func (*Zlib) Compress

func (z *Zlib) Compress(payload []byte) ([]byte, error)

Compress compresses the payload using zlib

func (*Zlib) Copy

func (z *Zlib) Copy() Algorithm

Copy returns a copy of the algorithm

func (*Zlib) Decompress

func (z *Zlib) Decompress(payload []byte) ([]byte, error)

Decompress decompresses the payload using zlib

Jump to

Keyboard shortcuts

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