objectselector

package
v1.0.0-alpha1.0...-2e0dbe4 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExist = errors.New("no such object")
)

Functions

func WithClient

func WithClient(client *client.T) funcopt.O

WithClient sets the client struct key

func WithConfigFilterDisabled

func WithConfigFilterDisabled() funcopt.O

WithConfigFilterDisabled disable config filtering.

func WithLocal

func WithLocal(v bool) funcopt.O

WithLocal forces the selection to be expanded without asking the daemon, which might result in an sub-selection of what the daemon would expand the selector to.

func WithPaths

func WithPaths(paths naming.Paths) funcopt.O

WithPaths forces a list of naming.Path from where the filtering will be done by Expand. The daemon knows the path of objects with no local instance, so better to use that instead of crawling etc/ via naming.InstalledPaths()

Types

type Selection

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

Selection is the selection structure

func New

func New(selector string, opts ...funcopt.O) *Selection

New allocates a new object selection

func (*Selection) CheckFilters

func (t *Selection) CheckFilters() error

CheckFilters checks the filters

func (*Selection) Expand

func (t *Selection) Expand() (naming.Paths, error)

Expand resolves a selector expression into a list of object paths.

First try to resolve using the daemon (remote or local), as the daemons know all cluster objects, even remote ones. If executed on a cluster node, fallback to a local selector, which looks up installed configuration files.

func (*Selection) ExpandSet

func (t *Selection) ExpandSet() (*orderedset.OrderedSet, error)

ExpandSet returns a set of the expandPaths returned by Expand. Usually to benefit from the .Has() function.

func (*Selection) MustExpand

func (t *Selection) MustExpand() (naming.Paths, error)

func (*Selection) Objects

func (t *Selection) Objects(opts ...funcopt.O) ([]interface{}, error)

Objects returns the selected list of objects. This function relays its funcopts to the object.NewFromPath() function.

func (*Selection) SetPaths

func (t *Selection) SetPaths(installed naming.Paths)

SetPaths sets the paths from where the selection Expand is done.

func (*Selection) String

func (t *Selection) String() string

Jump to

Keyboard shortcuts

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