policy

package
v0.0.0-...-e73b65a Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Settings = &settings.Settings

Application settings.

Functions

This section is empty.

Types

type Client

type Client struct {
	LibClient
}

Client.

func (*Client) Enabled

func (r *Client) Enabled() bool

Enabled.

func (*Client) Validate

func (r *Client) Validate(
	path string,
	workload interface{}) (version int, concerns []model.Concern, err error)

Validate the VM.

func (*Client) Version

func (r *Client) Version(path string) (version int, err error)

Policy version.

type LibClient

type LibClient = libweb.Client

Lib.

type Pool

type Pool struct {
	Client
	// contains filtered or unexported fields
}

Policy agent task pool.

var Agent Pool

Pool (singleton).

func (*Pool) Backlog

func (r *Pool) Backlog() int

The pool backlog.

func (*Pool) Shutdown

func (r *Pool) Shutdown()

Shutdown the pool. Terminate workers and stop processing result queue.

func (*Pool) Start

func (r *Pool) Start()

Main. Start workers and process output queue.

func (*Pool) Submit

func (r *Pool) Submit(task *Task) (err error)

Submit validation task. Queue validation request.

func (*Pool) Version

func (r *Pool) Version(path string) (version int, err error)

Policy version.

type Task

type Task struct {
	// Path (endpoint).
	Path string
	// VM reference.
	Ref refapi.Ref
	// Revision number of the VM being validated.
	Revision int64
	// Context.
	Context context.Context
	// Workload builder.
	Workload func(string) (interface{}, error)
	// Task result channel.
	Result chan *Task
	// Reported policy version.
	Version int
	// Reported concerns.
	Concerns []model.Concern
	// Reported error.
	Error error
	// contains filtered or unexported fields
}

Policy agent task.

func (*Task) Duration

func (r *Task) Duration() time.Duration

Duration.

func (*Task) String

func (r *Task) String() string

Description.

func (*Task) Worker

func (r *Task) Worker() int

Worker ID.

type ValidationError

type ValidationError struct {
	Errors []string
}

Error reported by the service.

func (*ValidationError) Error

func (r *ValidationError) Error() string

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

Task worker.

Jump to

Keyboard shortcuts

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