github.com/nxadm/tail@v1.4.12-0.20231010141446-ba755e4d73b6/watch/watch.go (about) 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 5 package watch 6 7 import "gopkg.in/tomb.v1" 8 9 // FileWatcher monitors file-level events. 10 type FileWatcher interface { 11 // BlockUntilExists blocks until the file comes into existence. 12 BlockUntilExists(*tomb.Tomb) error 13 14 // ChangeEvents reports on changes to a file, be it modification, 15 // deletion, renames or truncations. Returned FileChanges group of 16 // channels will be closed, thus become unusable, after a deletion 17 // or truncation event. 18 // In order to properly report truncations, ChangeEvents requires 19 // the caller to pass their current offset in the file. 20 ChangeEvents(*tomb.Tomb, int64) (*FileChanges, error) 21 }