btrfssum

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: Apache-2.0, GPL-2.0, GPL-3.0-or-later, + 1 more Imports: 13 Imported by: 0

Documentation

Overview

Package btrfssum contains the checksum types and algorithms that btrfs uses.

Index

Constants

View Source
const BlockSize = 4 * 1024

Variables

This section is empty.

Functions

This section is empty.

Types

type CSum

type CSum [0x20]byte

func (CSum) Fmt

func (csum CSum) Fmt(typ CSumType) string

func (CSum) Format

func (csum CSum) Format(f fmt.State, verb rune)

func (CSum) MarshalText

func (csum CSum) MarshalText() ([]byte, error)

func (CSum) String

func (csum CSum) String() string

func (*CSum) UnmarshalText

func (csum *CSum) UnmarshalText(text []byte) error

type CSumType

type CSumType uint16
const (
	TYPE_CRC32 CSumType = iota
	TYPE_XXHASH
	TYPE_SHA256
	TYPE_BLAKE2
)

func (CSumType) Size

func (typ CSumType) Size() int

func (CSumType) String

func (typ CSumType) String() string

func (CSumType) Sum

func (typ CSumType) Sum(data []byte) (CSum, error)

type ShortSum

type ShortSum string

func (*ShortSum) DecodeJSON

func (sum *ShortSum) DecodeJSON(r io.RuneScanner) error

func (ShortSum) EncodeJSON

func (sum ShortSum) EncodeJSON(w io.Writer) error

func (ShortSum) ToFullSum

func (sum ShortSum) ToFullSum() CSum

type SumRun

type SumRun[Addr btrfsvol.IntAddr[Addr]] struct {
	// How big a ShortSum is in this Run.
	ChecksumSize int `json:",omitempty"`
	// Base address where this run starts.
	Addr Addr `json:",omitempty"`
	// All of the ShortSums in this run, concatenated together.
	Sums ShortSum
}

func (SumRun[Addr]) SeqGet

func (run SumRun[Addr]) SeqGet(sumIdx int) ShortSum

SeqGet implements diskio.Sequence[int, ShortSum].

func (SumRun[Addr]) SeqLen

func (run SumRun[Addr]) SeqLen() int

SeqLen implements diskio.Sequence[int, ShortSum].

func (SumRun[Addr]) Size

func (run SumRun[Addr]) Size() btrfsvol.AddrDelta

func (SumRun[Addr]) SumForAddr

func (run SumRun[Addr]) SumForAddr(addr Addr) (ShortSum, bool)

func (SumRun[Addr]) Walk

func (run SumRun[Addr]) Walk(ctx context.Context, fn func(Addr, ShortSum) error) error

Jump to

Keyboard shortcuts

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