stats

package
v0.0.0-...-2c34a8a Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeTotals

func ComputeTotals(prefix string, pi *prefixinfo.T, du diskusage.Calculator, match boolexpr.Matcher) (totals Totals, perUser, perGroup PerIDTotals)

ComputeTotals computes the totals for the prefix itself and any non-directory contents. Hardlinks are handled as per match.IsHardlink. Note that:

  1. Prefixes is one if the prefix matched the expression and zero otherwise.
  2. SubPrefixes is the number of prefixes this prefix contains
  3. The size of this prefix is included in the totals for the prefix, but the sizes of prefixes it contains are not.

Types

type PerIDTotals

type PerIDTotals []Totals

func (PerIDTotals) AppendBinary

func (pid PerIDTotals) AppendBinary(data []byte) []byte

func (*PerIDTotals) DecodeBinary

func (pid *PerIDTotals) DecodeBinary(data []byte) []byte

func (PerIDTotals) MarshalBinary

func (pid PerIDTotals) MarshalBinary() (data []byte, err error)

func (*PerIDTotals) UnmarshalBinary

func (tl *PerIDTotals) UnmarshalBinary(data []byte) error

type Totals

type Totals struct {
	ID           int64
	Files        int64 // number of files
	Prefix       int64 // will be 1 or 0
	SubPrefixes  int64 // number of prefixes/directories
	Bytes        int64 // total size of files
	StorageBytes int64 // total size of files on disk
	PrefixBytes  int64 // total size of prefixes
	Hardlinks    int64 // number of hardlinks
	HardlinkDirs int64 // number of hardlinks to directories
}

TODO: parametize the ID type to be int64 or string for non-posix system.

func (*Totals) AppendBinary

func (t *Totals) AppendBinary(data []byte) []byte

func (*Totals) DecodeBinary

func (t *Totals) DecodeBinary(data []byte) []byte

func (*Totals) MarshalBinary

func (t *Totals) MarshalBinary() (data []byte, err error)

func (*Totals) UnmarshalBinary

func (t *Totals) UnmarshalBinary(data []byte) error

Jump to

Keyboard shortcuts

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