serialize

package
v0.0.0-...-03d6fc4 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2019 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const BYTES_PER_INT = 4

INT_SIZE is the number of bytes we use for a single number to encode.

Variables

This section is empty.

Functions

func CacheTile

func CacheTile(tile *tiling.Tile, path string) error

CacheTile to disk writes the given tile to the given path. It will first write to a temporary file and then rename it to target path.

func DeserializeTile

func DeserializeTile(r io.Reader) (*tiling.Tile, error)

DeserializeTile reads the tile from the given reader.

func LoadCachedTile

func LoadCachedTile(path string) (*tiling.Tile, error)

LoadCachedTile loads the cached tile at the given path. If the path does not exist, it will not return an error, but the returned tile will be nil.

func SerializeTile

func SerializeTile(w io.Writer, tile *tiling.Tile) error

SerializeTile writes the tile to the given writer.

Types

type Sample

type Sample struct {
	Tile         *tiling.Tile
	Expectations types.Expectations
	IgnoreRules  []*ignore.IgnoreRule
}

Sample contains the information necessary to represent the full state of a Gold instance and a sample from a live instance.

func DeserializeSample

func DeserializeSample(r io.Reader) (*Sample, error)

DeserializeSample returns a new instance of Sample from the given reader. It is the inverse operation of Sample.Searialize.

func (*Sample) Serialize

func (s *Sample) Serialize(w io.Writer) error

Serialize writes this Sample instance to the given writer.

func (*Sample) UnmarshalJSON

func (s *Sample) UnmarshalJSON(data []byte) error

UnmarshalJSON allows to deserialize an instance of Sample that has been serialized using the json package.

Jump to

Keyboard shortcuts

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