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

Method touchLocked

cmd/cache-proxy/cache.go:320–331  ·  view source on GitHub ↗
(key string)

Source from the content-addressed store, hash-verified

318 startupSpace, err := dc.diskSpace()
319 if err != nil {
320 return nil, fmt.Errorf("statfs %s: %w", dir, err)
321 }
322 if err := dc.initializeCapacity(ownedBytes, startupSpace); err != nil {
323 return nil, fmt.Errorf("apply startup cache limits: %w", err)
324 }
325 if option.IncrementalSummary {
326 summaryCapacity := fixedSummaryBloomCapacity()
327 if option.DynamicSummary {
328 diskTarget := deriveDiskCapacity(startupSpace.TotalBytes, startupSpace.FreeBytes, ownedBytes, dc.maxPercent).DiskTargetBytes
329 summaryCapacity = deriveBloomCapacity(diskTarget, dc.blockSize)
330 if !validSummaryBloomCapacity(summaryCapacity) {
331 return nil, errors.New("derive dynamic Bloom capacity: cache disk target and block size must produce a non-zero layout")
332 }
333 }
334 if option.SummaryMemoryLimitBytes > 0 {

Callers 2

GetMethod · 0.95
openFileMethod · 0.95

Calls 1

NowMethod · 0.80

Tested by

no test coverage detected