metadata

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package metadata provides the persistent storage layer for GPUd metadata.

Index

Constants

View Source
const (
	MetadataKeyMachineID = "machine_id"

	// MetadataKeyToken represents the machine session token on successful login.
	// This is the token generated by the DGXC Lepton control plane on successful login,
	// used for session authentication.
	MetadataKeyToken = "token"

	MetadataKeyEndpoint  = "endpoint"
	MetadataKeyPublicIP  = "public_ip"
	MetadataKeyPrivateIP = "private_ip"

	// 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 from the primary metadata table.

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 ReadMachineID added in v0.9.0

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

ReadMachineID returns the machine ID from the metadata table. Returns an empty string and no error if the machine ID is not present.

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 ReadToken added in v0.9.0

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

ReadToken returns the token from the metadata table. Returns an empty string and no error if the token is not present.

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