package
3.12.12+incompatible
Repository: https://github.com/threefoldtech/zos.git
Documentation: pkg.go.dev

# README

versioned module

The versioned package provides utilities to manage versioned data streams and files. It uses the blang/semver package to handle semantic versioning.

Error Handling

ErrNotVersioned: Error raised if the underlying reader has no version information.

IsNotVersioned: A function checks if an error is caused by a "not versioned" stream.

Structs

Reader: Represents a versioned reader that can load the version of the data from a stream.

Fields

  • Reader io.Reader: The underlying data stream.
  • version Version: The version of the data.

Methods

Version: Returns the version of the data.

Functions

NewVersionedReader: Creates a Reader with a specified version.

NewReader: Creates a Reader by reading the version from a stream. Fails if the stream lacks version information.

ReadFile: Reads the content of a file and its version.

NewWriter: Creates a versioned writer that marks data with the provided version.

WriteFile: Writes versioned data to a file.

Parse: Parses a version string into a Version object.

MustParse: Parses a version string into a Version object. Panics if the parsing fails.

ParseRange: Parses a version range string into a Range object.

MustParseRange: Parses a version range string into a Range object. Panics if the parsing fails.

# Functions

IsNotVersioned checks if error is caused by a 'not versioned' stream.
MustParse version.
MustParseRange parses range.
NewReader creates a new versioned reader from a stream.
NewVersionedReader creates a versioned reader from an un-versioned reader.
NewWriter creates a versioned writer that marks data with the Provided version.
Parse version string.
ParseRange parses a range.
ReadFile content.
WriteFile versioned data to file.

# Variables

ErrNotVersioned error is raised if the underlying reader has no version.

# Structs

Reader is a versioned reader The Versioned Reader is a reader that can load the version of the data from a stream without assuming anything regarding the underlying encoding of your data object.

# Type aliases

Range type.
Version type.