Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileFilter ¶
FileFilter type for file filtering.
func FilterIsCollecting ¶
func FilterIsCollecting() FileFilter
FilterIsCollecting returns a filter that matches files that are being collected.
func FilterIsListening ¶
func FilterIsListening() FileFilter
FilterIsListening returns a filter that matches files that are being listened to.
func FilterReadyToProcess ¶
func FilterReadyToProcess() FileFilter
FilterReadyToProcess returns a filter that matches files that are ready to process.
func FilterTime ¶
func FilterTime(startTime, endTime int64) FileFilter
FilterTime returns a filter that matches files that have intervals overlapping with the given time.
type FileState ¶
type FileState struct { Size int64 `json:"size"` StartTime int64 `json:"start_time,omitempty"` EndTime int64 `json:"end_time,omitempty"` ModifyTime int64 `json:"modify_time,omitempty"` Unsupported bool `json:"unsupported,omitempty"` TooOld bool `json:"too_old,omitempty"` IsCollecting bool `json:"is_collecting,omitempty"` IsDir bool `json:"is_dir,omitempty"` IsListening bool `json:"is_listening,omitempty"` ProcessState processState `json:"process_state,omitempty"` Pathname string `json:"-"` // Pathname is output only for the Files method }
FileState represents the state of a file in the system.
type FileStateHandler ¶
type FileStateHandler interface { // UpdateListenDirs updates the directories being monitored. UpdateListenDirs(conf config.DefaultModConfConfig) error // UpdateCollectDirs updates the directories being collected. UpdateCollectDirs(conf config.DefaultModConfConfig) error // Files returns filename and file state pairs that match the given filters. Files(filters ...FileFilter) []FileState // UpdateFilesProcessState updates the state of files that are ready to process. // This should be called before processing files UpdateFilesProcessState() error // MarkProcessedFile updates the state of files that were ready to process // to mark them as processed. MarkProcessedFile(filename string) error // GetFileHandler returns the handler for a given file path. GetFileHandler(filePath string) file_handlers.Interface }
FileStateHandler is the interface for the file state handler.
func New ¶
func New(fileStatePath string) (FileStateHandler, error)
New returns the singleton instance of fileStateHandler for the given fileStatePath. Each unique fileStatePath will have its own singleton instance.