You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
829 B

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