func (m *Model) updateLocal(folder string, f protocol.FileInfo) { f.LocalVersion = 0 m.fmut.RLock() m.folderFiles[folder].Update(protocol.LocalDeviceID, []protocol.FileInfo{f}) m.fmut.RUnlock() events.Default.Log(events.LocalIndexUpdated, map[string]interface{}{ "folder": folder, "name": f.Name, "modified": time.Unix(f.Modified, 0), "flags": fmt.Sprintf("0%o", f.Flags), "size": f.Size(), }) }
func ldbInsert(batch dbWriter, folder, device []byte, file protocol.FileInfo) int64 { if debugDB { l.Debugf("insert; folder=%q device=%v %v", folder, protocol.DeviceIDFromBytes(device), file) } if file.LocalVersion == 0 { file.LocalVersion = clock(0) } name := []byte(file.Name) nk := deviceKey(folder, device, name) if debugDB { l.Debugf("batch.Put %p %x", batch, nk) } batch.Put(nk, file.MustMarshalXDR()) return file.LocalVersion }