2013-05-29 07:34:36 +08:00
|
|
|
// Copyright (c) 2013 ActiveState Software Inc. All rights reserved.
|
|
|
|
|
|
|
|
package watch
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
2013-05-29 10:33:52 +08:00
|
|
|
"launchpad.net/tomb"
|
2013-05-29 07:34:36 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
// FileWatcher monitors file-level events.
|
|
|
|
type FileWatcher interface {
|
|
|
|
// BlockUntilExists blocks until the missing file comes into
|
|
|
|
// existence. If the file already exists, returns immediately.
|
2013-05-29 10:33:52 +08:00
|
|
|
BlockUntilExists(tomb.Tomb) error
|
2013-05-29 07:34:36 +08:00
|
|
|
|
|
|
|
// ChangeEvents returns a channel of events corresponding to the
|
2013-05-30 04:57:02 +08:00
|
|
|
// times the file is ready to be read. The channel will be closed
|
|
|
|
// if the file gets deleted, renamed or truncated.
|
2013-05-30 05:32:59 +08:00
|
|
|
ChangeEvents(tomb.Tomb, os.FileInfo) *FileChanges
|
2013-05-29 07:34:36 +08:00
|
|
|
}
|
|
|
|
|