resolve

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: Apache-2.0 Imports: 1 Imported by: 64

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Resolver

type Resolver interface {
	// ResolveHostFS Resolves a path based on a user-set HostFS flag, in cases where a user wants to monitor an alternate filesystem root
	// If no user root has been set, it will return the input string
	ResolveHostFS(string) string
	// IsSet returns true if the user has set an alternate filesystem root
	IsSet() bool
	// Join emulates the behavior of filepath.join
	Join(...string) string
}

Resolver is an interface for HostFS resolvers. This is meant to be generic and (hopefully) future-proof way of dealing with a user-supplied root filesystem path. A resolver-style function serves two ends: 1) if we attempt to stop consumers from merely "saving off" a string, the underlying implementation can update hostfs values and pass the new paths along to consumers 2) This stops different bits of code from making different assumptions about what's in hostfs and otherwise treating the concept differently. It's easy to mix up "hostfs" and "procfs" and "sysfs" as concepts. A single resolver forces this logic to be a little more centralized.

type TestingResolver

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

TestingResolver is a bare implementation of the resolver, for system tests that need a Resolver object or a test path for input files.

func NewTestResolver

func NewTestResolver(path string) TestingResolver

NewTestResolver returns a new resolver for internal testing, or other uses outside metricbeat modules.

func (TestingResolver) IsSet

func (t TestingResolver) IsSet() bool

func (TestingResolver) Join

func (t TestingResolver) Join(path ...string) string

func (TestingResolver) ResolveHostFS

func (t TestingResolver) ResolveHostFS(path string) string

Jump to

Keyboard shortcuts

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