serviceresources

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGraphVertexType

func GetGraphVertexType(m *model.ServiceResource) string

func GetVerticesAndEdges

func GetVerticesAndEdges(
	entities model.ServiceResources,
	vertices []types.GraphVertex,
	edges []types.GraphEdge,
) ([]types.GraphVertex, []types.GraphEdge)

GetVerticesAndEdges constructs a graph of the given model.ServiceResource entities with DFS algorithm, and appends the vertices and edges to the given slices.

func IsOperable

func IsOperable(m *model.ServiceResource) bool

func Label

func Label(ctx context.Context, op optypes.Operator, candidates []*model.ServiceResource) (berr error)

Label applies the labels to the given model.ServiceResource list with the given operator.Operator.

func ListCandidatesByIDs

func ListCandidatesByIDs(
	ctx context.Context,
	modelClient model.ClientSet,
	ids []object.ID,
) ([]*model.ServiceResource, error)

ListCandidatesByIDs gets the candidates for Label or State by id list.

func ListCandidatesPageByConnector

func ListCandidatesPageByConnector(
	ctx context.Context,
	modelClient model.ClientSet,
	connectorID object.ID,
	offset,
	limit int,
) ([]*model.ServiceResource, error)

ListCandidatesPageByConnector gets the candidates for Label or State by connector id in pagination.

func SetKeys

func SetKeys(
	ctx context.Context,
	entities model.ServiceResources,
	operators map[object.ID]optypes.Operator,
) model.ServiceResources

SetKeys sets the keys of the resources for operations like log and exec.

Types

type StateResult

type StateResult struct {
	Error         bool
	Transitioning bool
}

func State

func State(
	ctx context.Context, op optypes.Operator,
	modelClient model.ClientSet,
	candidates []*model.ServiceResource,
) (sr StateResult, berr error)

State gets status of the given model.ServiceResource list with the given operator.Operator, and represents is ready if both `Error` and `Transitioning` of StateResult are false.

func (*StateResult) Merge

func (r *StateResult) Merge(s StateResult)

Jump to

Keyboard shortcuts

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