watch.go 756 B

1234567891011121314151617181920
  1. // Copyright (c) 2015 HPE Software Inc. All rights reserved.
  2. // Copyright (c) 2013 ActiveState Software Inc. All rights reserved.
  3. package watch
  4. import "gopkg.in/tomb.v1"
  5. // FileWatcher monitors file-level events.
  6. type FileWatcher interface {
  7. // BlockUntilExists blocks until the file comes into existence.
  8. BlockUntilExists(*tomb.Tomb) error
  9. // ChangeEvents reports on changes to a file, be it modification,
  10. // deletion, renames or truncations. Returned FileChanges group of
  11. // channels will be closed, thus become unusable, after a deletion
  12. // or truncation event.
  13. // In order to properly report truncations, ChangeEvents requires
  14. // the caller to pass their current offset in the file.
  15. ChangeEvents(*tomb.Tomb, int64) (*FileChanges, error)
  16. }