code: func (p *deviceFolderDownloadState) Update(updates []protocol.FileDownloadProgressUpdate) {
  	p.mut.Lock()
  	defer p.mut.Unlock()
  
  	for _, update := range updates {
  		local, ok := p.files[update.Name]
  		if update.UpdateType == protocol.UpdateTypeForget && ok && local.version.Equal(update.Version) {
  			delete(p.files, update.Name)
  		} else if update.UpdateType == protocol.UpdateTypeAppend {
  			if !ok {
  				local = deviceFolderFileDownloadState{
  					blockIndexes: update.BlockIndexes,
  					version:      update.Version,
  				}
  			} else if !local.version.Equal(update.Version) {
  				local.blockIndexes = append(local.blockIndexes[:0], update.BlockIndexes...)
  				local.version = update.Version
  			} else {
  				local.blockIndexes = append(local.blockIndexes, update.BlockIndexes...)
  			}
  			p.files[update.Name] = local
  		}
  	}
  }
docs: // Update updates internal state of what has been downloaded into the temporary
  // files by the remote device for this specific folder.