Documentation ¶
Index ¶
- func Glob(pattern string, doubleStarPatternDepth uint8) ([]string, error)
- func GlobPatterns(pattern string, doubleStarPatternDepth uint8) ([]string, error)
- func IsSameFile(path string, info os.FileInfo) bool
- type File
- type State
- type States
- func (s *States) Cleanup() (int, int)
- func (s *States) Copy() *States
- func (s *States) Count() int
- func (s *States) FindPrevious(newState State) State
- func (s *States) GetStates() []State
- func (s *States) SetStates(states []State)
- func (s *States) Update(newState State)
- func (s *States) UpdateWithTs(newState State, ts time.Time)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Glob ¶
Glob expands '**' patterns into multiple patterns to satisfy https://golang.org/pkg/path/filepath/#Match
func GlobPatterns ¶
GlobPatterns detects the use of "**" and expands it to standard glob patterns up to a max depth
Types ¶
type File ¶
func (*File) IsSameFile ¶
Checks if the two files are the same.
type State ¶
type State struct { Id string `json:"-"` // local unique id to make comparison more efficient Finished bool `json:"-"` // harvester state Fileinfo os.FileInfo `json:"-"` // the file info Source string `json:"source"` Offset int64 `json:"offset"` Timestamp time.Time `json:"timestamp"` TTL time.Duration `json:"ttl"` Type string `json:"type"` FileStateOS file.StateOS }
State is used to communicate the reading state of a file
type States ¶
States handles list of FileState. One must use NewStates to instantiate a file states regisry. Using the zero-value is not safe.
func (*States) Cleanup ¶
Cleanup cleans up the state array. All states which are older then `older` are removed The number of states that were cleaned up and number of states that can be cleaned up in the future is returned.
func (*States) FindPrevious ¶
FindPrevious lookups a registered state, that matching the new state. Returns a zero-state if no match is found.