crunched

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Overview

Package crunched provides the Data interface. Implementations of this interface can store data in a crunched and uncrunched state.

The intention is that implementations crunch data after a call to Snapshot() and transparently uncrunch it on a call to Data().

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data interface {
	// IsCrunched returns true if data is currently crunched
	IsCrunched() bool

	// Size returns the uncrunched size and the current size of the data. If the
	// data is currently crunched then the two values will be the same
	Size() (int, int)

	// Data returns a pointer to the uncrunched data
	Data() *[]byte

	// Snapshot makes a copy of the data and crunching it if required. The data will
	// be uncrunched automatically when Data() function is called
	Snapshot() Data
}

Data provides the interface to a crunched data type

func NewQuick

func NewQuick(size int) Data

NewQuick returns an implementation of the Data interface that is intended to perform quickly on both crunching and decrunching.

For simplicity, the minimum amount of data allocated will be 4 bytes.

type Inspection

type Inspection interface {
	Data

	// Inspect returns data in the current state. In other words, the data will
	// not be decrunched as it would be with the Data() function
	Inspect() *[]byte
}

Inspection provides the interface to the crunched data type and provides the ability to inspect the data in its current form

Jump to

Keyboard shortcuts

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