dirguta

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilenameToType

func FilenameToType(name []byte) db.DirGUTAFileType

FilenameToType determines the filetype of the given path based on its basename, and returns a DirGUTAFileType.

func IsTemp

func IsTemp(name []byte) bool

IsTemp tells you if path is named like a temporary file.

func NewDirGroupUserTypeAge

func NewDirGroupUserTypeAge(db DB) summary.OperationGenerator

NewDirGroupUserTypeAge returns a DirGroupUserTypeAge.

Types

type DB

type DB interface {
	Add(dguta db.RecordDGUTA) error
}

DB contains the method that will be called for each directories DGUTA information.

type DirGroupUserTypeAge

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

DirGroupUserTypeAge is used to summarise file stats by directory, group, user, file type and age.

func (*DirGroupUserTypeAge) Add

func (d *DirGroupUserTypeAge) Add(info *summary.FileInfo) error

Add is a summary.Operation method. It will break path in to its directories and add the file size, increment the file count to each, summed for the info's group, user, filetype and age. It will also record the oldest file access time for each directory, plus the newest modification time.

If path is a directory, its access time is treated as now, so that when interested in files that haven't been accessed in a long time, directories that haven't been manually visted in a longer time don't hide the "real" results.

NB: the "temp" filetype is an extra filetype on top of the other normal filetypes, so if you sum all the filetypes to get information about a given directory+group+user combination, you should ignore "temp". Only count "temp" when it's the only type you're considering, or you'll count some files twice.

func (*DirGroupUserTypeAge) Output

func (d *DirGroupUserTypeAge) Output() error

Output is a summary.Operation method, and will write summary information for all the paths previously added. The format is (tab separated):

directory gid uid filetype age filecount filesize atime mtime

Where atime is oldest access time in seconds since Unix epoch of any file nested within directory. mtime is similar, but the newest modification time.

age is one of our age ints:

    0 = all ages
    1 = older than one month according to atime
    2 = older than two months according to atime
    3 = older than six months according to atime
    4 = older than one year according to atime
    5 = older than two years according to atime
    6 = older than three years according to atime
    7 = older than five years according to atime
    8 = older than seven years according to atime
    9 = older than one month according to mtime
   10 = older than two months according to mtime
   11 = older than six months according to mtime
   12 = older than one year according to mtime
   13 = older than two years according to mtime
   14 = older than three years according to mtime
15 = older than five years according to mtime
   16 = older than seven years according to mtime

directory, gid, uid, filetype and age are sorted. The sort on the columns is not numeric, but alphabetical. So gid 10 will come before gid 2.

filetype is one of our filetype ints:

 0 = other (not any of the others below)
 1 = temp (.tmp | temp suffix, or .tmp. | .temp. | tmp. | temp. prefix, or
           a directory in its path is named "tmp" or "temp")
 2 = vcf
 3 = vcf.gz
 4 = bcf
 5 = sam
 6 = bam
 7 = cram
 8 = fasta (.fa | .fasta suffix)
 9 = fastq (.fq | .fastq suffix)
10 = fastq.gz (.fq.gz | .fastq.gz suffix)
11 = ped/bed (.ped | .map | .bed | .bim | .fam suffix)
12 = compresed (.bzip2 | .gz | .tgz | .zip | .xz | .bgz suffix)
13 = text (.csv | .tsv | .txt | .text | .md | .dat | readme suffix)
14 = log (.log | .out | .o | .err | .e | .err | .oe suffix)

Returns an error on failure to write.

type Error

type Error string

Error is a custom error type.

func (Error) Error

func (e Error) Error() string

Error implements the error interface.

Jump to

Keyboard shortcuts

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