Upgrading server package dependencies (#12559)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
c19bddb51b
Коммит
2f77622b89
2
vendor/github.com/hashicorp/golang-lru/go.mod
сгенерированный
поставляемый
2
vendor/github.com/hashicorp/golang-lru/go.mod
сгенерированный
поставляемый
@@ -1 +1,3 @@
|
||||
module github.com/hashicorp/golang-lru
|
||||
|
||||
go 1.12
|
||||
|
||||
26
vendor/github.com/hashicorp/golang-lru/lru.go
сгенерированный
поставляемый
26
vendor/github.com/hashicorp/golang-lru/lru.go
сгенерированный
поставляемый
@@ -86,17 +86,35 @@ func (c *Cache) ContainsOrAdd(key, value interface{}) (ok, evicted bool) {
|
||||
}
|
||||
|
||||
// Remove removes the provided key from the cache.
|
||||
func (c *Cache) Remove(key interface{}) {
|
||||
func (c *Cache) Remove(key interface{}) (present bool) {
|
||||
c.lock.Lock()
|
||||
c.lru.Remove(key)
|
||||
present = c.lru.Remove(key)
|
||||
c.lock.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
// Resize changes the cache size.
|
||||
func (c *Cache) Resize(size int) (evicted int) {
|
||||
c.lock.Lock()
|
||||
evicted = c.lru.Resize(size)
|
||||
c.lock.Unlock()
|
||||
return evicted
|
||||
}
|
||||
|
||||
// RemoveOldest removes the oldest item from the cache.
|
||||
func (c *Cache) RemoveOldest() {
|
||||
func (c *Cache) RemoveOldest() (key interface{}, value interface{}, ok bool) {
|
||||
c.lock.Lock()
|
||||
c.lru.RemoveOldest()
|
||||
key, value, ok = c.lru.RemoveOldest()
|
||||
c.lock.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
// GetOldest returns the oldest entry
|
||||
func (c *Cache) GetOldest() (key interface{}, value interface{}, ok bool) {
|
||||
c.lock.Lock()
|
||||
key, value, ok = c.lru.GetOldest()
|
||||
c.lock.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
// Keys returns a slice of the keys in the cache, from oldest to newest.
|
||||
|
||||
16
vendor/github.com/hashicorp/golang-lru/simplelru/lru.go
сгенерированный
поставляемый
16
vendor/github.com/hashicorp/golang-lru/simplelru/lru.go
сгенерированный
поставляемый
@@ -73,6 +73,9 @@ func (c *LRU) Add(key, value interface{}) (evicted bool) {
|
||||
func (c *LRU) Get(key interface{}) (value interface{}, ok bool) {
|
||||
if ent, ok := c.items[key]; ok {
|
||||
c.evictList.MoveToFront(ent)
|
||||
if ent.Value.(*entry) == nil {
|
||||
return nil, false
|
||||
}
|
||||
return ent.Value.(*entry).value, true
|
||||
}
|
||||
return
|
||||
@@ -142,6 +145,19 @@ func (c *LRU) Len() int {
|
||||
return c.evictList.Len()
|
||||
}
|
||||
|
||||
// Resize changes the cache size.
|
||||
func (c *LRU) Resize(size int) (evicted int) {
|
||||
diff := c.Len() - size
|
||||
if diff < 0 {
|
||||
diff = 0
|
||||
}
|
||||
for i := 0; i < diff; i++ {
|
||||
c.removeOldest()
|
||||
}
|
||||
c.size = size
|
||||
return diff
|
||||
}
|
||||
|
||||
// removeOldest removes the oldest item from the cache.
|
||||
func (c *LRU) removeOldest() {
|
||||
ent := c.evictList.Back()
|
||||
|
||||
7
vendor/github.com/hashicorp/golang-lru/simplelru/lru_interface.go
сгенерированный
поставляемый
7
vendor/github.com/hashicorp/golang-lru/simplelru/lru_interface.go
сгенерированный
поставляемый
@@ -10,7 +10,7 @@ type LRUCache interface {
|
||||
// updates the "recently used"-ness of the key. #value, isFound
|
||||
Get(key interface{}) (value interface{}, ok bool)
|
||||
|
||||
// Check if a key exsists in cache without updating the recent-ness.
|
||||
// Checks if a key exists in cache without updating the recent-ness.
|
||||
Contains(key interface{}) (ok bool)
|
||||
|
||||
// Returns key's value without updating the "recently used"-ness of the key.
|
||||
@@ -31,6 +31,9 @@ type LRUCache interface {
|
||||
// Returns the number of items in the cache.
|
||||
Len() int
|
||||
|
||||
// Clear all cache entries
|
||||
// Clears all cache entries.
|
||||
Purge()
|
||||
|
||||
// Resizes cache, returning number evicted
|
||||
Resize(int) int
|
||||
}
|
||||
|
||||
2
vendor/github.com/hashicorp/memberlist/net.go
сгенерированный
поставляемый
2
vendor/github.com/hashicorp/memberlist/net.go
сгенерированный
поставляемый
@@ -522,7 +522,7 @@ func (m *Memberlist) handleIndirectPing(buf []byte, from net.Addr) {
|
||||
// Send the ping.
|
||||
addr := joinHostPort(net.IP(ind.Target).String(), ind.Port)
|
||||
if err := m.encodeAndSendMsg(addr, pingMsg, &ping); err != nil {
|
||||
m.logger.Printf("[ERR] memberlist: Failed to send ping: %s %s", err, LogAddress(from))
|
||||
m.logger.Printf("[ERR] memberlist: Failed to send indirect ping: %s %s", err, LogAddress(from))
|
||||
}
|
||||
|
||||
// Setup a timer to fire off a nack if no ack is seen in time.
|
||||
|
||||
42
vendor/github.com/hashicorp/memberlist/state.go
сгенерированный
поставляемый
42
vendor/github.com/hashicorp/memberlist/state.go
сгенерированный
поставляемый
@@ -6,6 +6,7 @@ import (
|
||||
"math"
|
||||
"math/rand"
|
||||
"net"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
@@ -242,6 +243,21 @@ func (m *Memberlist) probeNodeByAddr(addr string) {
|
||||
m.probeNode(n)
|
||||
}
|
||||
|
||||
// failedRemote checks the error and decides if it indicates a failure on the
|
||||
// other end.
|
||||
func failedRemote(err error) bool {
|
||||
switch t := err.(type) {
|
||||
case *net.OpError:
|
||||
if strings.HasPrefix(t.Net, "tcp") {
|
||||
switch t.Op {
|
||||
case "dial", "read", "write":
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// probeNode handles a single round of failure checking on a node.
|
||||
func (m *Memberlist) probeNode(node *nodeState) {
|
||||
defer metrics.MeasureSince([]string{"memberlist", "probeNode"}, time.Now())
|
||||
@@ -272,10 +288,20 @@ func (m *Memberlist) probeNode(node *nodeState) {
|
||||
// soon as possible.
|
||||
deadline := sent.Add(probeInterval)
|
||||
addr := node.Address()
|
||||
|
||||
// Arrange for our self-awareness to get updated.
|
||||
var awarenessDelta int
|
||||
defer func() {
|
||||
m.awareness.ApplyDelta(awarenessDelta)
|
||||
}()
|
||||
if node.State == stateAlive {
|
||||
if err := m.encodeAndSendMsg(addr, pingMsg, &ping); err != nil {
|
||||
m.logger.Printf("[ERR] memberlist: Failed to send ping: %s", err)
|
||||
return
|
||||
if failedRemote(err) {
|
||||
goto HANDLE_REMOTE_FAILURE
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var msgs [][]byte
|
||||
@@ -296,7 +322,11 @@ func (m *Memberlist) probeNode(node *nodeState) {
|
||||
compound := makeCompoundMessage(msgs)
|
||||
if err := m.rawSendMsgPacket(addr, &node.Node, compound.Bytes()); err != nil {
|
||||
m.logger.Printf("[ERR] memberlist: Failed to send compound ping and suspect message to %s: %s", addr, err)
|
||||
return
|
||||
if failedRemote(err) {
|
||||
goto HANDLE_REMOTE_FAILURE
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,10 +335,7 @@ func (m *Memberlist) probeNode(node *nodeState) {
|
||||
// which will improve our health until we get to the failure scenarios
|
||||
// at the end of this function, which will alter this delta variable
|
||||
// accordingly.
|
||||
awarenessDelta := -1
|
||||
defer func() {
|
||||
m.awareness.ApplyDelta(awarenessDelta)
|
||||
}()
|
||||
awarenessDelta = -1
|
||||
|
||||
// Wait for response or round-trip-time.
|
||||
select {
|
||||
@@ -333,9 +360,10 @@ func (m *Memberlist) probeNode(node *nodeState) {
|
||||
// probe interval it will give the TCP fallback more time, which
|
||||
// is more active in dealing with lost packets, and it gives more
|
||||
// time to wait for indirect acks/nacks.
|
||||
m.logger.Printf("[DEBUG] memberlist: Failed ping: %v (timeout reached)", node.Name)
|
||||
m.logger.Printf("[DEBUG] memberlist: Failed ping: %s (timeout reached)", node.Name)
|
||||
}
|
||||
|
||||
HANDLE_REMOTE_FAILURE:
|
||||
// Get some random live nodes.
|
||||
m.nodeLock.RLock()
|
||||
kNodes := kRandomNodes(m.config.IndirectChecks, m.nodes, func(n *nodeState) bool {
|
||||
|
||||
2
vendor/github.com/hashicorp/yamux/addr.go
сгенерированный
поставляемый
2
vendor/github.com/hashicorp/yamux/addr.go
сгенерированный
поставляемый
@@ -54,7 +54,7 @@ func (s *Stream) LocalAddr() net.Addr {
|
||||
return s.session.LocalAddr()
|
||||
}
|
||||
|
||||
// LocalAddr returns the remote address
|
||||
// RemoteAddr returns the remote address
|
||||
func (s *Stream) RemoteAddr() net.Addr {
|
||||
return s.session.RemoteAddr()
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user