talos

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package talos implements modern ADV which supports large size for the values and tags.

Index

Constants

View Source
const (
	Length     = 256 * 1024 // 256KiB
	DataLength = Length - 40
	Size       = 2 * Length // Redundancy
)

Basic constants configuring the ADV.

View Source
const (
	Magic1 = 0x5a4b3c2d
	Magic2 = 0xa5b4c3d2
)

Magic constants.

Variables

This section is empty.

Functions

This section is empty.

Types

type ADV

type ADV struct {
	Tags map[Tag]Value
}

ADV implements the Talos extended ADV.

Layout (all in big-endian):

 0x0000   4 bytes       magic1
 0x0004   4 bytes       tag
 0x0008   4 bytes       size
 0x000c   (size) bytes  value
 ... more tags
-0x0024   32 bytes      sha256 of the whole block with checksum set to zero
-0x0004   4 bytes       magic2

Whole data structure is written twice for redundancy.

func NewADV

func NewADV(r io.Reader) (*ADV, error)

NewADV loads ADV from the block device.

func (*ADV) Bytes

func (a *ADV) Bytes() ([]byte, error)

Bytes marshal full representation.

func (*ADV) DeleteTag

func (a *ADV) DeleteTag(t uint8) (ok bool)

DeleteTag to delete tag value.

func (*ADV) Marshal

func (a *ADV) Marshal() ([]byte, error)

Marshal single copy of ADV.

func (*ADV) ReadTag

func (a *ADV) ReadTag(t uint8) (val string, ok bool)

ReadTag to get tag value.

func (*ADV) ReadTagBytes added in v0.9.0

func (a *ADV) ReadTagBytes(t uint8) (val []byte, ok bool)

ReadTagBytes to get tag value.

func (*ADV) SetTag

func (a *ADV) SetTag(t uint8, val string) (ok bool)

SetTag to set tag value.

func (*ADV) SetTagBytes added in v0.9.0

func (a *ADV) SetTagBytes(t uint8, val []byte) (ok bool)

SetTagBytes to set tag value.

func (*ADV) Unmarshal

func (a *ADV) Unmarshal(buf []byte) error

Unmarshal single copy from the serialized representation.

type Tag

type Tag uint8

Tag is the key.

We use a byte here for compatibility with syslinux, but format has space for uint32.

type Value

type Value []byte

Value stored for the tag.

Jump to

Keyboard shortcuts

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