Documentation ¶
Index ¶
Constants ¶
const ErrInvalidType = Error("not a valid file type")
Variables ¶
var AllTypesExceptDirectories = []DirGUTFileType{ DGUTFileTypeOther, DGUTFileTypeTemp, DGUTFileTypeVCF, DGUTFileTypeVCFGz, DGUTFileTypeBCF, DGUTFileTypeSam, DGUTFileTypeBam, DGUTFileTypeCram, DGUTFileTypeFasta, DGUTFileTypeFastq, DGUTFileTypeFastqGz, DGUTFileTypePedBed, DGUTFileTypeCompressed, DGUTFileTypeText, DGUTFileTypeLog, }
Functions ¶
This section is empty.
Types ¶
type DirGUTFileType ¶
type DirGUTFileType uint8
DirGUTFileType is one of the special file types that the directory,group,user,filetype summaries group on.
const ( DGUTFileTypeOther DirGUTFileType = 0 DGUTFileTypeTemp DirGUTFileType = 1 DGUTFileTypeVCF DirGUTFileType = 2 DGUTFileTypeVCFGz DirGUTFileType = 3 DGUTFileTypeBCF DirGUTFileType = 4 DGUTFileTypeSam DirGUTFileType = 5 DGUTFileTypeBam DirGUTFileType = 6 DGUTFileTypeCram DirGUTFileType = 7 DGUTFileTypeFasta DirGUTFileType = 8 DGUTFileTypeFastq DirGUTFileType = 9 DGUTFileTypeFastqGz DirGUTFileType = 10 DGUTFileTypePedBed DirGUTFileType = 11 DGUTFileTypeCompressed DirGUTFileType = 12 DGUTFileTypeText DirGUTFileType = 13 DGUTFileTypeLog DirGUTFileType = 14 DGUTFileTypeDir DirGUTFileType = 15 )
func FileTypeStringToDirGUTFileType ¶
func FileTypeStringToDirGUTFileType(ft string) (DirGUTFileType, error)
FileTypeStringToDirGUTFileType converts the String() representation of a DirGUTFileType back in to a DirGUTFileType. Errors if an invalid string supplied.
func (DirGUTFileType) String ¶
func (d DirGUTFileType) String() string
String lets you convert a DirGUTFileType to a meaningful string.
type DirGroupUserType ¶
type DirGroupUserType struct {
// contains filtered or unexported fields
}
DirGroupUserType is used to summarise file stats by directory, group, user and file type.
func NewByDirGroupUserType ¶
func NewByDirGroupUserType() *DirGroupUserType
NewByDirGroupUserType returns a DirGroupUserType.
func (*DirGroupUserType) Add ¶
func (d *DirGroupUserType) Add(path string, info fs.FileInfo) error
Add is a github.com/wtsi-ssg/wrstat/stat Operation. 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 and filetype. 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.
"Access" times are actually considered to be the greatest of atime, mtime and ctime.
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 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 (*DirGroupUserType) Output ¶
func (d *DirGroupUserType) Output(output StringCloser) error
Output will write summary information for all the paths previously added. The format is (tab separated):
directory gid uid filetype 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.
directory, gid, uid and filetype 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. output is closed on completion.
type GroupUser ¶
type GroupUser struct {
// contains filtered or unexported fields
}
GroupUser is used to summarise file stats by group and user.
func (*GroupUser) Add ¶
Add is a github.com/wtsi-ssg/wrstat/stat Operation. It will add the file size and increment the file count summed for the info's group and user. If path is a directory, it is ignored.
func (*GroupUser) Output ¶
func (g *GroupUser) Output(output StringCloser) error
Output will write summary information for all the paths previously added. The format is (tab separated):
group username filecount filesize
group and username are sorted, and there is a special username "all" to give total filecount and filesize for all users that wrote files in that group.
Returns an error on failure to write, or if username or group can't be determined from the uids and gids in the added file info. output is closed on completion.
type StringCloser ¶ added in v4.2.0
type StringCloser interface { io.StringWriter io.Closer }
type Usergroup ¶
type Usergroup struct {
// contains filtered or unexported fields
}
Usergroup is used to summarise file stats by user and group.
func (*Usergroup) Add ¶
Add is a github.com/wtsi-ssg/wrstat/stat Operation. It will break path in to its directories and add the file size and increment the file count to each, summed for the info's user and group. If path is a directory, it is ignored.
func (*Usergroup) Output ¶
func (u *Usergroup) Output(output StringCloser) error
Output will write summary information for all the paths previously added. The format is (tab separated):
username group directory filecount filesize
usernames, groups and directories are sorted.
Returns an error on failure to write, or if username or group can't be determined from the uids and gids in the added file info. output is closed on completion.