godu

package module
v0.0.0-...-32b9e93 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2017 License: MIT Imports: 9 Imported by: 0

README

Build Status Go Report Card

Godu

Godu is an alternative du command with useful option implemeted by Go

License

MIT

Author

Takuro Wada

Documentation

Index

Constants

View Source
const VERSION = "0.0.0"

VERSION of this application

Variables

This section is empty.

Functions

func Compare

func Compare(dumpFileName1 string, dumpFileName2 string) error

Compare compares 2 archived data and show diff result

func Load

func Load(listFlg bool, filename string) error

Load loads saved file and display the information to stdout

func Run

func Run(path string, recursive bool, absolute bool, dumpFlg bool) error

Run runs godu main logic

Types

type CompareMap

type CompareMap struct {
	Map map[string]int64
}

CompareMap ...

func (*CompareMap) Compare

func (c *CompareMap) Compare(other *CompareMap) *CompareResult

Compare ...

type CompareResult

type CompareResult struct {
	New     []CompareResultRecord
	Updated []CompareResultRecord
	Deleted []CompareResultRecord
}

CompareResult ...

type CompareResultRecord

type CompareResultRecord struct {
	Path       string
	BeforeSize int64
	AfterSize  int64
	RecordType recordType
}

CompareResultRecord ...

func (*CompareResultRecord) PrintRecord

func (crr *CompareResultRecord) PrintRecord()

PrintRecord ...

type DumpFile

type DumpFile struct {
	Header  DumpHeader
	Records []DumpRecord
}

DumpFile holes single header and multiple records

func (*DumpFile) BuildCompareMap

func (f *DumpFile) BuildCompareMap() *CompareMap

BuildCompareMap ...

type DumpHeader

type DumpHeader struct {
	Version   string
	Path      string
	TimeStamp string
}

DumpHeader describes general information of dumped records

func MakeDumpHeader

func MakeDumpHeader(path string) DumpHeader

MakeDumpHeader creates new DumpHeader instance (value)

func NewDumpHeader

func NewDumpHeader(path string) *DumpHeader

NewDumpHeader creates new DumpHeader instance (pointer)

type DumpRecord

type DumpRecord struct {
	Path    string
	RawSize int64
}

DumpRecord describes one file information

func MakeDumpRecord

func MakeDumpRecord(f *File) DumpRecord

MakeDumpRecord creates new DumpRecord instance (value)

func NewDumpRecord

func NewDumpRecord(f *File) *DumpRecord

NewDumpRecord creates new DumpRecord instance (pointer)

func (DumpRecord) HSize

func (d DumpRecord) HSize() string

HSize returns file size of File with human-readable format

func (DumpRecord) RelativePath

func (d DumpRecord) RelativePath() string

RelativePath returns the relative path of File

func (DumpRecord) Size

func (d DumpRecord) Size() int64

Size returns file size of File

type File

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

File is abstracted file object

func NewFile

func NewFile(path string, fileInfo os.FileInfo) *File

NewFile creates a new File object with given information

func Scan

func Scan(path string, recursive bool) ([](*File), int64)

Scan scans given directory

func (*File) DirSize

func (f *File) DirSize() int64

DirSize returns directory size if File is directory else 0

func (*File) HSize

func (f *File) HSize() string

HSize returns file size of File with human-readable format

func (*File) IsDir

func (f *File) IsDir() bool

IsDir returns whether File is directory or not

func (*File) Name

func (f *File) Name() string

Name returns the file name of File

func (*File) RelativePath

func (f *File) RelativePath() string

RelativePath returns the relative path of File

func (*File) SetDirSize

func (f *File) SetDirSize(size int64)

SetDirSize set DirSize to File

func (*File) Size

func (f *File) Size() int64

Size returns file size of File

type PrintableRecord

type PrintableRecord interface {
	HSize() string
	Size() int64
	RelativePath() string
}

PrintableRecord is an interface for print du records

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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