specs

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: GPL-3.0 Imports: 9 Imported by: 11

Documentation

Overview

Copyright (C) 2021-2022 Daniele Rondina <geaaru@funtoo.org>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2021-2022 Daniele Rondina <geaaru@funtoo.org>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2021-2022 Daniele Rondina <geaaru@funtoo.org>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

View Source
const (
	TARFORMERS_CONFIGNAME = "tar-formers.yml"
	TARFORMERS_ENV_PREFIX = "TARFORMERS"
)

Variables

This section is empty.

Functions

func GenDefault

func GenDefault(viper *v.Viper)

Types

type CGeneral

type CGeneral struct {
	Debug bool `mapstructure:"debug,omitempty" json:"debug,omitempty" yaml:"debug,omitempty"`
}

func (*CGeneral) HasDebug

func (g *CGeneral) HasDebug() bool

type CLogging

type CLogging struct {
	// Path of the logfile
	Path string `mapstructure:"path,omitempty" json:"path,omitempty" yaml:"path,omitempty"`
	// Enable/Disable logging to file
	EnableLogFile bool `mapstructure:"enable_logfile,omitempty" json:"enable_logfile,omitempty" yaml:"enable_logfile,omitempty"`
	// Enable JSON format logging in file
	JsonFormat bool `mapstructure:"json_format,omitempty" json:"json_format,omitempty" yaml:"json_format,omitempty"`

	// Log level
	Level string `mapstructure:"level,omitempty" json:"level,omitempty" yaml:"level,omitempty"`

	// Enable emoji
	EnableEmoji bool `mapstructure:"enable_emoji,omitempty" json:"enable_emoji,omitempty" yaml:"enable_emoji,omitempty"`
	// Enable/Disable color in logging
	Color bool `mapstructure:"color,omitempty" json:"color,omitempty" yaml:"color,omitempty"`
}

type Config

type Config struct {
	Viper *v.Viper `yaml:"-" json:"-"`

	General CGeneral `mapstructure:"general" json:"general,omitempty" yaml:"general,omitempty"`
	Logging CLogging `mapstructure:"logging" json:"logging,omitempty" yaml:"logging,omitempty"`
}

func NewConfig

func NewConfig(viper *v.Viper) *Config

func (*Config) GetGeneral

func (c *Config) GetGeneral() *CGeneral

func (*Config) GetLogging

func (c *Config) GetLogging() *CLogging

func (*Config) Unmarshal

func (c *Config) Unmarshal() error

func (*Config) Yaml

func (c *Config) Yaml() ([]byte, error)

type FileMeta added in v0.3.0

type FileMeta struct {
	Uid   int    // User ID of owner
	Gid   int    // Group ID of owner
	Uname string // User name of owner
	Gname string // Group name of owner

	FileInfo fs.FileInfo // Permission and mode bits

	ModTime    time.Time // Modification time
	AccessTime time.Time // Access time
	ChangeTime time.Time // Change time

	Xattrs     map[string]string // extend attributes
	PAXRecords map[string]string // PAX extend headers records
}

func NewFileMeta added in v0.3.0

func NewFileMeta(header *tar.Header) FileMeta

func (*FileMeta) GetFileMode added in v0.3.2

func (m *FileMeta) GetFileMode() fs.FileMode
type Link struct {
	Name     string // Contains the path of the link to create (header.Name)
	Linkname string // Contains the path of the path linked to this link (header.Linkname)
	Path     string // Contains the target path merged to the destination path that must be creatd.
	TypeFlag byte
	Mode     os.FileMode
	Meta     FileMeta
}

type RenameRule

type RenameRule struct {
	Source string `yaml:"source" json:"source"`
	Dest   string `yaml:"dest" json:"dest"`
}

type SpecFile

