-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobserver.go
More file actions
24 lines (20 loc) · 902 Bytes
/
Copy pathobserver.go
File metadata and controls
24 lines (20 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package lockd
import "time"
// Observer receives lifecycle events so an external package can export metrics
// without the engine core importing any metrics library. All methods must be
// safe for concurrent use and should not block; they run on the caller's
// goroutine right after the corresponding operation.
type Observer interface {
// AcquireDone fires after an Acquire returns. granted reports whether a
// lease was handed out; dur is the wall time the call took.
AcquireDone(granted bool, dur time.Duration)
// Released fires after a successful Release.
Released()
// Expired fires when the timing wheel reclaims a lease.
Expired()
}
// nopObserver is used when no Observer is configured.
type nopObserver struct{}
func (nopObserver) AcquireDone(bool, time.Duration) {}
func (nopObserver) Released() {}
func (nopObserver) Expired() {}