MCPcopy Create free account
hub / github.com/PostHog/duckgres / openFile

Method openFile

cmd/cache-proxy/cache.go:298–318  ·  view source on GitHub ↗

openFile opens a cached entry WITHOUT recording a hit. Used to serve a body that was just fetched on a miss — that path already counted a miss, so counting it as a hit too would double-count.

(key string)

Source from the content-addressed store, hash-verified

296 startupContext = context.Background()
297 }
298 removedTemporaryFiles, err := resetTemporaryDirectory(startupContext, filepath.Join(dir, tmpSubdir))
299 if err != nil {
300 return nil, fmt.Errorf("reset cache temp dir: %w", err)
301 }
302 if removedTemporaryFiles > 0 {
303 cacheTemporaryFilesRemovedTotal.Add(float64(removedTemporaryFiles))
304 }
305
306 // Complete enumeration and the exceptional hard-cap survivor pass before
307 // sampling free space. No soft-target deletion occurs during startup.
308 ownedBytes, err := dc.scanExistingContext(startupContext)
309 if err != nil {
310 return nil, fmt.Errorf("scan existing cache entries: %w", err)
311 }
312 startupSpace, err := dc.diskSpace()
313 if err != nil {
314 return nil, fmt.Errorf("statfs %s: %w", dir, err)
315 }
316 if err := dc.initializeCapacity(ownedBytes, startupSpace); err != nil {
317 return nil, fmt.Errorf("apply startup cache limits: %w", err)
318 }
319 if option.IncrementalSummary {
320 summaryCapacity := fixedSummaryBloomCapacity()
321 if option.DynamicSummary {

Callers 3

OpenMethod · 0.95
HandleProxyMethod · 0.80

Calls 4

touchLockedMethod · 0.95
IsValidCacheKeyFunction · 0.85
CloseMethod · 0.65
OpenMethod · 0.45

Tested by 1