Files
Privatae e4c9b69b46
ci / personal-data (push) Successful in 5s
ci / test (push) Successful in 3m4s
ci / fuzz (push) Successful in 3m45s
bastion 0.53.2
2026-10-20 04:42:14 +00:00

29 lines
902 B
Go

//go:build windows
package main
// The WEAK cache key on Windows, and it is named weak because it is.
//
// Go hands back a syscall.Win32FileAttributeData from FileInfo.Sys(): creation,
// last-access and last-write times, plus the size. There is no file identity
// (no volume serial + file index without opening a handle) and no change time,
// so a file overwritten in place with its size, write time and creation time
// restored keys identically to the original. deltaCacheWeakTTL is what covers
// that, and `false` here is what turns it on.
import (
"os"
"strconv"
"syscall"
)
func statIdentity(fi os.FileInfo) (string, bool) {
d, ok := fi.Sys().(*syscall.Win32FileAttributeData)
if !ok {
return "", false
}
return strconv.FormatInt(fi.Size(), 10) + ":" +
strconv.FormatInt(d.LastWriteTime.Nanoseconds(), 10) + ":" +
strconv.FormatInt(d.CreationTime.Nanoseconds(), 10), false
}