meta

package
v1.9.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

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 added in v1.5.5

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