meta

package
v0.5.8 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package meta provides access to META partition: key-value partition persisted across reboots.

Index

Constants

View Source
const (
	// Upgrade is the upgrade tag.
	Upgrade = iota + 6
	// StagedUpgradeImageRef stores image reference for staged upgrade.
	StagedUpgradeImageRef
	// StagedUpgradeInstallOptions stores JSON-serialized install.Options.
	StagedUpgradeInstallOptions
	// StateEncryptionConfig stores JSON-serialized v1alpha1.Encryption.
	StateEncryptionConfig
	// MetalNetworkPlatformConfig stores serialized NetworkPlatformConfig for the `metal` platform.
	MetalNetworkPlatformConfig
	// DownloadURLCode stores the value of the `${code}` variable in the download URL for talos.config= URL.
	DownloadURLCode
	// UserReserved1 is reserved for user-defined metadata.
	UserReserved1
	// UserReserved2 is reserved for user-defined metadata.
	UserReserved2
	// UserReserved3 is reserved for user-defined metadata.
	UserReserved3
	// UUIDOverride stores the UUID that this machine will use instead of the one from the hardware.
	UUIDOverride
	// UniqueMachineToken store the unique token for this machine. It's useful because UUID may repeat or be filled with zeros.
	UniqueMachineToken
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Meta

type Meta struct {
	// contains filtered or unexported fields
}

Meta represents the META reader/writer.

Meta abstracts away all details about loading/storing the metadata providing an easy to use interface.

func New

func New(ctx context.Context, st state.State, opts ...Option) (*Meta, error)

New initializes empty META, trying to probe the existing META first.

func (*Meta) DeleteTag

func (meta *Meta) DeleteTag(ctx context.Context, t uint8) (bool, error)

DeleteTag deletes a tag from the META.

func (*Meta) Flush

func (meta *Meta) Flush() error

Flush writes the META to the disk.

func (*Meta) ReadTag

func (meta *Meta) ReadTag(t uint8) (val string, ok bool)

ReadTag reads a tag from the META.

func (*Meta) ReadTagBytes

func (meta *Meta) ReadTagBytes(t uint8) (val []byte, ok bool)

ReadTagBytes reads a tag from the META.

func (*Meta) Reload

func (meta *Meta) Reload(ctx context.Context) error

Reload refreshes the META from the disk.

func (*Meta) SetTag

func (meta *Meta) SetTag(ctx context.Context, t uint8, val string) (bool, error)

SetTag writes a tag to the META.

func (*Meta) SetTagBytes

func (meta *Meta) SetTagBytes(ctx context.Context, t uint8, val []byte) (bool, error)

SetTagBytes writes a tag to the META.

type Option

type Option func(*Options)

Option is a functional option.

func WithFixedPath

func WithFixedPath(path string) Option

WithFixedPath sets the fixed path to META partition.

func WithPrinter

func WithPrinter(printer func(string, ...any)) Option

WithPrinter sets the function to print the logs, default is log.Printf.

type Options

type Options struct {
	// contains filtered or unexported fields
}

Options configures the META.

Directories

Path Synopsis
internal
adv
Package adv provides common interfaces to access ADV data.
Package adv provides common interfaces to access ADV data.
adv/syslinux
Package syslinux provides syslinux-compatible ADV data.
Package syslinux provides syslinux-compatible ADV data.
adv/talos
Package talos implements modern ADV which supports large size for the values and tags.
Package talos implements modern ADV which supports large size for the values and tags.

Jump to

Keyboard shortcuts

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