common

package
v0.0.0-...-d046737 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ProgressStateInProgress = ProgressState("in_progress")
	ProgressStateComplete   = ProgressState("complete")
	ProgressStateError      = ProgressState("error")
)
View Source
const (
	ProgressPercentageBackup      = 95
	ProgressPercentageBackupTotal = 100
)
View Source
const (
	MessageTypeError = MessageType("error")
)

Variables

This section is empty.

Functions

func GetProgress

func GetProgress(total, processed int64) int

func IsBlockSafeToDelete

func IsBlockSafeToDelete(blk *BlockInfo) bool

func MergeErrorChannels

func MergeErrorChannels(ctx context.Context, channels ...<-chan error) <-chan error

MergeErrorChannels will merge all error channels into a single error out channel. the error out channel will be closed once the ctx is done or all error channels are closed if there is an error on one of the incoming channels the error will be relayed.

func PopulateBlocksForFullRestore

func PopulateBlocksForFullRestore(blocks []BlockMapping, compressionMethod string) (<-chan *Block, <-chan error)

func PopulateMappings

func PopulateMappings(bsDriver backupstore.BackupStoreDriver, mappings *Mappings) (<-chan Mapping, <-chan error)

func UpdateBlockReferenceCount

func UpdateBlockReferenceCount(blockInfos map[string]*BlockInfo, blocks []BlockMapping, driver backupstore.BackupStoreDriver)

Types

type Block

type Block struct {
	Offset            int64
	BlockChecksum     string
	CompressionMethod string
	IsZeroBlock       bool
}

type BlockInfo

type BlockInfo struct {
	Checksum string
	Path     string
	Refcount int
}

type BlockMapping

type BlockMapping struct {
	Offset        int64
	BlockChecksum string
}

func SortBackupBlocks

func SortBackupBlocks(blocks []BlockMapping, size, blockSize int64) []BlockMapping

type Mapping

type Mapping struct {
	Offset int64
	Size   int64
}

type Mappings

type Mappings struct {
	Mappings  []Mapping
	BlockSize int64
}

type MessageType

type MessageType string

type ProcessingBlocks

type ProcessingBlocks struct {
	sync.Mutex
	Blocks map[string][]*BlockMapping
}

type Progress

type Progress struct {
	sync.Mutex

	TotalBlockCounts     int64
	ProcessedBlockCounts int64
	NewBlockCounts       int64

	Progress int
}

type ProgressState

type ProgressState string

Jump to

Keyboard shortcuts

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