archive

package
v0.0.0-...-1d50e38 Latest Latest
Warning

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

Go to latest
Published: May 30, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TarGzPackCmdName   = "targz_pack"
	TarGzUnpackCmdName = "targz_unpack"
	ArchivePluginName  = "archive"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ArchivePlugin

type ArchivePlugin struct{}

ArchivePlugin holds commands for creating archives and extracting their contents during a task.

func (*ArchivePlugin) Name

func (self *ArchivePlugin) Name() string

Name returns the name of the plugin. Fulfills the Plugin interface.

func (*ArchivePlugin) NewCommand

func (self *ArchivePlugin) NewCommand(cmdName string) (plugin.Command, error)

NewCommand takes a command name as a string and returns the requested command, or an error if the command does not exist. Fulfills the Plugin interface.

type TarGzPackCommand

type TarGzPackCommand struct {
	// the tgz file that will be created
	Target string `mapstructure:"target" plugin:"expand"`

	// the directory to compress
	SourceDir string `mapstructure:"source_dir" plugin:"expand"`

	// a list of filename blobs to include,
	// e.g. "*.tgz", "file.txt", "test_*"
	Include []string `mapstructure:"include" plugin:"expand"`

	// a list of filename blobs to exclude,
	// e.g. "*.zip", "results.out", "ignore/**"
	ExcludeFiles []string `mapstructure:"exclude_files" plugin:"expand"`
}

Plugin command responsible for creating a tgz archive.

func (*TarGzPackCommand) BuildArchive

func (self *TarGzPackCommand) BuildArchive(pluginLogger plugin.Logger) (int, error)

Build the archive. Returns the number of files included in the archive (0 means empty archive).

func (*TarGzPackCommand) Execute

func (self *TarGzPackCommand) Execute(pluginLogger plugin.Logger,
	pluginCom plugin.PluginCommunicator,
	conf *model.TaskConfig,
	stop chan bool) error

Execute builds the archive.

func (*TarGzPackCommand) Name

func (self *TarGzPackCommand) Name() string

func (*TarGzPackCommand) ParseParams

func (self *TarGzPackCommand) ParseParams(params map[string]interface{}) error

ParseParams reads in the given parameters for the command.

func (*TarGzPackCommand) Plugin

func (self *TarGzPackCommand) Plugin() string

type TarGzUnpackCommand

type TarGzUnpackCommand struct {
	// the tgz file to unpack
	Source string `mapstructure:"source" plugin:"expand"`
	// the directory that the unpacked contents should be put into
	DestDir string `mapstructure:"dest_dir" plugin:"expand"`
}

Plugin command responsible for unpacking a tgz archive.

func (*TarGzUnpackCommand) Execute

func (self *TarGzUnpackCommand) Execute(pluginLogger plugin.Logger,
	pluginCom plugin.PluginCommunicator,
	conf *model.TaskConfig,
	stop chan bool) error

Implementation of Execute, to unpack the archive.

func (*TarGzUnpackCommand) Name

func (self *TarGzUnpackCommand) Name() string

func (*TarGzUnpackCommand) ParseParams

func (self *TarGzUnpackCommand) ParseParams(params map[string]interface{}) error

Implementation of ParseParams.

func (*TarGzUnpackCommand) Plugin

func (self *TarGzUnpackCommand) Plugin() string

func (*TarGzUnpackCommand) UnpackArchive

func (self *TarGzUnpackCommand) UnpackArchive() error

UnpackArchive unpacks the archive. The target archive to unpack is set for the command during parameter parsing.

Jump to

Keyboard shortcuts

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