nvlist

package
v0.0.0-...-3df88f3 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package nvlist implements encoding and decoding of ZFS-style nvlists with an interface similar to that of encoding/json. It supports "native" encoding and parts of XDR in both big and little endian.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidEncoding  = errors.New("this nvlist is not in native encoding")
	ErrInvalidEndianess = errors.New("this nvlist is neither in big nor in little endian")
	ErrInvalidData      = errors.New("this nvlist contains invalid data")
	ErrInvalidValue     = errors.New("the value provided to unmarshal contains invalid types")
	ErrUnsupportedType  = errors.New("this nvlist contains an unsupported type (hrtime)")
)

Functions

func Marshal

func Marshal(val interface{}) ([]byte, error)

Marshal serializes the given data into a ZFS-style nvlist

func Unmarshal

func Unmarshal(data []byte, val interface{}) error

Unmarshal parses a ZFS-style nvlist in native encoding and with any endianness

Types

type Encoding

type Encoding uint8

Encoding represents the encoding used for serialization/deserialization

const (
	// EncodingNative is used in syscalls and cache files
	EncodingNative Encoding = 0x00
	// EncodingXDR is used on-disk (and is not actually XDR)
	EncodingXDR Encoding = 0x01
)

Jump to

Keyboard shortcuts

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