Documentation ¶
Index ¶
- Constants
- func NewEvaluationID() string
- func NewExecutionID() string
- func NewJobID() string
- func ShortNodeID(input string) string
- func ShortUUID(input string) string
- type AWSNodeNameProvider
- type CachedNodeNameProvider
- type GCPNodeNameProvider
- type HTTPNodeNameProvider
- type HostnameProvider
- type NodeNameProvider
- type NodeNameProviderFunc
- type PUUIDNodeNameProvider
- type UUIDNodeNameProvider
Constants ¶
const ( // JobIDPrefix is the prefix of job ID. JobIDPrefix = "j-" // ExecutionIDPrefix is the prefix of execution ID. ExecutionIDPrefix = "e-" // EvaluationIDPrefix is the prefix of evaluation ID. EvaluationIDPrefix = "v-" // NodeIDPrefix is the prefix of node ID. NodeIDPrefix = "n-" )
const ShortIDLength = 8
const ShortIDLengthWithPrefix = ShortIDLength + len(JobIDPrefix)
Variables ¶
This section is empty.
Functions ¶
func ShortNodeID ¶ added in v1.2.2
ShortNodeID takes a string in the format of a libp2p peer ID or UUID, and returns a shortened version of the input, or the input as is if it doesn't match. Mainly used for logging and printing the ID in a more human-readable format.
func ShortUUID ¶ added in v1.2.2
ShortUUID takes a string in the format of "prefix-UUID" or just "UUID" and returns the prefix along with the first segment of the UUID. For example: - For "e-78faf114-6a45-457e-825c-40fd2fad768f", it returns "e-78faf114". - For "j-78faf114-6a45-457e-825c-40fd2fad768f", it returns "j-78faf114". - For "78faf114-6a45-457e-825c-40fd2fad768f", it returns "78faf114".
Types ¶
type AWSNodeNameProvider ¶ added in v1.2.2
type AWSNodeNameProvider struct {
// contains filtered or unexported fields
}
AWSNodeNameProvider retrieves the node name from AWS instance metadata.
func NewAWSNodeNameProvider ¶ added in v1.2.2
func NewAWSNodeNameProvider() AWSNodeNameProvider
func (AWSNodeNameProvider) GenerateNodeName ¶ added in v1.2.2
func (p AWSNodeNameProvider) GenerateNodeName(ctx context.Context) (string, error)
type CachedNodeNameProvider ¶ added in v1.2.2
type CachedNodeNameProvider struct {
// contains filtered or unexported fields
}
CachedNodeNameProvider caches the node name for subsequent calls.
func NewCachedNodeNameProvider ¶ added in v1.2.2
func NewCachedNodeNameProvider(provider NodeNameProvider) *CachedNodeNameProvider
func (*CachedNodeNameProvider) GenerateNodeName ¶ added in v1.2.2
func (c *CachedNodeNameProvider) GenerateNodeName(ctx context.Context) (string, error)
type GCPNodeNameProvider ¶ added in v1.2.2
type GCPNodeNameProvider struct {
// contains filtered or unexported fields
}
GCPNodeNameProvider retrieves the node name from GCP instance metadata.
func NewGCPNodeNameProvider ¶ added in v1.2.2
func NewGCPNodeNameProvider() GCPNodeNameProvider
func (GCPNodeNameProvider) GenerateNodeName ¶ added in v1.2.2
func (p GCPNodeNameProvider) GenerateNodeName(ctx context.Context) (string, error)
type HTTPNodeNameProvider ¶ added in v1.2.2
HTTPNodeNameProvider retrieves the node name from a URL, used by AWS and GCP.
func (HTTPNodeNameProvider) GenerateNodeName ¶ added in v1.2.2
func (h HTTPNodeNameProvider) GenerateNodeName(ctx context.Context) (string, error)
type HostnameProvider ¶ added in v1.2.2
type HostnameProvider struct{}
HostnameProvider retrieves the node name from the host's hostname.
func (HostnameProvider) GenerateNodeName ¶ added in v1.2.2
func (HostnameProvider) GenerateNodeName(_ context.Context) (string, error)
type NodeNameProvider ¶ added in v1.2.2
NodeNameProvider defines an interface for generating node names.
type NodeNameProviderFunc ¶ added in v1.2.2
NodeNameProviderFunc type is an adapter to allow the use of ordinary functions as NodeNameProvider.
func (NodeNameProviderFunc) GenerateNodeName ¶ added in v1.2.2
func (f NodeNameProviderFunc) GenerateNodeName(ctx context.Context) (string, error)
GenerateNodeName allows NodeNameProviderFunc to implement NodeNameProvider.
type PUUIDNodeNameProvider ¶ added in v1.2.2
type PUUIDNodeNameProvider struct{}
PUUIDNodeNameProvider generates a random UUID as the node name, with "n-" prefix.
func (PUUIDNodeNameProvider) GenerateNodeName ¶ added in v1.2.2
func (PUUIDNodeNameProvider) GenerateNodeName(ctx context.Context) (string, error)
type UUIDNodeNameProvider ¶ added in v1.2.2
type UUIDNodeNameProvider struct{}
UUIDNodeNameProvider generates a random UUID as the node name.
func (UUIDNodeNameProvider) GenerateNodeName ¶ added in v1.2.2
func (UUIDNodeNameProvider) GenerateNodeName(_ context.Context) (string, error)