code: func (db *instance) updateRemoteFiles(folder, device []byte, fs []protocol.FileInfo, meta *metadataTracker) {
  	t := db.newReadWriteTransaction()
  	defer t.close()
  
  	var dk, gk, keyBuf []byte
  	devID := protocol.DeviceIDFromBytes(device)
  	for _, f := range fs {
  		name := []byte(f.Name)
  		dk = db.keyer.GenerateDeviceFileKey(dk, folder, device, name)
  
  		ef, ok := t.getFileTrunc(dk, true)
  		if ok && unchanged(f, ef) {
  			continue
  		}
  
  		if ok {
  			meta.removeFile(devID, ef)
  		}
  		meta.addFile(devID, f)
  
  		l.Debugf("insert; folder=%q device=%v %v", folder, devID, f)
  		t.Put(dk, mustMarshal(&f))
  
  		gk = db.keyer.GenerateGlobalVersionKey(gk, folder, name)
  		keyBuf, _ = t.updateGlobal(gk, keyBuf, folder, device, f, meta)
  
  		t.checkFlush()
  	}
  }
docs: // updateRemoteFiles adds a list of fileinfos to the database and updates the
  // global versionlist and metadata.