New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create aix.go #314
Create aix.go #314
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
// Copyright 2019 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// +build aix | ||
|
||
// empty implementation, just to allow build | ||
|
||
package fsnotify | ||
|
||
import ( | ||
"errors" | ||
"os" | ||
"sync" | ||
"time" | ||
) | ||
|
||
const ( | ||
sleepTime time.Duration = 50 * time.Millisecond | ||
) | ||
|
||
var ( | ||
// ErrWatchedFileDeleted ... | ||
ErrWatchedFileDeleted = errors.New("error: watched file or folder deleted") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. exported var ErrWatchedFileDeleted should have comment or be unexported There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this here? |
||
) | ||
|
||
// Watcher watches a set of files, delivering events to a channel. | ||
type Watcher struct { | ||
Events chan Event | ||
Errors chan error | ||
mu *sync.Mutex // Map access | ||
closed chan struct{} // Channel to respond to Close | ||
close chan struct{} | ||
wg *sync.WaitGroup | ||
running bool | ||
names map[string]bool // bool for recursive or not. | ||
files map[string]os.FileInfo // map of files. | ||
ops map[Op]struct{} // Op filtering. | ||
maxEvents int | ||
} | ||
|
||
// NewWatcher establishes a new watcher with the underlying OS and begins waiting for events. | ||
func NewWatcher() (*Watcher, error) { | ||
// Set up the WaitGroup for w.Wait(). | ||
var wg sync.WaitGroup | ||
wg.Add(1) | ||
|
||
w := &Watcher{ | ||
Events: make(chan Event), | ||
Errors: make(chan error), | ||
closed: make(chan struct{}), | ||
close: make(chan struct{}), | ||
mu: new(sync.Mutex), | ||
wg: &wg, | ||
files: make(map[string]os.FileInfo), | ||
names: make(map[string]bool), | ||
} | ||
go w.readEvents() | ||
return w, nil | ||
Comment on lines
+45
to
+59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know that an empty implementation should do this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not just return |
||
} | ||
|
||
// Close removes all watches and closes the events channel. | ||
func (w *Watcher) Close() error { | ||
return errors.New("Not implemented") | ||
} | ||
|
||
// Add starts watching the named file or directory (non-recursively). | ||
func (w *Watcher) Add(name string) error { | ||
return errors.New("Not implemented") | ||
} | ||
|
||
// Remove stops watching the the named file or directory (non-recursively). | ||
func (w *Watcher) Remove(name string) error { | ||
return errors.New("Not implemented") | ||
} | ||
|
||
func (w *Watcher) list(name string) (map[string]os.FileInfo, error) { | ||
return nil, errors.New("Not implemented") | ||
} | ||
|
||
func (w *Watcher) retrieveFileList() map[string]os.FileInfo { | ||
return nil | ||
} | ||
|
||
func (w *Watcher) readEvents() { | ||
return | ||
} | ||
|
||
func (w *Watcher) pollEvents(files map[string]os.FileInfo, evt chan Event, | ||
cancel chan struct{}) { | ||
return | ||
} | ||
|
||
// Remove removes either a single file or a directory recursively from | ||
// the file's list. | ||
func (w *Watcher) removeRecursive(name string) (err error) { | ||
return errors.New("Not implemented") | ||
} | ||
|
||
func (w *Watcher) listRecursive(name string) (map[string]os.FileInfo, error) { | ||
return nil, errors.New("Not implemented") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should add the new style build tags too