common

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Defines a common set of filters that can be applied in queries for supported databases types.

Index

Constants

View Source
const (
	AuditFieldsContextKey contextutils.Key = "audit_fields"
	PrincipalContextKey   contextutils.Key = "principal"
	ErrorKindKey          contextutils.Key = "error_kind"
)
View Source
const (
	Execution           = "e"
	LaunchPlan          = "l"
	NodeExecution       = "ne"
	NodeExecutionEvent  = "nee"
	Task                = "t"
	TaskExecution       = "te"
	Workflow            = "w"
	NamedEntity         = "nen"
	NamedEntityMetadata = "nem"
	Project             = "p"
	Signal              = "s"
	AdminTag            = "at"
	ExecutionAdminTag   = "eat"
)
View Source
const DefaultProducerID = "propeller"

DefaultProducerID is used in older versions of propeller which hard code this producer id. See https://github.com/kozmoai/kozmopropeller/blob/eaf084934de5d630cd4c11aae15ecae780cc787e/pkg/controller/nodes/task/transformer.go#L114

View Source
const EqualExpression = "eq"
View Source
const ExecutionIDLength = 20
View Source
const ExecutionStringFormat = "a%s"
View Source
const MaxResponseStatusBytes = 32000

Variables

ResourceTypeToEntity maps a resource type to an entity suitable for use with Database filters

View Source
var RuntimeTypeKey = contextutils.Key("runtime_type")
View Source
var RuntimeVersionKey = contextutils.Key("runtime_version")

Functions

func GetExecutionName

func GetExecutionName(seed int64) string

#nosec

func GetInvalidRepeatedValueFilterErr

func GetInvalidRepeatedValueFilterErr(expression FilterExpression) error

func GetInvalidSingleValueFilterErr

func GetInvalidSingleValueFilterErr(expression FilterExpression) error

func GetNamespaceName

func GetNamespaceName(template string, project, domain string) string

GetNamespaceName returns kubernetes namespace name according to user defined template from config

func GetUnrecognizedFilterFunctionErr

func GetUnrecognizedFilterFunctionErr(function string) error

func GetUnsupportedFilterExpressionErr

func GetUnsupportedFilterExpressionErr(expression FilterExpression) error

func IsExecutionTerminal

func IsExecutionTerminal(phase core.WorkflowExecution_Phase) bool

func IsNodeExecutionTerminal

func IsNodeExecutionTerminal(phase core.NodeExecution_Phase) bool

func IsTaskExecutionTerminal

func IsTaskExecutionTerminal(phase core.TaskExecution_Phase) bool

func KozmoURLKeyFromNodeExecutionID

func KozmoURLKeyFromNodeExecutionID(nodeExecutionID core.NodeExecutionIdentifier) string

KozmoURLKeyFromNodeExecutionID is a modified version of the function above. This constructs a fully unique prefix, and when post-pended with the output name, forms a fully unique name for the artifact service (including the project/domain of course, which the artifact service will add).

func KozmoURLKeyFromNodeExecutionIDRetry

func KozmoURLKeyFromNodeExecutionIDRetry(nodeExecutionID core.NodeExecutionIdentifier, retry int) string

KozmoURLKeyFromNodeExecutionIDRetry is a modified version of the function above. See the uniqueness comment above.

func KozmoURLsFromNodeExecutionID

func KozmoURLsFromNodeExecutionID(nodeExecutionID core.NodeExecutionIdentifier, deck bool) *admin.KozmoURLs

func KozmoURLsFromTaskExecutionID

func KozmoURLsFromTaskExecutionID(taskExecutionID core.TaskExecutionIdentifier, deck bool) *admin.KozmoURLs

func MatchRegex

func MatchRegex(reg *regexp.Regexp, input string) map[string]string

func OffloadLiteralMap

func OffloadLiteralMap(ctx context.Context, storageClient *storage.DataStore, literalMap *core.LiteralMap, nestedKeys ...string) (storage.DataReference, error)

func OffloadLiteralMapWithRetryDelayAndAttempts

