Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SourceSize ¶
SourceSize sizes an opened capture source; Seek(END) covers regular files and Unix block devices alike. See sourcesize_windows.go for why this is the ONE shared derivation (#309).
func VolumeSize ¶
VolumeSize is a no-op on non-Windows platforms.
Types ¶
type ExcludedReader ¶
type ExcludedReader struct {
// contains filtered or unexported fields
}
ExcludedReader wraps a reader and zeros out excluded regions.
func NewExcludedReader ¶
func NewExcludedReader(r io.Reader, exclusions *ExclusionMap) *ExcludedReader
NewExcludedReader wraps a reader with an exclusion map.
func NewExcludedReaderAt ¶
func NewExcludedReaderAt(r io.Reader, exclusions *ExclusionMap, startOffset int64) *ExcludedReader
NewExcludedReaderAt wraps a reader whose next byte is at startOffset on the source volume. Used to resume a volatile-exclusion backup (#54): the inner reader has been seeked to the resume offset, so the exclusion bookkeeping must start there rather than at 0.
type ExclusionMap ¶
type ExclusionMap struct {
// contains filtered or unexported fields
}
ExclusionMap marks byte ranges to skip (write as zeros). Used for volatile files like pagefile.sys.
func NewExclusionMap ¶
func NewExclusionMap() *ExclusionMap
NewExclusionMap creates an empty exclusion map.
func (*ExclusionMap) AddRange ¶
func (m *ExclusionMap) AddRange(start, length int64)
AddRange marks a byte range as excluded.
func (*ExclusionMap) CoveredBytes ¶
func (m *ExclusionMap) CoveredBytes() int64
CoveredBytes is the number of distinct bytes the map excludes — overlaps between passes (volatile, subtree, live-extent) counted once. It is what an operator-facing "excluding X (N MB)" line reports (#468).
func (*ExclusionMap) IsExcluded ¶
func (m *ExclusionMap) IsExcluded(offset, length int64) bool
IsExcluded returns true if any byte in the range [offset, offset+length) is excluded. Binary search over the sorted ranges: catalog marking (#94) calls this once per extent across whole-volume catalogs, where a linear scan of a large repo-subtree map would be O(files × ranges).
func (*ExclusionMap) Len ¶
func (m *ExclusionMap) Len() int
Len returns the number of excluded ranges.
func (*ExclusionMap) ZeroExcluded ¶
func (m *ExclusionMap) ZeroExcluded(p []byte, bufStart int64)
ZeroExcluded zeros the bytes of p that fall in an excluded range, where p represents the source bytes starting at bufStart. This is the same masking ExcludedReader applies to the stream, exposed so the resume boundary probe can reproduce the exact bytes the pipeline hashed (#54).
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader provides sequential reading of a volume or file for the backup pipeline.
func NewReader ¶
NewReader opens a volume device path or file for reading. bufferSize controls the read chunk size (default 1 MB).
func (*Reader) SeekTo ¶
SeekTo repositions the reader so the next Read returns the byte at off. It is used to resume an interrupted backup from a checkpoint offset (#42). For a buffered file it is a plain seek. For a direct-I/O device it seeks to the sector floor (O_DIRECT requires sector-aligned reads) and discards the sub-sector remainder, so the next Read still delivers byte off exactly.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer provides random-access writing to a file or device for restoring backups.
func NewWriter ¶
NewWriter opens or creates a file for writing at arbitrary offsets. For device paths (e.g., \\.\PhysicalDrive0), platform-specific opening is used.