a06f331eb8
CI / benchmark (push) Has been skipped
install-script / posix-syntax (push) Successful in 6m1s
CI / build-onnx (push) Failing after 6m43s
init-smoke / dry-run (push) Failing after 15m57s
security / govulncheck (push) Has been cancelled
security / trivy-fs (push) Has been cancelled
CI / test (1.26, ubuntu-latest) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
CI / test (1.26, macos-latest) (push) Has been cancelled
CI / build-windows (push) Has been cancelled
CI / lint (push) Has been cancelled
install-script / powershell-syntax (push) Has been cancelled
install-script / install (macos-14) (push) Has been cancelled
install-script / install (ubuntu-latest) (push) Has been cancelled
22 lines
623 B
Go
22 lines
623 B
Go
package store_sqlite
|
|
|
|
import "os"
|
|
|
|
// DBStats returns the on-disk size of the SQLite database file and its
|
|
// write-ahead log, in bytes. A missing file (or a store opened without a
|
|
// path) reports 0 for that component. Surfaced in daemon_health so a
|
|
// runaway WAL high-water mark is observable instead of silently filling
|
|
// the disk.
|
|
func (s *Store) DBStats() (dbBytes, walBytes int64) {
|
|
if s == nil || s.dbPath == "" {
|
|
return 0, 0
|
|
}
|
|
if fi, err := os.Stat(s.dbPath); err == nil {
|
|
dbBytes = fi.Size()
|
|
}
|
|
if fi, err := os.Stat(s.dbPath + "-wal"); err == nil {
|
|
walBytes = fi.Size()
|
|
}
|
|
return dbBytes, walBytes
|
|
}
|