posix

package
v0.0.0-...-a55ed6e Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyWithProgress

func CopyWithProgress(dst io.Writer, src io.Reader, length int64, action dmplugin.Action) (int64, error)

CopyWithProgress initiates a movement of data with progress updates

Types

type ArchiveConfig

type ArchiveConfig struct {
	Name        string          `hcl:",key"`
	ID          int             `hcl:"id"`
	Root        string          `hcl:"root"`
	Compression string          `hcl:"compression"`
	Checksums   *ChecksumConfig `hcl:"checksums"`
}

ArchiveConfig is configuration for one mover.

func (*ArchiveConfig) CheckValid

func (a *ArchiveConfig) CheckValid() error

CheckValid determines if the archive configuration is a valid one.

func (*ArchiveConfig) CompressionOption

func (a *ArchiveConfig) CompressionOption() CompressionOption

CompressionOption parses Compression config parameter

func (*ArchiveConfig) Merge

func (a *ArchiveConfig) Merge(other *ArchiveConfig) *ArchiveConfig

Merge the two configs and return a copy. Does not return nil, even if both a and other are nil.

func (*ArchiveConfig) String

func (a *ArchiveConfig) String() string

type ArchiveSet

type ArchiveSet []*ArchiveConfig

ArchiveSet is a list of mover configs.

func (ArchiveSet) Merge

func (as ArchiveSet) Merge(other ArchiveSet) ArchiveSet

Merge the two sets. Actually just returns the other one if set otherwise it returns the original set. TODO: actually merge the sets here

type ChecksumConfig

type ChecksumConfig struct {
	Disabled                bool `hcl:"disabled"`
	DisableCompareOnRestore bool `hcl:"disable_compare_on_restore"`
}

ChecksumConfig defines the configured behavior for file checksumming in the POSIX data mover

var (
	// DefaultChecksums are enabled
	DefaultChecksums ChecksumConfig
)

func (*ChecksumConfig) Merge

func (c *ChecksumConfig) Merge(other *ChecksumConfig) *ChecksumConfig

Merge the two configurations. Returns a copy of other if it is not nil, otherwise retuns a copy of c.

type CompressionOption

type CompressionOption int

CompressionOption value determines if data compression is enabled.

const (
	// CompressOff disables data compression
	CompressOff CompressionOption = iota
	// CompressOn enables data compression
	CompressOn
	// CompressAuto enables compression when a compressible file is detection
	CompressAuto
)

type Mover

type Mover struct {
	Name        string
	ArchiveDir  string
	Compression CompressionOption
	Checksums   ChecksumConfig
}

Mover is a POSIX data mover

func NewMover

func NewMover(config *ArchiveConfig) (*Mover, error)

NewMover returns a new *Mover

func (*Mover) Archive

func (m *Mover) Archive(action dmplugin.Action) error

Archive fulfills an HSM Archive request

func (*Mover) ChecksumConfig

func (m *Mover) ChecksumConfig() *ChecksumConfig

ChecksumConfig returns the mover's checksum configuration Returns a pointer so the caller can modify the config.

func (*Mover) ChecksumEnabled

func (m *Mover) ChecksumEnabled() bool

ChecksumEnabled returns true if user has enabled checksum calculation.

func (*Mover) ChecksumWriter

func (m *Mover) ChecksumWriter(dst io.Writer) (cw checksum.Writer)

ChecksumWriter returns an instance of its namesake.

func (*Mover) Destination

func (m *Mover) Destination(id string) string

Destination returns the path to archived file. Exported for testing.

func (*Mover) Remove

func (m *Mover) Remove(action dmplugin.Action) error

Remove fulfills an HSM Remove request

func (*Mover) Restore

func (m *Mover) Restore(action dmplugin.Action) error

Restore fulfills an HSM Restore request

func (*Mover) Start

func (m *Mover) Start()

Start signals the mover to begin any asynchronous processing (e.g. stats)

Jump to

Keyboard shortcuts

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