Documentation
¶
Overview ¶
Package metadata provides the persistent storage layer for component states.
Package metadata provides the persistent storage layer for GPUd metadata.
Index ¶
- Constants
- func CreateTableMetadata(ctx context.Context, dbRW *sql.DB) error
- func DeleteAllMetadata(ctx context.Context, dbRW *sql.DB) error
- func MaskToken(token string) string
- func ReadAllMetadata(ctx context.Context, dbRO *sql.DB) (map[string]string, error)
- func ReadMachineIDWithFallback(ctx context.Context, dbRW *sql.DB, dbRO *sql.DB) (string, error)
- func ReadMetadata(ctx context.Context, dbRO *sql.DB, key string) (string, error)
- func ReadTokenWithFallback(ctx context.Context, dbRW *sql.DB, dbRO *sql.DB, machineID string) (string, error)
- func SetMetadata(ctx context.Context, dbRW *sql.DB, key string, value string) error
Constants ¶
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 ¶
CreateTableMetadata creates the table for the metadata.
func DeleteAllMetadata ¶
DeleteAllMetadata purges all metadata entries.
func ReadAllMetadata ¶
ReadAllMetadata reads all the metadata entries. Returns an empty string and no error, if the metadata entry is not found.
func ReadMachineIDWithFallback ¶
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 ¶
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 ¶
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.