dependency

package
v0.3.0-alpha.8 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package dependency implements the dependency handling database.

Index

Constants

View Source
const StarID = "*"

StarID denotes ID value which matches any other ID.

Variables

This section is empty.

Functions

func Equal

func Equal(a, b *controller.Input) bool

Equal checks if two controller.Dependency objects are completely equivalent.

func EqualKeys

func EqualKeys(a, b *controller.Input) bool

EqualKeys checks if two controller.Dependency objects have equal (conflicting) keys.

func Less

func Less(a, b *controller.Input) bool

Less compares two controller.Dependency objects.

This sort order is compatible with the way memdb handles ordering.

Types

type ControllerInput

type ControllerInput struct {
	ControllerName string
	Namespace      resource.Namespace
	Type           resource.Type
	ID             resource.ID
	Kind           controller.InputKind
}

ControllerInput tracks inputs of the controller.

type ControllerOutput

type ControllerOutput struct {
	Type           resource.Type
	ControllerName string
	Kind           controller.OutputKind
}

ControllerOutput tracks which objects are managed by controllers.

type Database

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

Database tracks dependencies between resources and controllers (and vice versa).

func NewDatabase

func NewDatabase() (*Database, error)

NewDatabase creates new Database.

func (*Database) AddControllerInput

func (db *Database) AddControllerInput(controllerName string, dep controller.Input) error

AddControllerInput adds a dependency of controller on a resource.

func (*Database) AddControllerOutput

func (db *Database) AddControllerOutput(controllerName string, out controller.Output) error

AddControllerOutput tracks which resource is managed by which controller.

func (*Database) DeleteControllerInput

func (db *Database) DeleteControllerInput(controllerName string, dep controller.Input) error

DeleteControllerInput adds a dependency of controller on a resource.

func (*Database) Export

func (db *Database) Export() (*controller.DependencyGraph, error)

Export dependency graph.

func (*Database) GetControllerInputs

func (db *Database) GetControllerInputs(controllerName string) ([]controller.Input, error)

GetControllerInputs returns a list of controller dependencies.

func (*Database) GetControllerOutputs

func (db *Database) GetControllerOutputs(controllerName string) ([]controller.Output, error)

GetControllerOutputs returns resource managed by controller.

func (*Database) GetDependentControllers

func (db *Database) GetDependentControllers(dep controller.Input) ([]string, error)

GetDependentControllers returns a list of controllers which depend on resource change.

func (*Database) GetResourceExclusiveController

func (db *Database) GetResourceExclusiveController(resourceType resource.Type) (string, error)

GetResourceExclusiveController returns controller which has a resource as exclusive output.

If no controller manages a resource in exclusive mode, empty string is returned.

Jump to

Keyboard shortcuts

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