Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Recursive = func(options *options) { options.recursive = true }
Recursive will make chikador scan through the directory and its subdirectories to add to the file watcher.
var WithDedupe = func(options *options) {
options.kind = withDedupe
}
WithDedupe enables deduping of events. As operating systems tends to duplicate events around and give you "unnecessary noise", for most cases, it is recommended to enable this unless you need those "unnecessary noise".
var WithoutDedupe = func(options *options) {
options.kind = withoutDedupe
}
WithoutDedupe explicitly states that the Chismis instance shouldn't dedupe events, this is the default behavior, and this is only added for completeness and when you want to explicitly indicate the behavior.
Functions ¶
This section is empty.
Types ¶
type Chismis ¶
type Chismis struct {
// contains filtered or unexported fields
}
func Watch ¶
Watch creates a new Chismis instance that is watching over the given path, and its subdirectories if Recursive is enabled. You can add the following options to give more power to the file watching capabilities:
* Recursive: adds all the subdirectories under the directory and the subdirectories' subdirectories' subdirectories' sub.... you get it.
* WithDedupe: (recommended) dedupes events which operating systems tend to have, this uses the implementation from fsnotify's own repository.
func (*Chismis) IsClosed ¶
IsClosed checks whether this Chismis channel is already closed, important if you want to stop program immediately when closed.
func (*Chismis) Listen ¶
Listen listens to events from the event queue, this is running in another goroutine and uses the same polling method internally.
Do note that you shouldn't listen to a Chismis instance twice, only one listener ever, not even Poll, as this will result in the resource being contended.
func (*Chismis) Poll ¶
Poll tries to poll data from the event queue, if there is none then it will return a nil pointer. Recommended to use in a forever for-loop to continuously poll data. Alternatively, you can use Listen which is the same as a for-loop, but asynchronous and shorter.
Do note that you shouldn't have this twice, nor should you also use Listen if you are already polling data with this method as the two methods will battle it out over who has the resource.