Documentation
¶
Index ¶
Constants ¶
const ( // OutputFieldName is the reference of context base object OutputFieldName = "output" // OutputsFieldName is the reference of context Auxiliaries OutputsFieldName = "outputs" // ParameterFieldName is the keyword in CUE template to define users' input and the reference to the context parameter ParameterFieldName = "parameter" // ContextName is the name of context ContextName = "name" // ContextAppName is the appName of context ContextAppName = "appName" // ContextAppRevision is the revision name of app of context ContextAppRevision = "appRevision" // ContextAppRevisionNum is the revision num of app of context ContextAppRevisionNum = "appRevisionNum" // ContextAppLabels is the labels of app of context ContextAppLabels = "appLabels" // ContextAppAnnotations is the annotations of app of context ContextAppAnnotations = "appAnnotations" // ContextAppComponents is the components array of the app ContextAppComponents = "appComponents" // ContextAppWorkflow is the workflow object of the app ContextAppWorkflow = "appWorkflow" // ContextAppPolicies is the policies array of the app ContextAppPolicies = "appPolicies" // ContextAppSources is the source binding map. ContextAppSources = "appSources" // ContextAppSourceTypes maps source binding name to source definition type. ContextAppSourceTypes = "appSourceTypes" // ContextAppSourceTemplates maps source definition type to CUE template. ContextAppSourceTemplates = "appSourceTemplates" // ContextAppSourceSensitivePaths maps source definition type to platform-sensitive paths. ContextAppSourceSensitivePaths = "appSourceSensitivePaths" // ContextAppSourceCacheStore stores the source cache store used for source cache access. ContextAppSourceCacheStore = "appSourceCacheStore" // ContextNamespace is the namespace of the app ContextNamespace = "namespace" // ContextCluster is the cluster currently focusing on ContextCluster = "cluster" // ContextClusterVersion is the version object info of cluster ContextClusterVersion = "clusterVersion" // ContextPublishVersion is the publish version of the app ContextPublishVersion = "publishVersion" // ContextWorkflowName is the name of the workflow ContextWorkflowName = "workflowName" // OutputSecretName is used to store all secret names which are generated by cloud resource components OutputSecretName = "outputSecretName" // ContextCompRevisionName is the component revision name of context ContextCompRevisionName = "revision" // ContextComponents is the components of app ContextComponents = "components" // ContextComponentName is the component being rendered. It is what // context.name means in a component's own template, named explicitly so a // trait - and a source resolving on either - can ask for the component // rather than for whatever "name" happens to mean where it is read. ContextComponentName = "componentName" // ContextTraitType is the trait being rendered. Traits have no instance name // in the API - spec.components[].traits[] carries only a type - so there is // no traitName to expose. ContextTraitType = "traitType" // ContextStepName is the workflow step being rendered. ContextStepName = "stepName" // ContextStepType is that step's definition type. ContextStepType = "stepType" // ContextComponentType is the component type of current trait binding with ContextComponentType = "componentType" // ContextDataArtifacts is used to store unstructured resources of components ContextDataArtifacts = "artifacts" // ContextReplicaKey is the key of replication in context ContextReplicaKey = "replicaKey" // ContextPolicyName is the instance name of the currently executing policy (from spec.policies[].name) ContextPolicyName = "policyName" // ContextPolicyType is the definition type of the currently executing policy (from spec.policies[].type) ContextPolicyType = "policyType" // ContextPolicyRevisionName is the DefinitionRevision name if versioned ContextPolicyRevisionName = "policyRevisionName" // ContextPolicyRevision is the revision number ContextPolicyRevision = "policyRevision" // ContextPolicyRevisionHash is the template content hash ContextPolicyRevisionHash = "policyRevisionHash" )
Variables ¶
This section is empty.
Functions ¶
func NewContext ¶
func NewContext(data ContextData) process.Context
NewContext creates a new process context
Types ¶
type ContextData ¶ added in v1.2.5
type ContextData struct {
Namespace string
Cluster string
AppName string
CompName string
StepName string
CompRevision string
AppRevisionName string
WorkflowName string
PublishVersion string
ReplicaKey string
Ctx context.Context
BaseHooks []process.BaseHook
AuxiliaryHooks []process.AuxiliaryHook
Components []common.ApplicationComponent
Sources map[string]map[string]interface{}
SourceTypes map[string]string
SourceTemplates map[string]string
// SourceSensitivePaths maps source definition type to non-overridable sensitive field paths.
SourceSensitivePaths map[string][]string
// SourceCacheStore is used for persistent source cache read/write operations.
SourceCacheStore SourceCacheStore
AppLabels map[string]string
AppAnnotations map[string]string
ClusterVersion types.ClusterVersion
Output interface{}
}
ContextData is the core data of process context
type SourceCacheRead ¶
type SourceCacheRead struct {
// Data is the stored value.
Data map[string]interface{}
// Found reports that the store holds an entry for the key, fresh or not.
Found bool
// Stale reports that the entry is past its TTL.
Stale bool
// ExpiresAt is when the entry stops being fresh.
ExpiresAt time.Time
}
SourceCacheRead is the outcome of one cache lookup.
Data, Stale and ExpiresAt are meaningful only when Found. The zero value is a miss, so a store that fails returns SourceCacheRead{} with its error.
type SourceCacheStore ¶
type SourceCacheStore interface {
Read(ctx context.Context, cacheKey string, ttl time.Duration) (SourceCacheRead, error)
Write(ctx context.Context, cacheKey, sourceType string, data map[string]interface{}, meta SourceCacheWriteMeta) error
}
SourceCacheStore abstracts source cache persistence operations.
type SourceCacheToucher ¶
SourceCacheToucher is optionally implemented by a SourceCacheStore to record that a stale entry was served. It advances a last-accessed marker only while an entry is still in use but no longer being refreshed, which is exactly the window the GC sweep must respect. Stores that cannot record this may omit it.
type SourceCacheWriteMeta ¶
type SourceCacheWriteMeta struct {
// TTL is the effective cache TTL resolved for this entry.
TTL time.Duration
// SourceDefName / SourceDefNamespace identify the owning SourceDefinition.
SourceDefName string
SourceDefNamespace string
// TemplateName is the ConfigTemplate the entry was rendered against, if any.
TemplateName string
// KeyInputs names the context values that formed the identity.
KeyInputs []string
// Context holds those values.
Context map[string]interface{}
// Properties holds the binding's inputs.
Properties map[string]interface{}
// TemplateHash fingerprints the definition that produced the entry.
TemplateHash string
}
SourceCacheWriteMeta carries identity and lifetime metadata stamped onto a persisted source cache entry so a context-free garbage-collection sweep can reason about it without re-evaluating the source CUE.