raft_ext.go 301 B

12345678910111213141516
  1. package raft
  2. // GetLogSize returns the current size of the log file in bytes
  3. func (lm *LogManager) GetLogSize() int64 {
  4. lm.mu.RLock()
  5. defer lm.mu.RUnlock()
  6. if hs, ok := lm.storage.(*HybridStorage); ok {
  7. info, err := hs.logFile.Stat()
  8. if err == nil {
  9. return info.Size()
  10. }
  11. }
  12. return 0
  13. }