MCPcopy
hub / github.com/syncthing/syncthing / SetIndexID

Method SetIndexID

internal/db/sqlite/folderdb_indexid.go:67–82  ·  view source on GitHub ↗
(device protocol.DeviceID, id protocol.IndexID)

Source from the content-addressed store, hash-verified

65}
66
67func (s *folderDB) SetIndexID(device protocol.DeviceID, id protocol.IndexID) error {
68 s.updateLock.Lock()
69 defer s.updateLock.Unlock()
70
71 deviceIdx, err := s.deviceIdxLocked(device)
72 if err != nil {
73 return wrap(err, "device idx")
74 }
75
76 if _, err := s.stmt(`
77 INSERT OR REPLACE INTO indexids (device_idx, index_id, sequence) values (?, ?, 0)
78 `).Exec(deviceIdx, indexIDToHex(id)); err != nil {
79 return wrap(err, "insert")
80 }
81 return nil
82}
83
84func (s *folderDB) DropAllIndexIDs() error {
85 s.updateLock.Lock()

Callers

nothing calls this directly

Calls 6

deviceIdxLockedMethod · 0.95
indexIDToHexFunction · 0.85
UnlockMethod · 0.80
stmtMethod · 0.80
wrapFunction · 0.70
ExecMethod · 0.65

Tested by

no test coverage detected