util/ringbuffer: rename to ringlog
I need a ringbuffer in the more traditional sense, one that has a notion of item removal as well as tail loss on overrun. This implementation is really a clearable log window, and is used as such where it is used. Updates #cleanup Updates tailscale/corp#31762 Signed-off-by: James Tucker <james@tailscale.com>
This commit is contained in:
committed by
James Tucker
parent
4b9a1a0087
commit
d42f0b6a21
@@ -33,7 +33,7 @@ import (
|
||||
"tailscale.com/types/key"
|
||||
"tailscale.com/types/logger"
|
||||
"tailscale.com/util/mak"
|
||||
"tailscale.com/util/ringbuffer"
|
||||
"tailscale.com/util/ringlog"
|
||||
"tailscale.com/util/slicesx"
|
||||
)
|
||||
|
||||
@@ -60,7 +60,7 @@ type endpoint struct {
|
||||
lastRecvWG mono.Time // last time there were incoming packets from this peer destined for wireguard-go (e.g. not disco)
|
||||
lastRecvUDPAny mono.Time // last time there were incoming UDP packets from this peer of any kind
|
||||
numStopAndResetAtomic int64
|
||||
debugUpdates *ringbuffer.RingBuffer[EndpointChange]
|
||||
debugUpdates *ringlog.RingLog[EndpointChange]
|
||||
|
||||
// These fields are initialized once and never modified.
|
||||
c *Conn
|
||||
|
||||
@@ -62,7 +62,7 @@ import (
|
||||
"tailscale.com/util/clientmetric"
|
||||
"tailscale.com/util/eventbus"
|
||||
"tailscale.com/util/mak"
|
||||
"tailscale.com/util/ringbuffer"
|
||||
"tailscale.com/util/ringlog"
|
||||
"tailscale.com/util/set"
|
||||
"tailscale.com/util/testenv"
|
||||
"tailscale.com/util/usermetric"
|
||||
@@ -3112,7 +3112,7 @@ func (c *Conn) updateNodes(update NodeViewsUpdate) (peersChanged bool) {
|
||||
// ~1MB on mobile but we never used the data so the memory was just
|
||||
// wasted.
|
||||
default:
|
||||
ep.debugUpdates = ringbuffer.New[EndpointChange](entriesPerBuffer)
|
||||
ep.debugUpdates = ringlog.New[EndpointChange](entriesPerBuffer)
|
||||
}
|
||||
if n.Addresses().Len() > 0 {
|
||||
ep.nodeAddr = n.Addresses().At(0).Addr()
|
||||
|
||||
Reference in New Issue
Block a user