metadata

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package metadata provides the persistent storage layer for component states.

Package metadata provides the persistent storage layer for GPUd metadata.

Index

Constants

View Source
const (
	MetadataKeyMachineID = "machine_id"
	MetadataKeyToken     = "token"
	MetadataKeyEndpoint  = "endpoint"
	MetadataKeyPublicIP  = "public_ip"
	MetadataKeyPrivateIP = "private_ip"
	MetadataKeyProvider  = "provider"
	MetadataKeyNodeGroup = "node_group"
	MetadataKeyRegion    = "region"
	MetadataKeyExtraInfo = "extra_info"

	// MetadataKeyControlPlaneLoginSuccess represents the timestamp in unix seconds
	// when the control plane login was successful.
	MetadataKeyControlPlaneLoginSuccess = "control_plane_login_success"
)

Variables

This section is empty.

Functions

func CreateTableMetadata

func CreateTableMetadata(ctx context.Context, dbRW *sql.DB) error

CreateTableMetadata creates the table for the metadata.

func DeleteAllMetadata

func DeleteAllMetadata(ctx context.Context, dbRW *sql.DB) error

DeleteAllMetadata purges all metadata entries.

func MaskToken

func MaskToken(token string) string

func ReadAllMetadata

func ReadAllMetadata(ctx context.Context, dbRO *sql.DB) (map[string]string, error)

ReadAllMetadata reads all the metadata entries. Returns an empty string and no error, if the metadata entry is not found.

func ReadMachineIDWithFallback

func ReadMachineIDWithFallback(ctx context.Context, dbRW *sql.DB, dbRO *sql.DB) (string, error)

ReadMachineIDWithFallback reads the machine ID from the metadata table. Returns an empty string and no error, if the machine ID is not found in the new table. For compatibility with older versions of GPUd, it also checks the deprecated table.

func ReadMetadata

func ReadMetadata(ctx context.Context, dbRO *sql.DB, key string) (string, error)

ReadMetadata reads the value of a metadata entry. Returns an empty string and no error, if the metadata entry is not found.

func ReadTokenWithFallback

func ReadTokenWithFallback(ctx context.Context, dbRW *sql.DB, dbRO *sql.DB, machineID string) (string, error)

ReadTokenWithFallback reads the token from the metadata table. Returns an empty string and no error, if the token is not found in the new table. For compatibility with older versions of GPUd, it also checks the deprecated table.

func SetMetadata

func SetMetadata(ctx context.Context, dbRW *sql.DB, key string, value string) error

SetMetadata sets the value of a metadata entry. If the metadata entry is not found, it is created. If the metadata entry is found and the value is the same, it is not updated. If the metadata entry is found and the value is different, it is updated.

Types

This section is empty.

Jump to

Keyboard shortcuts

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