MCPcopy
hub / github.com/wavetermdev/waveterm / withLock

Function withLock

pkg/filestore/blockstore_cache.go:128–134  ·  view source on GitHub ↗
(s *FileStore, zoneId string, name string, fn func(*CacheEntry) error)

Source from the content-addressed store, hash-verified

126}
127
128func withLock(s *FileStore, zoneId string, name string, fn func(*CacheEntry) error) error {
129 entry := s.getEntryAndPin(zoneId, name)
130 defer s.unpinEntryAndTryDelete(zoneId, name)
131 entry.Lock.Lock()
132 defer entry.Lock.Unlock()
133 return fn(entry)
134}
135
136func withLockRtn[T any](s *FileStore, zoneId string, name string, fn func(*CacheEntry) (T, error)) (T, error) {
137 var rtnVal T

Callers 14

withLockRtnFunction · 0.85
MakeFileMethod · 0.85
DeleteFileMethod · 0.85
ListFilesMethod · 0.85
WriteMetaMethod · 0.85
WriteFileMethod · 0.85
WriteAtMethod · 0.85
AppendDataMethod · 0.85
CompactIJsonMethod · 0.85
AppendIJsonMethod · 0.85
ReadAtMethod · 0.85
ReadFileMethod · 0.85

Calls 2

getEntryAndPinMethod · 0.80

Tested by 1

TestCircularWritesFunction · 0.68