does not populate the cache entry, returns err if file does not exist
(ctx context.Context)
| 112 | |
| 113 | // does not populate the cache entry, returns err if file does not exist |
| 114 | func (entry *CacheEntry) loadFileForRead(ctx context.Context) (*WaveFile, error) { |
| 115 | if entry.File != nil { |
| 116 | return entry.File, nil |
| 117 | } |
| 118 | file, err := dbGetZoneFile(ctx, entry.ZoneId, entry.Name) |
| 119 | if err != nil { |
| 120 | return nil, fmt.Errorf("error getting file: %w", err) |
| 121 | } |
| 122 | if file == nil { |
| 123 | return nil, fs.ErrNotExist |
| 124 | } |
| 125 | return file, nil |
| 126 | } |
| 127 | |
| 128 | func withLock(s *FileStore, zoneId string, name string, fn func(*CacheEntry) error) error { |
| 129 | entry := s.getEntryAndPin(zoneId, name) |
no test coverage detected