code: func (fc *fileCache) scan(keyDir string) (mapset.Set, mapset.Set, mapset.Set, error) {
  	t0 := time.Now()
  
  	// List all the failes from the keystore folder
  	files, err := ioutil.ReadDir(keyDir)
  	if err != nil {
  		return nil, nil, nil, err
  	}
  	t1 := time.Now()
  
  	fc.mu.Lock()
  	defer fc.mu.Unlock()
  
  	// Iterate all the files and gather their metadata
  	all := mapset.NewThreadUnsafeSet()
  	mods := mapset.NewThreadUnsafeSet()
  
  	var newLastMod time.Time
  	for _, fi := range files {
  		path := filepath.Join(keyDir, fi.Name())
  		// Skip any non-key files from the folder
  		if nonKeyFile(fi) {
  			log.Trace("Ignoring file on account scan", "path", path)
  			continue
  		}
  		// Gather the set of all and fresly modified files
  		all.Add(path)
  
  		modified := fi.ModTime()
  		if modified.After(fc.lastMod) {
  			mods.Add(path)
  		}
  		if modified.After(newLastMod) {
  			newLastMod = modified
  		}
  	}
  	t2 := time.Now()
  
  	// Update the tracked files and return the three sets
  	deletes := fc.all.Difference(all)   // Deletes = previous - current
  	creates := all.Difference(fc.all)   // Creates = current - previous
  	updates := mods.Difference(creates) // Updates = modified - creates
  
  	fc.all, fc.lastMod = all, newLastMod
  	t3 := time.Now()
  
  	// Report on the scanning stats and return
  	log.Debug("FS scan times", "list", t1.Sub(t0), "set", t2.Sub(t1), "diff", t3.Sub(t2))
  	return creates, deletes, updates, nil
  }
docs: // scan performs a new scan on the given directory, compares against the already
  // cached filenames, and returns file sets: creates, deletes, updates.