Files
realy/ratel/eventcount.go
mleku bbebbe2b02 Add tracing with lol.Tracer in multiple functions.
Introduced `lol.Tracer` for function entry/exit logging across various packages. This improves traceability and debugging of function executions while preserving existing behavior. Removed unused files `doc.go` and `nothing.go` to clean up the repository.
2025-06-29 07:32:24 +01:00

23 lines
475 B
Go

package ratel
import (
"github.com/dgraph-io/badger/v4"
"realy.lol/lol"
"realy.lol/ratel/prefixes"
)
func (r *T) EventCount() (count uint64, err error) {
lol.Tracer("EventCount")
defer func() { lol.Tracer("end EventCount", count, err) }()
err = r.View(func(txn *badger.Txn) (err error) {
it := txn.NewIterator(badger.IteratorOptions{Prefix: prefixes.Event.Key()})
defer it.Close()
for it.Rewind(); it.Valid(); it.Next() {
count++
}
return
})
return
}