github.com/unionj-cloud/go-doudou/v2@v2.3.5/toolkit/memberlist/ping_delegate.go (about)

     1  package memberlist
     2  
     3  import "time"
     4  
     5  // PingDelegate is used to notify an observer how long it took for a ping message to
     6  // complete a round trip.  It can also be used for writing arbitrary byte slices
     7  // into ack messages. Note that in order to be meaningful for RTT estimates, this
     8  // delegate does not apply to indirect pings, nor fallback pings sent over TCP.
     9  type PingDelegate interface {
    10  	// AckPayload is invoked when an ack is being sent; the returned bytes will be appended to the ack
    11  	AckPayload() []byte
    12  	// NotifyPing is invoked when an ack for a ping is received
    13  	NotifyPingComplete(other *Node, rtt time.Duration, payload []byte)
    14  }