ChangeNotify calls the passed function with a path that has had changes. If the implementation uses polling, it should adhere to the given interval.
(ctx context.Context, notifyFunc func(string, fs.EntryType), pollIntervalChan <-chan time.Duration)
| 892 | // that has had changes. If the implementation |
| 893 | // uses polling, it should adhere to the given interval. |
| 894 | func (f *Fs) ChangeNotify(ctx context.Context, notifyFunc func(string, fs.EntryType), pollIntervalChan <-chan time.Duration) { |
| 895 | do := f.Fs.Features().ChangeNotify |
| 896 | if do == nil { |
| 897 | return |
| 898 | } |
| 899 | wrappedNotifyFunc := func(path string, entryType fs.EntryType) { |
| 900 | // fs.Debugf(f, "ChangeNotify: path %q entryType %d", path, entryType) |
| 901 | var ( |
| 902 | err error |
| 903 | decrypted string |
| 904 | ) |
| 905 | switch entryType { |
| 906 | case fs.EntryDirectory: |
| 907 | decrypted, err = f.cipher.DecryptDirName(path) |
| 908 | case fs.EntryObject: |
| 909 | decrypted, err = f.cipher.DecryptFileName(path) |
| 910 | default: |
| 911 | fs.Errorf(path, "crypt ChangeNotify: ignoring unknown EntryType %d", entryType) |
| 912 | return |
| 913 | } |
| 914 | if err != nil { |
| 915 | fs.Logf(f, "ChangeNotify was unable to decrypt %q: %s", path, err) |
| 916 | return |
| 917 | } |
| 918 | notifyFunc(decrypted, entryType) |
| 919 | } |
| 920 | do(ctx, wrappedNotifyFunc, pollIntervalChan) |
| 921 | } |
| 922 | |
| 923 | var commandHelp = []fs.CommandHelp{ |
| 924 | { |
nothing calls this directly
no test coverage detected