Message:
Hello da...@cheney.net (cc: golan...@googlegroups.com),
I'd like you to review this change to
https://go.googlecode.com/hg/
Description:
os/kevent: implements a wrapper for the BSD kevent/kqueue system.
This is meant to be a file watcher package for BSD systems.
See os/inotify for a similar package on Linux systems.
Please review this at http://codereview.appspot.com/5248062/
Affected files:
M src/pkg/Makefile
A src/pkg/os/kevent/Makefile
A src/pkg/os/kevent/kevent_bsd.go
A src/pkg/os/kevent/kevent_bsd_test.go
Thanks.
Russ
That sounds like a good idea to me. I was actually thinking about a
unified file monitoring package for all supported OSs, but I don't have
a windows or linux box to test those platforms. It looks like you have a
windows box based on your changelist, and I can get a Linux box up and
running pretty quick if you don't have one, as we'll need to modify its
interface a bit to make a common API.
Are you thinking of starting another thread to talk about the interface?
Here are my thoughts that you can use/disregard if you start one:
Create a FileEvent type similar to FileInfo returned from Stat() that
has common functions between OSs (Path(), IsDelete(), IsWrite(), ...)
As we cannot push an interface over a channel I was thinking we may need
to make a blocking NextFileEvent() (FileEvent, Error) function with
simple code (not valid, off the top my of head):
func Nextfileevent(watch w) ( fileevent, error) {
select {
case err := <-w.Error:
case event := <-w.Event:
}
return event, err
}
The channels would then become private.
I'm also thinking of removing an external facing AddWatch(name, flags)
as the flags are OS dependent, just have AddWatch(name) as an external
function that adds all flags. The user of package can use the interface
functions of FileEvent to disregard the events they don't care about.
Also, removing the flag consts from being public would be something to
discuss.
I'd also like to change the package name from inotify to something more
OS-agnostic, perhaps filemon or filewatch? I'm not attached to any name
in particular, I'm okay with whatever others feel is appropriate.
er, why not?
> er, why not?
in my head I was thinking of something like this...
http://groups.google.com/group/golang-nuts/browse_thread/thread/71bba09a30918319/3a15c4e509f3d2ef?#3a15c4e509f3d2ef