backup

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypePos              = 0
	SubTypePos           = 1
	FileNameOrDirNamePos = 2
)

Format :type,subtype,filename or dirname

View Source
const (
	CnConfig     = "cn"
	DnConfig     = "dn"
	LogConfig    = "log"
	ProxyConfig  = "proxy"
	LaunchConfig = "launch"
)
View Source
const (
	HakeeperFile = "hk_data"
)
View Source
const (
	Version = "0823"
)

Variables

This section is empty.

Functions

func Backup

func Backup(ctx context.Context, bs *tree.BackupStart, cfg *Config) error

Backup Note: ctx needs to support cancel. The user can cancel the backup task by canceling the ctx.

func BackupData

func BackupData(ctx context.Context, srcFs, dstFs fileservice.FileService, dir string, config *Config) error

func CopyCheckpointDir added in v1.2.2

func CopyCheckpointDir(
	ctx context.Context,
	srcFs, dstFs fileservice.FileService,
	dir string, backup types.TS,
) ([]*taeFile, types.TS, error)

func CopyFile

func CopyFile(ctx context.Context, srcFs, dstFs fileservice.FileService, name, dstDir string, newNames ...string) ([]byte, error)

CopyFile copy file from srcFs to dstFs and return checksum of the written file.

func CopyFileWithRetry added in v1.2.0

func CopyFileWithRetry(ctx context.Context, srcFs, dstFs fileservice.FileService, name, dstDir string, newName ...string) ([]byte, error)

func CopyGCDir added in v1.2.2

func CopyGCDir(
	ctx context.Context,
	srcFs, dstFs fileservice.FileService,
	dir string,
	backup, min types.TS,
) ([]*taeFile, error)

func SaveLaunchConfigPath

func SaveLaunchConfigPath(typ string, paths []string)

SaveLaunchConfigPath saves all config file paths for the standalone config

func ToCsvLine2

func ToCsvLine2(s [][]string) (string, error)

Types

type Config

type Config struct {
	// Timestamp
	Timestamp types.TS

	// For General usage
	GeneralDir fileservice.FileService

	// For locating tae's storage fs
	SharedFs fileservice.FileService

	// For tae and hakeeper
	TaeDir fileservice.FileService

	// hakeeper client
	HAkeeper logservice.CNHAKeeperClient

	Metas *Metas

	// For parallel backup
	Parallelism uint16

	BackupType string
	BackupTs   types.TS
}

type Meta

type Meta struct {
	Typ               MetaType
	SubTyp            string
	FileNameOrDirName string

	//version
	Version string

	//build info
	Buildinfo string

	//launch config
	LaunchConfigFile string
}

Meta of mo_meta same as the mo_br

func (*Meta) CsvString

func (m *Meta) CsvString() []string

func (*Meta) String

func (m *Meta) String() string

type MetaType

type MetaType int
const (
	/**
	  backup_meta | mo_meta
	    ID        |
	    Version   | Version
	    Buildinfo | Buildinfo
	              | Launchconfig
	              | Tae
	              | Hakeeper
	*/
	TypeVersion MetaType = iota
	TypeBuildinfo
	TypeLaunchconfig
)

func (MetaType) String

func (t MetaType) String() string

type Metas

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

func NewMetas

func NewMetas() *Metas

func (*Metas) Append

func (m *Metas) Append(meta *Meta)

func (*Metas) AppendBuildinfo

func (m *Metas) AppendBuildinfo(info string)

func (*Metas) AppendLaunchconfig

func (m *Metas) AppendLaunchconfig(subTyp, file string)

func (*Metas) AppendVersion

func (m *Metas) AppendVersion(version string)

func (*Metas) CsvString

func (m *Metas) CsvString() [][]string

func (*Metas) String

func (m *Metas) String() string

Jump to

Keyboard shortcuts

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