func OffloadLiteralMapWithRetryDelayAndAttempts(ctx context.Context, storageClient *storage.DataStore, literalMap *core.LiteralMap, retryDelay time.Duration, attempts int, nestedKeys ...string) (storage.DataReference, error)

Types

type ArtifactType

type ArtifactType int
const (
	ArtifactTypeUndefined ArtifactType = iota
	ArtifactTypeI                      // inputs
	ArtifactTypeO                      // outputs
	ArtifactTypeD                      // deck
)

The suffixes in these constants are used to match against the tail end of the kozmo url, to keep the kozmo url simpler

func ArtifactTypeString

func ArtifactTypeString(s string) (ArtifactType, error)

ArtifactTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func ArtifactTypeValues

func ArtifactTypeValues() []ArtifactType

ArtifactTypeValues returns all values of the enum

func (ArtifactType) IsAArtifactType

func (i ArtifactType) IsAArtifactType() bool

IsAArtifactType returns "true" if the value is listed in the enum definition. "false" otherwise

func (ArtifactType) String

func (i ArtifactType) String() string

type CloudProvider

type CloudProvider = string
const (
	AWS     CloudProvider = "aws"
	GCP     CloudProvider = "gcp"
	Sandbox CloudProvider = "sandbox"
	Local   CloudProvider = "local"
	None    CloudProvider = "none"
)

type Entity

type Entity = string

type FilterExpression

type FilterExpression int
const (
	Contains FilterExpression = iota
	GreaterThan
	GreaterThanOrEqual
	LessThan
	LessThanOrEqual
	Equal
	NotEqual
	ValueIn
)

Complete set of filters available for database queries.

type GormQueryExpr

type GormQueryExpr struct {
	Query string
	Args  interface{}
}

Container for arguments necessary to issue a GORM query.

type InlineFilter

type InlineFilter interface {
	// Returns the entity for which this filter should be applied.
	GetEntity() Entity
	// Returns the column filtered on.
	GetField() string
	// Generates fields necessary to add a filter to a gorm database query.
	GetGormQueryExpr() (GormQueryExpr, error)
	// Generates fields necessary to add a filter on a gorm database join query.
	GetGormJoinTableQueryExpr(tableName string) (GormQueryExpr, error)
}

Interface for a single filter expression.

func NewInlineFilter

func NewInlineFilter(entity Entity, function string, field string, value interface{}) (InlineFilter, error)

func NewRepeatedValueFilter

func NewRepeatedValueFilter(entity Entity, function FilterExpression, field string, repeatedValue interface{}) (InlineFilter, error)

Returns a filter which uses a repeated argument value.

func NewSingleValueFilter

func NewSingleValueFilter(entity Entity, function FilterExpression, field string, value interface{}) (InlineFilter, error)

Returns a filter which uses a single argument value.

func NewWithDefaultValueFilter

func NewWithDefaultValueFilter(defaultValue interface{}, filter InlineFilter) (InlineFilter, error)

type MapFilter

type MapFilter interface {
	GetFilter() map[string]interface{}
}

Interface for a map filter expression.

func NewMapFilter

func NewMapFilter(filter map[string]interface{}) MapFilter

type ParsedExecution

type ParsedExecution struct {
	// Returned when the user does not request a specific attempt
	NodeExecID *core.NodeExecutionIdentifier

	// This is returned in the case where the user requested a specific attempt. But the TaskID portion of this
	// will be empty since that information is not encapsulated in the kozmo url.
	PartialTaskExecID *core.TaskExecutionIdentifier

	// The name of the input or output in the literal map
	LiteralName string

	IOType ArtifactType
}

func ParseKozmoURLToExecution

func ParseKozmoURLToExecution(kozmoURL string) (ParsedExecution, error)

type RegisterAdditionalGRPCService

type RegisterAdditionalGRPCService = func(ctx context.Context, grpcServer *grpc.Server) error

RegisterAdditionalGRPCService is the interface for the plugin hook for additional GRPC service handlers which should be also served on the kozmoadmin gRPC server.

type SortParameter

type SortParameter interface {
	GetGormOrderExpr() string
}

func NewSortParameter

func NewSortParameter(sort *admin.Sort, allowed sets.String) (SortParameter, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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