Documentation ¶
Overview ¶
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.
Index ¶
Constants ¶
const ( MachineIDLen = 64 MachineIDShortLen = 12 )
Variables ¶
var (
NullMachineID = MachineID("")
)
Functions ¶
func IsShortMachineID ¶
IsShortID determines if an arbitrary string *looks like* a short ID.
func NewRandomMachineName ¶
GetRandomName generates a random name from the list of adjectives and surnames in this package formatted as "adjective_surname". For example 'focused_turing'. If retry is non-zero, a random integer between 0 and 10 will be added to the end of the name, e.g `focused_turing3`
func ValidateMachineID ¶
ValidateMachineID checks whether a MachineID string is a valid image MachineID.
Types ¶
type MachineID ¶
type MachineID string
MachineID is a 16 byte universally unique identifier.
func NewRandomMachineID ¶
NewRandomMachineID returns a random machine ID.
It uses the crypto/rand reader as a source of randomness.
func (MachineID) Short ¶
func (mid MachineID) Short() MachineShortID
func (MachineID) ShortString ¶
type MachineShortID ¶
type MachineShortID string
MachineID is a 16 byte universally unique identifier.
func TruncateMachineID ¶
func TruncateMachineID(mid MachineID) MachineShortID
TruncateMachineID returns a shorthand version of a string identifier for convenience.
A collision with other shorthands is very unlikely, but possible. In case of a collision a lookup with TruncIndex.Get() will fail, and the caller will need to use a longer prefix, or the full-length Id.
func (MachineShortID) String ¶
func (mid MachineShortID) String() string