common

package
v0.0.0-...-21bb945 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SrcRepo = cli.StringFlag{
		Name:     "src-repo",
		Value:    "admin@127.0.0.1:datastore",
		Usage:    "Source repo url",
		Required: true,
	}
	SrcNamespace = cli.StringFlag{
		Name:  "src-namespace",
		Usage: "Source datastore namespace",
	}
	SrcPassword = cli.StringFlag{
		Name:     "src-password",
		Usage:    "Source repo password",
		Required: true,
	}
	SrcFingerprint = cli.StringFlag{
		Name:     "src-fingerprint",
		Usage:    "Source repo fingerprint",
		Required: true,
	}
	SrcKeyFile = cli.StringFlag{
		Name:  "src-keyfile",
		Usage: "Source key file",
	}
	SrcKeyPassword = cli.StringFlag{
		Name:  "src-keypassword",
		Usage: "Source key password",
	}

	DstRepo = cli.StringFlag{
		Name:     "dst-repo",
		Value:    "admin@127.0.0.1:datastore",
		Usage:    "Destination repo url",
		Required: true,
	}
	DstNamespace = cli.StringFlag{
		Name:  "dst-namespace",
		Usage: "Destination datastore namespace",
	}
	DstPassword = cli.StringFlag{
		Name:     "dst-password",
		Usage:    "Destination repo password",
		Required: true,
	}
	DstFingerprint = cli.StringFlag{
		Name:     "dst-fingerprint",
		Usage:    "Destination repo fingerprint",
		Required: true,
	}
	DstKeyFile = cli.StringFlag{
		Name:  "dst-keyfile",
		Usage: "Destination key file",
	}
	DstKeyPassword = cli.StringFlag{
		Name:  "dst-keypassword",
		Usage: "Destination key password",
	}
	BackupType = cli.GenericFlag{
		Name: "backup-type",
		Value: &EnumValue{
			Enum:    []string{"host", "vm", "ct"},
			Default: "vm",
		},
		Usage: "backup type",
	}
	BackupId = cli.StringFlag{
		Name:     "backup-id",
		Usage:    "backup id",
		Required: true,
	}
	BackupTime = cli.GenericFlag{
		Name:     "backup-time",
		Value:    &ProxmoxDateTimeValue{Default: 0},
		Usage:    "backup time",
		Required: true,
	}
)

Functions

func CheckErr

func CheckErr(err error, str string, v ...interface{})

func DeferClose

func DeferClose(closer io.Closer, str string, v ...interface{}) bool

func PrintErr

func PrintErr(err error, str string, v ...interface{}) bool

func ReadHashFromFile

func ReadHashFromFile(filename string) ([]*chainhash.Hash, error)

func SetupProgressbar

func SetupProgressbar(size uint64, description string) *progressbar.ProgressBar

Types

type EnumValue

type EnumValue struct {
	Enum    []string
	Default string
	// contains filtered or unexported fields
}

func (*EnumValue) Set

func (e *EnumValue) Set(value string) error

func (*EnumValue) String

func (e *EnumValue) String() string

type HashSorter

type HashSorter []*chainhash.Hash

func (HashSorter) Len

func (s HashSorter) Len() int

func (HashSorter) Less

func (s HashSorter) Less(i, j int) bool

func (HashSorter) Swap

func (s HashSorter) Swap(i, j int)

type LanguageValue

type LanguageValue struct {
	Default language.Tag
	// contains filtered or unexported fields
}

func (*LanguageValue) Set

func (e *LanguageValue) Set(value string) error

func (LanguageValue) String

func (e LanguageValue) String() string

func (LanguageValue) Value

func (e LanguageValue) Value() language.Tag

type OffsetReader

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

OffsetReader implements Read, and ReadAt on a section of an underlying io.ReaderAt. The main difference between io.SectionReader and OffsetReader is that NewOffsetReadSeeker does not require the user to know the number of readable bytes.

It also partially implements Seek, where the implementation panics if io.SeekEnd is passed. This is because, OffsetReader does not know the end of the file therefore cannot seek relative to it.

func NewOffsetReadSeeker

func NewOffsetReadSeeker(r io.ReaderAt, off int64) *OffsetReader

NewOffsetReadSeeker returns an OffsetReader that reads from r starting offset offset off and stops with io.EOF when r reaches its end. The Seek function will panic if whence io.SeekEnd is passed.

func (*OffsetReader) Offset

func (o *OffsetReader) Offset() int64

func (*OffsetReader) Position

func (o *OffsetReader) Position() int64

Position returns the current position of this reader relative to the initial offset.

func (*OffsetReader) Read

func (o *OffsetReader) Read(p []byte) (n int, err error)

func (*OffsetReader) ReadAt

func (o *OffsetReader) ReadAt(p []byte, off int64) (n int, err error)

func (*OffsetReader) ReadByte

func (o *OffsetReader) ReadByte() (byte, error)

func (*OffsetReader) Seek

func (o *OffsetReader) Seek(offset int64, whence int) (int64, error)

type OffsetWriter

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

An OffsetWriter maps writes at offset base to offset base+off in the underlying writer.

func NewOffsetWriter

func NewOffsetWriter(w io.WriterAt, off int64) *OffsetWriter

NewOffsetWriter returns an OffsetWriter that writes to w starting at offset off.

func (*OffsetWriter) Seek

func (o *OffsetWriter) Seek(offset int64, whence int) (int64, error)

func (*OffsetWriter) Write

func (o *OffsetWriter) Write(p []byte) (n int, err error)

func (*OffsetWriter) WriteAt

func (o *OffsetWriter) WriteAt(p []byte, off int64) (n int, err error)

type ProxmoxDateTimeValue

type ProxmoxDateTimeValue struct {
	Default uint64
	// contains filtered or unexported fields
}

func (*ProxmoxDateTimeValue) Set

func (e *ProxmoxDateTimeValue) Set(value string) error

func (*ProxmoxDateTimeValue) String

func (e *ProxmoxDateTimeValue) String() string

func (*ProxmoxDateTimeValue) Value

func (e *ProxmoxDateTimeValue) Value() uint64

Jump to

Keyboard shortcuts

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