Documentation
¶
Index ¶
- type AllFileMatcher
- type AnyFileMatcher
- type ChainedFileChangeCallback
- type ExactFileMatcher
- type FileChangeCallback
- type FileChangeCallbackWrapper
- type FileChangeCompare
- type FileChangeEvent
- type FileChangeMode
- type FileChangeMonitor
- type FileCompareInfo
- type FileMD5CompareInfo
- type FileMatcher
- type FileModTimeCompareInfo
- type MatchAllFile
- type PatternFileMatcher
- type PrintFileChangeCallback
- type RegexFileMatcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllFileMatcher ¶
type AllFileMatcher struct {
// contains filtered or unexported fields
}
all the matchers should be matched
func NewAllFileMatcher ¶
func NewAllFileMatcher(matchers ...FileMatcher) *AllFileMatcher
func (*AllFileMatcher) Match ¶
func (afm *AllFileMatcher) Match(path string) bool
type AnyFileMatcher ¶
type AnyFileMatcher struct {
// contains filtered or unexported fields
}
match any of matcher
func NewAnyFileMatcher ¶
func NewAnyFileMatcher(matchers ...FileMatcher) *AnyFileMatcher
func (*AnyFileMatcher) Match ¶
func (afm *AnyFileMatcher) Match(path string) bool
type ChainedFileChangeCallback ¶
type ChainedFileChangeCallback struct {
// contains filtered or unexported fields
}
chained the file change callbacks
func NewChainedFileChangeCallback ¶
func NewChainedFileChangeCallback(callbacks ...FileChangeCallback) *ChainedFileChangeCallback
func (*ChainedFileChangeCallback) Accept ¶
func (cfcc *ChainedFileChangeCallback) Accept(path string, mode FileChangeMode)
type ExactFileMatcher ¶
type ExactFileMatcher struct {
// contains filtered or unexported fields
}
if two files are extactly same
func NewExactFileMatcher ¶
func NewExactFileMatcher(filename string) *ExactFileMatcher
func (*ExactFileMatcher) Match ¶
func (efm *ExactFileMatcher) Match(path string) bool
type FileChangeCallback ¶
type FileChangeCallback interface {
Accept(path string, mode FileChangeMode)
}
FileChangeCallback interface definition
type FileChangeCallbackWrapper ¶
type FileChangeCallbackWrapper struct {
// contains filtered or unexported fields
}
implement FileChangeCallback interface with wrapped function
func NewFileChangeCallbackWrapper ¶
func NewFileChangeCallbackWrapper(f func(path string, mode FileChangeMode)) *FileChangeCallbackWrapper
func (*FileChangeCallbackWrapper) Accept ¶
func (fccw *FileChangeCallbackWrapper) Accept(path string, mode FileChangeMode)
type FileChangeCompare ¶
type FileChangeCompare struct {
// contains filtered or unexported fields
}
func NewFileChangeCompare ¶
func NewFileChangeCompare(fileCompareInfo FileCompareInfo) *FileChangeCompare
func NewFileMD5ChangeCompare ¶
func NewFileMD5ChangeCompare() *FileChangeCompare
func NewFileTimeChangeCompare ¶
func NewFileTimeChangeCompare() *FileChangeCompare
create a file time change compare
func (*FileChangeCompare) SetInitialFiles ¶
func (fcc *FileChangeCompare) SetInitialFiles(files []string)
set the Intial files
func (*FileChangeCompare) UpdateFiles ¶
func (fcc *FileChangeCompare) UpdateFiles(files []string) []FileChangeEvent
update the files and return the FileChangeEvent array
type FileChangeEvent ¶
type FileChangeEvent struct { Name string ChangeMode FileChangeMode }
func NewFileCreateEvent ¶
func NewFileCreateEvent(file string) FileChangeEvent
func NewFileDeleteEvent ¶
func NewFileDeleteEvent(file string) FileChangeEvent
func NewFileModifyEvent ¶
func NewFileModifyEvent(file string) FileChangeEvent
type FileChangeMonitor ¶
func NewFileChangeMonitor ¶
func NewFileChangeMonitor(checkInterval int) *FileChangeMonitor
new a file change monitor with check interval in seconds the added files will be checked periodically in checkInterval seconds
func (*FileChangeMonitor) AddMonitorFile ¶
func (fm *FileChangeMonitor) AddMonitorFile(path string, recursive bool, fileMatcher FileMatcher, fileChangeCb FileChangeCallback, fileCompareInfo FileCompareInfo) error
add the file to be monitored
func (*FileChangeMonitor) RemoveMonitorFile ¶
func (fm *FileChangeMonitor) RemoveMonitorFile(path string) error
func (*FileChangeMonitor) Stop ¶
func (fm *FileChangeMonitor) Stop()
type FileCompareInfo ¶
type FileCompareInfo interface { // get the compare information of file GetCompareInfo(filename string) (interface{}, error) // check if the two file compare information is same or not IsSame(fileCompareInfo_1 interface{}, fileCompareInfo_2 interface{}) bool }
the interface to manage the file change comparation
type FileMD5CompareInfo ¶
type FileMD5CompareInfo struct { }
func NewFileMD5CompareInfo ¶
func NewFileMD5CompareInfo() *FileMD5CompareInfo
func (*FileMD5CompareInfo) GetCompareInfo ¶
func (fmci *FileMD5CompareInfo) GetCompareInfo(filename string) (interface{}, error)
func (*FileMD5CompareInfo) IsSame ¶
func (fmci *FileMD5CompareInfo) IsSame(fileCompareInfo_1 interface{}, fileCompareInfo_2 interface{}) bool
type FileMatcher ¶
type FileModTimeCompareInfo ¶
type FileModTimeCompareInfo struct { }
func NewFileModTimeCompareInfo ¶
func NewFileModTimeCompareInfo() *FileModTimeCompareInfo
func (*FileModTimeCompareInfo) GetCompareInfo ¶
func (fmtci *FileModTimeCompareInfo) GetCompareInfo(filename string) (interface{}, error)
func (*FileModTimeCompareInfo) IsSame ¶
func (fmtci *FileModTimeCompareInfo) IsSame(fileCompareInfo_1 interface{}, fileCompareInfo_2 interface{}) bool
type MatchAllFile ¶
type MatchAllFile struct { }
func NewMatchAllFile ¶
func NewMatchAllFile() *MatchAllFile
func (MatchAllFile) Match ¶
func (maf MatchAllFile) Match(path string) bool
type PatternFileMatcher ¶
type PatternFileMatcher struct {
// contains filtered or unexported fields
}
match the file basename by filepath.Match method
func NewPatternFileMatcher ¶
func NewPatternFileMatcher(pattern string) *PatternFileMatcher
func (*PatternFileMatcher) Match ¶
func (pfm *PatternFileMatcher) Match(path string) bool
type PrintFileChangeCallback ¶
type PrintFileChangeCallback struct { }
implement the FileChangeCallback interface and print the changed event to console
func NewPrintFileChangeCallback ¶
func NewPrintFileChangeCallback() *PrintFileChangeCallback
func (*PrintFileChangeCallback) Accept ¶
func (pfcc *PrintFileChangeCallback) Accept(path string, mode FileChangeMode)
type RegexFileMatcher ¶
type RegexFileMatcher struct {
// contains filtered or unexported fields
}
match by regular expression
func NewRegexFileMatcher ¶
func NewRegexFileMatcher(expr string) (*RegexFileMatcher, error)
func (*RegexFileMatcher) Match ¶
func (rfm *RegexFileMatcher) Match(path string) bool