seeker

package
v0.3.1-rc0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StatusCounts added in v0.3.0

func StatusCounts(seekers []*Seeker) (map[Status]int, error)

StatusCounts takes a slice of seeker references and returns a map containing sums of each Status

Types

type CommandExecError added in v0.3.0

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

func (CommandExecError) Error added in v0.3.0

func (e CommandExecError) Error() string

func (CommandExecError) Unwrap added in v0.3.0

func (e CommandExecError) Unwrap() error

type Commander

type Commander struct {
	Command string `json:"command"`
	// contains filtered or unexported fields
}

Commander runs shell commands.

func (Commander) Run

func (c Commander) Run() (interface{}, Status, error)

Run executes the Command

type Copier

type Copier struct {
	SourceDir string    `json:"source_directory"`
	Filter    string    `json:"filter"`
	DestDir   string    `json:"destination_directory"`
	Since     time.Time `json:"since"`
	Until     time.Time `json:"until"`
}

Copier copies files to temp dir based on a filter.

func (Copier) Run

func (c Copier) Run() (interface{}, Status, error)

Run satisfies the Runner interface and copies the filtered source files to the destination.

type CopyFilesError added in v0.3.0

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

func (CopyFilesError) Error added in v0.3.0

func (e CopyFilesError) Error() string

func (CopyFilesError) Unwrap added in v0.3.0

func (e CopyFilesError) Unwrap() error

type FindFilesError added in v0.3.0

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

func (FindFilesError) Error added in v0.3.0

func (e FindFilesError) Error() string

func (FindFilesError) Unwrap added in v0.3.0

func (e FindFilesError) Unwrap() error

type FormatUnknownError added in v0.3.0

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

func (FormatUnknownError) Error added in v0.3.0

func (e FormatUnknownError) Error() string

type HTTPer

type HTTPer struct {
	Path   string            `json:"path"`
	Client *client.APIClient `json:"client"`
}

HTTPer hits APIs.

func (HTTPer) Run

func (h HTTPer) Run() (interface{}, Status, error)

Run executes a GET request to the Path using the Client

type MakeDirError added in v0.3.0

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

func (MakeDirError) Error added in v0.3.0

func (e MakeDirError) Error() string

func (MakeDirError) Unwrap added in v0.3.0

func (e MakeDirError) Unwrap() error

type Runner

type Runner interface {
	Run() (interface{}, Status, error)
}

Runner runs things to get information.

type Seeker

type Seeker struct {
	Runner     Runner      `json:"runner"`
	Identifier string      `json:"-"`
	Result     interface{} `json:"result"`
	ErrString  string      `json:"error"` // this simplifies json marshaling
	Error      error       `json:"-"`
	Status     Status      `json:"status"`
}

Seeker seeks information via its Runner then stores the results.

func Exclude

func Exclude(excludes []string, seekers []*Seeker) ([]*Seeker, error)

Exclude takes a slice of matcher strings and a slice of seekers. If any of the seeker identifiers match the exclude according to filepath.Match() then it will not be present in the returned seeker slice. NOTE(mkcp): This is precisely identical to Select() except we flip the match check. Maybe we can perform both rounds

of filtering in one pass one rather than iterating over all the seekers several times. Not likely to be a huge speed
increase though... we're not even remotely bottlenecked on seeker filtering.

func NewCommander

func NewCommander(command string, format string) *Seeker

NewCommander provides a Seeker for running shell commands.

func NewCopier

func NewCopier(path, destDir string, since, until time.Time) *Seeker

NewCopier provides a Seeker for copying files to temp dir based on a filter.

func NewHTTPer

func NewHTTPer(client *client.APIClient, path string) *Seeker

func NewSheller

func NewSheller(command string) *Seeker

NewSheller provides a Seeker for running shell commands.

func Select

func Select(selects []string, seekers []*Seeker) ([]*Seeker, error)

Select takes a slice of matcher strings and a slice of seekers. The only seekers returned will be those matching the given select strings according to filepath.Match()

func (*Seeker) Run

func (s *Seeker) Run() (interface{}, error)

Run calls a Runner's Run() method and writes the results and any errors on the seeker struct

type ShellExecError added in v0.3.0

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

func (ShellExecError) Error added in v0.3.0

func (e ShellExecError) Error() string

func (ShellExecError) Unwrap added in v0.3.0

func (e ShellExecError) Unwrap() error

type Sheller

type Sheller struct {
	Command string `json:"command"`
	Shell   string `json:"shell"`
}

Sheller runs shell commands in a real unix shell.

func (*Sheller) Run

func (s *Sheller) Run() (interface{}, Status, error)

Run ensures a shell exists and optimistically executes the given Command string

type Status added in v0.3.0

type Status string

Status describes the result of a seeker run

const (
	// Success means all systems green
	Success Status = "success"
	// Fail means that we detected a known error and can conclusively say that the seeker did not complete.
	Fail Status = "fail"
	// Unknown means that we detected an error and the result is indeterminate (e.g. some side effect like disk or
	//   network may or may not have completed) or we don't recognize the error. If we don't recognize the error that's
	//   a signal to improve the error handling to account for it.
	Unknown Status = "unknown"
)

type UnmarshalError added in v0.3.0

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

func (UnmarshalError) Error added in v0.3.0

func (e UnmarshalError) Error() string

func (UnmarshalError) Unwrap added in v0.3.0

func (e UnmarshalError) Unwrap() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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