Documentation
¶
Index ¶
- Variables
- type FeatureListItem
- type InspectionDryRunResult
- type InspectionInterceptor
- type InspectionRegistrationFunc
- type InspectionRunResult
- type InspectionTaskRegistry
- type InspectionTaskRunner
- func (i *InspectionTaskRunner) AddInterceptors(interceptors ...InspectionInterceptor)
- func (i *InspectionTaskRunner) Cancel() error
- func (i *InspectionTaskRunner) DryRun(ctx context.Context, req *inspectioncore_contract.InspectionRequest) (*InspectionDryRunResult, error)
- func (i *InspectionTaskRunner) FeatureList() ([]FeatureListItem, error)
- func (i *InspectionTaskRunner) GetCurrentMetadata() (*typedmap.ReadonlyTypedMap, error)
- func (i *InspectionTaskRunner) Metadata() (map[string]any, error)
- func (i *InspectionTaskRunner) Result() (*InspectionRunResult, error)
- func (i *InspectionTaskRunner) Run(ctx context.Context, req *inspectioncore_contract.InspectionRequest) error
- func (i *InspectionTaskRunner) SetFeatureList(featureList []string) error
- func (i *InspectionTaskRunner) SetInspectionType(inspectionType string) error
- func (i *InspectionTaskRunner) Started() bool
- func (i *InspectionTaskRunner) UpdateFeatureMap(featureMap map[string]bool) error
- func (i *InspectionTaskRunner) Wait() <-chan struct{}
- type InspectionTaskServer
- func (s *InspectionTaskServer) AddInspectionInterceptor(interceptor InspectionInterceptor)
- func (s *InspectionTaskServer) AddInspectionType(newInspectionType InspectionType) error
- func (s *InspectionTaskServer) AddRunContextOption(option RunContextOption)
- func (s *InspectionTaskServer) AddTask(task coretask.UntypedTask) error
- func (s *InspectionTaskServer) CreateInspection(inspectionType string) (string, error)
- func (s *InspectionTaskServer) GetAllInspectionTypes() []*InspectionType
- func (s *InspectionTaskServer) GetAllRegisteredTasks() []coretask.UntypedTask
- func (s *InspectionTaskServer) GetAllRunners() []*InspectionTaskRunner
- func (s *InspectionTaskServer) GetInspection(inspectionID string) *InspectionTaskRunner
- func (s *InspectionTaskServer) GetInspectionType(inspectionTypeId string) *InspectionType
- type InspectionType
- type RunContextOption
Constants ¶
This section is empty.
Variables ¶
var DefaultFeatureTaskOrder = 1000000
DefaultFeatureTaskOrder is a number used for sorting feature task when the task has no LabelKeyFeatureTaskOrder label.
Functions ¶
This section is empty.
Types ¶
type FeatureListItem ¶
type InspectionDryRunResult ¶
type InspectionDryRunResult struct {
Metadata interface{} `json:"metadata"`
}
type InspectionInterceptor ¶ added in v0.50.0
type InspectionInterceptor func(ctx context.Context, req *inspectioncore_contract.InspectionRequest, next func(context.Context) error) error
InspectionInterceptor is a function that can intercept the execution of an inspection task.
func InspectionTaskLogger ¶ added in v0.50.0
type InspectionRegistrationFunc ¶
type InspectionRegistrationFunc = func(registry InspectionTaskRegistry) error
type InspectionRunResult ¶
type InspectionRunResult struct {
Metadata interface{}
ResultStore inspectioncore_contract.Store
}
type InspectionTaskRegistry ¶
type InspectionTaskRegistry interface {
coretask.TaskRegistry
// AddInspectionType adds a new definition of InspectionType.
AddInspectionType(newInspectionType InspectionType) error
}
InspectionTaskRegistry is interface for task packages to register its tasks and inspection types.
type InspectionTaskRunner ¶
type InspectionTaskRunner struct {
ID string
// contains filtered or unexported fields
}
InspectionTaskRunner manages the lifecycle of a single inspection instance. It handles task graph resolution, execution, and result retrieval for a given inspection type and feature set.
func NewInspectionRunner ¶
func NewInspectionRunner(server *InspectionTaskServer, ioConfig *inspectioncore_contract.IOConfig, id string, options ...RunContextOption) *InspectionTaskRunner
NewInspectionRunner creates a new InspectionTaskRunner.
func (*InspectionTaskRunner) AddInterceptors ¶ added in v0.50.0
func (i *InspectionTaskRunner) AddInterceptors(interceptors ...InspectionInterceptor)
AddInterceptors adds interceptors to the runner.
func (*InspectionTaskRunner) Cancel ¶
func (i *InspectionTaskRunner) Cancel() error
Cancel requests the cancellation of a running inspection.
func (*InspectionTaskRunner) DryRun ¶
func (i *InspectionTaskRunner) DryRun(ctx context.Context, req *inspectioncore_contract.InspectionRequest) (*InspectionDryRunResult, error)
DryRun performs a dry run of the inspection. It resolves the task graph and runs it in dry-run mode to collect metadata without executing tasks.
func (*InspectionTaskRunner) FeatureList ¶
func (i *InspectionTaskRunner) FeatureList() ([]FeatureListItem, error)
FeatureList returns the list of available features for the current inspection type.
func (*InspectionTaskRunner) GetCurrentMetadata ¶
func (i *InspectionTaskRunner) GetCurrentMetadata() (*typedmap.ReadonlyTypedMap, error)
GetCurrentMetadata returns the metadata map for the current inspection run.
func (*InspectionTaskRunner) Metadata ¶
func (i *InspectionTaskRunner) Metadata() (map[string]any, error)
Metadata returns the serializable metadata of the current run.
func (*InspectionTaskRunner) Result ¶
func (i *InspectionTaskRunner) Result() (*InspectionRunResult, error)
Result returns the final result of a completed inspection. It extracts the inspection data store and serializable metadata from the task runner's result.
func (*InspectionTaskRunner) Run ¶
func (i *InspectionTaskRunner) Run(ctx context.Context, req *inspectioncore_contract.InspectionRequest) error
Run executes the inspection. It resolves the task graph, sets up the context and metadata, and starts the task runner asynchronously.
func (*InspectionTaskRunner) SetFeatureList ¶
func (i *InspectionTaskRunner) SetFeatureList(featureList []string) error
SetFeatureList sets the list of enabled features for the inspection.
func (*InspectionTaskRunner) SetInspectionType ¶
func (i *InspectionTaskRunner) SetInspectionType(inspectionType string) error
SetInspectionType sets the type of inspection and initializes the available tasks. It filters the root task set from the server to get tasks relevant to the specified inspectionType.
func (*InspectionTaskRunner) Started ¶
func (i *InspectionTaskRunner) Started() bool
Started returns true if the inspection has been started.
func (*InspectionTaskRunner) UpdateFeatureMap ¶
func (i *InspectionTaskRunner) UpdateFeatureMap(featureMap map[string]bool) error
UpdateFeatureMap updates the enabled features based on the provided map. The input map contains feature IDs and a boolean indicating if they should be enabled.
func (*InspectionTaskRunner) Wait ¶
func (i *InspectionTaskRunner) Wait() <-chan struct{}
Wait returns a channel that is closed when the inspection finishes.
type InspectionTaskServer ¶
type InspectionTaskServer struct {
// RootTaskSet is the set of the all tasks in KHI.
RootTaskSet *coretask.TaskSet
// contains filtered or unexported fields
}
InspectionTaskServer manages tasks and provides apis to get task related information in JSON convertible type.
func NewServer ¶
func NewServer(ioConfig *inspectioncore_contract.IOConfig) (*InspectionTaskServer, error)
func (*InspectionTaskServer) AddInspectionInterceptor ¶ added in v0.50.0
func (s *InspectionTaskServer) AddInspectionInterceptor(interceptor InspectionInterceptor)
AddInspectionInterceptor adds an interceptor that will be applied to all new inspection runners.
func (*InspectionTaskServer) AddInspectionType ¶
func (s *InspectionTaskServer) AddInspectionType(newInspectionType InspectionType) error
AddInspectionType register a inspection type.
func (*InspectionTaskServer) AddRunContextOption ¶
func (s *InspectionTaskServer) AddRunContextOption(option RunContextOption)
AddRunContextOption adds a RunContextOption that will be applied to all new inspection runners.
func (*InspectionTaskServer) AddTask ¶
func (s *InspectionTaskServer) AddTask(task coretask.UntypedTask) error
AddTask register a task usable for the inspection task graph execution.
func (*InspectionTaskServer) CreateInspection ¶
func (s *InspectionTaskServer) CreateInspection(inspectionType string) (string, error)
CreateInspection generates an inspection and returns inspection ID
func (*InspectionTaskServer) GetAllInspectionTypes ¶
func (s *InspectionTaskServer) GetAllInspectionTypes() []*InspectionType
func (*InspectionTaskServer) GetAllRegisteredTasks ¶
func (s *InspectionTaskServer) GetAllRegisteredTasks() []coretask.UntypedTask
GetAllRegisteredTasks returns a cloned list of all tasks registered in this server.
func (*InspectionTaskServer) GetAllRunners ¶
func (s *InspectionTaskServer) GetAllRunners() []*InspectionTaskRunner
func (*InspectionTaskServer) GetInspection ¶
func (s *InspectionTaskServer) GetInspection(inspectionID string) *InspectionTaskRunner
Inspection returns an instance of an Inspection queried with given inspection ID.
func (*InspectionTaskServer) GetInspectionType ¶
func (s *InspectionTaskServer) GetInspectionType(inspectionTypeId string) *InspectionType
type InspectionType ¶
type RunContextOption ¶
type RunContextOption = func(ctx context.Context, mode inspectioncore_contract.InspectionTaskModeType) (context.Context, error)
RunContextOption modify the given context before passing it to the task runner.
func RunContextOptionArrayElementFromValue ¶
func RunContextOptionArrayElementFromValue[T any](key typedmap.TypedKey[*[]T], value T) RunContextOption
RunContextOptionArrayElementFromValue creates a RunContextOption that appends a value to an array stored in the context under the given TypedKey. If the array does not exist, it initializes an array with the element.
func RunContextOptionFromFunc ¶
func RunContextOptionFromFunc[T any](key typedmap.TypedKey[T], f func(ctx context.Context, mode inspectioncore_contract.InspectionTaskModeType) (T, error)) RunContextOption
RunContextOptionFromFunc creates a RunContextOption that adds a dynamically generated value to the context. The function `f` is executed to produce the value, which is then added to the run context using the provided TypedKey. If `f` returns an error, the option propagation stops and the error is returned.
func RunContextOptionFromValue ¶
func RunContextOptionFromValue[T any](key typedmap.TypedKey[T], value T) RunContextOption
RunContextOptionFromValue creates a RunContextOption that adds a static value to the run context. The value is added to the context using the provided TypedKey.
Directories
¶
| Path | Synopsis |
|---|---|
|
TODO: move logger feature on task.
|
TODO: move logger feature on task. |
|
Package logutil provides log-related utilities used by multiple log processing tasks, such as parsers for different log string formats and log string converters.
|
Package logutil provides log-related utilities used by multiple log processing tasks, such as parsers for different log string formats and log string converters. |
|
Inventory related tasks defined in this file provides a framework for discovering and merging inventory data from various sources.
|
Inventory related tasks defined in this file provides a framework for discovering and merging inventory data from various sources. |