bundle

package
v2.13.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: Unlicense Imports: 16 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// DTRoot is a bundle root directory
	DTRoot DirType = "root"
	// DTMaster directory
	DTMaster = "master"
	// DTAgent directory
	DTAgent = "agent"
	// DTPublicAgent directory
	DTPublicAgent = "public agent"
)
View Source
const (
	// CTJson represents CTJson files.
	CTJson ContentType = "JSON"
	// CTJournal represents CTJournal files.
	CTJournal = "journal"
	// CTDmesg represents dmesg files.
	CTDmesg = "dmesg"
	// CTOutput is a output of a command.
	CTOutput = "output"
	//CTOther file types
	CTOther = "other"
)

Variables

This section is empty.

Functions

func RegisterFileType

func RegisterFileType(f FileType)

RegisterFileType adds the file type to the file type registry. It panics if the file type with the same name is already registered.

Types

type Bundle

type Bundle struct {
	Hosts []Host
	Directory
}

Bundle describes DC/OS diagnostics bundle.

func New added in v2.5.0

func New(path string) (Bundle, error)

New creates new Bundle

func (Bundle) Agents

func (b Bundle) Agents() []Host

func (Bundle) ForEachDirectory added in v2.6.0

func (b Bundle) ForEachDirectory(fileTypeName FileTypeName, do func(d Directory) (stop bool))

ForEachDirectory finds all the bundle directories which contain a given type and pass them one by one to the do function. It stops if the do function returns true.

func (Bundle) ForEachFile added in v2.6.0

func (b Bundle) ForEachFile(fileTypeName FileTypeName, do func(f File) (stop bool))

ForEachFile finds all the files of a given type and pass them one by one to the do function. It stops if the do function returns true.

func (Bundle) Masters

func (b Bundle) Masters() []Host

func (Bundle) PublicAgents

func (b Bundle) PublicAgents() []Host

func (Bundle) ReadAnyJSON added in v2.9.0

func (b Bundle) ReadAnyJSON(typeName FileTypeName, v interface{}) error

ReadAnyJSON reads JSON files of a given file in each directory. The function returns nil after the first successful read or the last read error if it couldn't ready any files.

type ContentType

type ContentType string

ContentType defines type of the content in the bundle file.

type DirType

type DirType string

DirType represent different types of the hosts.

type Directory added in v2.6.0

type Directory struct {
	Type DirType
	Path string
}

func (Directory) OpenFile added in v2.6.0

func (d Directory) OpenFile(typeName FileTypeName) (File, error)

OpenFile opens the files of the typeName file type. If the file is not found, it tries to open it from a correspondent .gzip archive. If the .gzip archive is not found as well then returns an error. Caller is responsible for closing the file.

func (Directory) ReadJSON added in v2.6.0

func (d Directory) ReadJSON(typeName FileTypeName, v interface{}) error

ReadJSON reads JSON-encoded data from the bundle file and stores the result in the value pointed to by v.

func (Directory) ScanLines added in v2.6.0

func (d Directory) ScanLines(t FileTypeName, f func(n int, line string) bool) (File, error)

type File

type File interface {
	io.ReadCloser
	Name() string
}

File is a safe way to access bundle files.

type FileType

type FileType struct {
	Name        FileTypeName `yaml:"name"`
	ContentType ContentType  `yaml:"contentType"`
	Paths       []string     `yaml:"paths"`
	Description string       `yaml:"description"`
	// DirTypes defines on which host types this file can be found.
	// For example, dcos-marathon.service file can be found only on the masters.
	DirTypes []DirType `yaml:"dirTypes"`
}

FileType Describes a kind of files in the bundle (e.g. dcos-marathon.service).

func GetFileType

func GetFileType(typeName FileTypeName) FileType

GetFileType returns a file type by its name. It panics if the file type is not in the registry.

func (FileType) ExistsOn added in v2.6.0

func (t FileType) ExistsOn(dirType DirType) bool

type FileTypeName added in v2.2.0

type FileTypeName string

type Host

type Host struct {
	IP IP
	Directory
}

Host represents a host in a DC/OS cluster.

type IP added in v2.5.0

type IP string

Jump to

Keyboard shortcuts

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