MCPcopy Index your code
hub / github.com/rclone/rclone / ChangeNotify

Method ChangeNotify

backend/crypt/crypt.go:894–921  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

892// that has had changes. If the implementation
893// uses polling, it should adhere to the given interval.
894func (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
923var commandHelp = []fs.CommandHelp{
924 {

Callers

nothing calls this directly

Calls 5

ErrorfFunction · 0.92
LogfFunction · 0.92
DecryptDirNameMethod · 0.80
FeaturesMethod · 0.65
DecryptFileNameMethod · 0.45

Tested by

no test coverage detected