type SpecFile struct {
	File string `yaml:"-" json:"-"`

	// Define the list of prefixes of the path to extract or to inject
	MatchPrefix []string `yaml:"match_prefix,omitempty" json:"match_prefix,omitempty"`

	IgnoreFiles []string `yaml:"ignore_files,omitempty" json:"ignore_files,omitempty"`

	// Define the list of regexes used to match the paths to ignore.
	IgnoreRegexes []string `yaml:"ignore_regexes,omitempty" json:"ignore_regexes,omitempty"`

	// If the user handler is set. Permit to define the list of the file where
	// is called the user handler function. If this list is empty it calls
	// the callback every times (and TriggeredMatchesPrefix)
	TriggeredFiles         []string `yaml:"triggered_files,omitempty" json:"triggered_files,omitempty"`
	TriggeredMatchesPrefix []string `yaml:"triggered_matches_prefix,omitempty" json:"triggered_matches_prefix,omitempty"`

	Rename     []RenameRule `yaml:"rename,omitempty" json:"rename,omitempty"`
	RenamePath []RenameRule `yaml:"rename_paths,omitempty" json:"rename_paths,omitempty"`

	RemapUids   map[string]string `yaml:"remap_uids,omitempty" json:"remap_uids,omitempty"`
	RemapGids   map[string]string `yaml:"remap_gids,omitempty" json:"remap_gids,omitempty"`
	RemapUsers  map[string]string `yaml:"remap_users,omitempty" json:"remap_users,omitempty"`
	RemapGroups map[string]string `yaml:"remap_groups,omitempty" json:"remap_groups,omitempty"`

	SameOwner        bool `yaml:"same_owner,omitempty" json:"same_owner,omitempty"`
	SameChtimes      bool `yaml:"same_chtimes,omitempty" json:"same_chtimes,omitempty"`
	MapEntities      bool `yaml:"map_entities,omitempty" json:"map_entities,omitempty"`
	BrokenLinksFatal bool `yaml:"broken_links_fatal,omitempty" json:"broken_links_fatal,omitempty"`
	EnableMutex      bool `yaml:"enable_mutex,omitempty" json:"enable_mutex,omitempty"`
	OverwritePerms   bool `yaml:"overwrite_perms,omitempty" json:"overwrite_perms,omitempty"`

	// Parallel max open files.
	MaxOpenFiles int64 `yaml:"max_openfiles,omitempty" json:"max_openfiles,omitempty"`
	BufferSize   int   `yaml:"copy_buffer_size,omitempty" json:"copy_buffer_size,omitempty"`

	// Validate extract when the file is been closed.
	Validate bool `yaml:"validate,omitempty" json:"validate,omitempty"`

	// Writer specific section
	Writer *WriterRules `yaml:"writer,omitempty" json:"writer,omitempty"`
	// contains filtered or unexported fields
}

func NewSpecFile

func NewSpecFile() *SpecFile

func NewSpecFileFromFile

func NewSpecFileFromFile(file string) (*SpecFile, error)

func NewSpecFileFromYaml

func NewSpecFileFromYaml(data []byte, f string) (*SpecFile, error)

func (*SpecFile) GetRename

func (s *SpecFile) GetRename(file string) string

func (*SpecFile) IsFileTriggered added in v0.3.0

func (s *SpecFile) IsFileTriggered(path string) bool

func (*SpecFile) IsPath2Skip

func (s *SpecFile) IsPath2Skip(resource string) bool

func (*SpecFile) OverwritePerms2Dir added in v0.3.3

func (s *SpecFile) OverwritePerms2Dir() bool

func (*SpecFile) Prepare added in v0.3.0

func (s *SpecFile) Prepare() error

type WriterRules added in v0.7.0

type WriterRules struct {
	ArchiveDirs  []string `yaml:"dirs,omitempty" json:"dirs,omitempty"`
	ArchiveFiles []string `yaml:"files,omitempty" json:"files,omitempty"`
}

func NewWriter added in v0.7.0

func NewWriter() *WriterRules

func (*WriterRules) AddDir added in v0.7.1

func (w *WriterRules) AddDir(dir string)

func (*WriterRules) AddFile added in v0.7.1

func (w *WriterRules) AddFile(f string)

Jump to

Keyboard shortcuts

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