Updating dependencies. (#11680)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f226f672f3
Коммит
20825a1702
38
vendor/github.com/hashicorp/go-hclog/context.go
сгенерированный
поставляемый
Обычный файл
38
vendor/github.com/hashicorp/go-hclog/context.go
сгенерированный
поставляемый
Обычный файл
@@ -0,0 +1,38 @@
|
||||
package hclog
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
// WithContext inserts a logger into the context and is retrievable
|
||||
// with FromContext. The optional args can be set with the same syntax as
|
||||
// Logger.With to set fields on the inserted logger. This will not modify
|
||||
// the logger argument in-place.
|
||||
func WithContext(ctx context.Context, logger Logger, args ...interface{}) context.Context {
|
||||
// While we could call logger.With even with zero args, we have this
|
||||
// check to avoid unnecessary allocations around creating a copy of a
|
||||
// logger.
|
||||
if len(args) > 0 {
|
||||
logger = logger.With(args...)
|
||||
}
|
||||
|
||||
return context.WithValue(ctx, contextKey, logger)
|
||||
}
|
||||
|
||||
// FromContext returns a logger from the context. This will return L()
|
||||
// (the default logger) if no logger is found in the context. Therefore,
|
||||
// this will never return a nil value.
|
||||
func FromContext(ctx context.Context) Logger {
|
||||
logger, _ := ctx.Value(contextKey).(Logger)
|
||||
if logger == nil {
|
||||
return L()
|
||||
}
|
||||
|
||||
return logger
|
||||
}
|
||||
|
||||
// Unexported new type so that our context key never collides with another.
|
||||
type contextKeyType struct{}
|
||||
|
||||
// contextKey is the key used for the context to store the logger.
|
||||
var contextKey = contextKeyType{}
|
||||
16
vendor/github.com/hashicorp/go-hclog/global.go
сгенерированный
поставляемый
16
vendor/github.com/hashicorp/go-hclog/global.go
сгенерированный
поставляемый
@@ -22,7 +22,11 @@ var (
|
||||
// to be used in more specific contexts.
|
||||
func Default() Logger {
|
||||
protect.Do(func() {
|
||||
def = New(DefaultOptions)
|
||||
// If SetDefault was used before Default() was called, we need to
|
||||
// detect that here.
|
||||
if def == nil {
|
||||
def = New(DefaultOptions)
|
||||
}
|
||||
})
|
||||
|
||||
return def
|
||||
@@ -32,3 +36,13 @@ func Default() Logger {
|
||||
func L() Logger {
|
||||
return Default()
|
||||
}
|
||||
|
||||
// SetDefault changes the logger to be returned by Default()and L()
|
||||
// to the one given. This allows packages to use the default logger
|
||||
// and have higher level packages change it to match the execution
|
||||
// environment. It returns any old default if there is one.
|
||||
func SetDefault(log Logger) Logger {
|
||||
old := def
|
||||
def = log
|
||||
return old
|
||||
}
|
||||
|
||||
86
vendor/github.com/hashicorp/go-hclog/intlogger.go
сгенерированный
поставляемый
86
vendor/github.com/hashicorp/go-hclog/intlogger.go
сгенерированный
поставляемый
@@ -21,6 +21,9 @@ import (
|
||||
// contains millisecond precision
|
||||
const TimeFormat = "2006-01-02T15:04:05.000Z0700"
|
||||
|
||||
// errJsonUnsupportedTypeMsg is included in log json entries, if an arg cannot be serialized to json
|
||||
const errJsonUnsupportedTypeMsg = "logging contained values that don't serialize to json"
|
||||
|
||||
var (
|
||||
_levelToBracket = map[Level]string{
|
||||
Debug: "[DEBUG]",
|
||||
@@ -296,39 +299,7 @@ func (l *intLogger) renderSlice(v reflect.Value) string {
|
||||
|
||||
// JSON logging function
|
||||
func (l *intLogger) logJSON(t time.Time, level Level, msg string, args ...interface{}) {
|
||||
vals := map[string]interface{}{
|
||||
"@message": msg,
|
||||
"@timestamp": t.Format("2006-01-02T15:04:05.000000Z07:00"),
|
||||
}
|
||||
|
||||
var levelStr string
|
||||
switch level {
|
||||
case Error:
|
||||
levelStr = "error"
|
||||
case Warn:
|
||||
levelStr = "warn"
|
||||
case Info:
|
||||
levelStr = "info"
|
||||
case Debug:
|
||||
levelStr = "debug"
|
||||
case Trace:
|
||||
levelStr = "trace"
|
||||
default:
|
||||
levelStr = "all"
|
||||
}
|
||||
|
||||
vals["@level"] = levelStr
|
||||
|
||||
if l.name != "" {
|
||||
vals["@module"] = l.name
|
||||
}
|
||||
|
||||
if l.caller {
|
||||
if _, file, line, ok := runtime.Caller(3); ok {
|
||||
vals["@caller"] = fmt.Sprintf("%s:%d", file, line)
|
||||
}
|
||||
}
|
||||
|
||||
vals := l.jsonMapEntry(t, level, msg)
|
||||
args = append(l.implied, args...)
|
||||
|
||||
if args != nil && len(args) > 0 {
|
||||
@@ -369,10 +340,51 @@ func (l *intLogger) logJSON(t time.Time, level Level, msg string, args ...interf
|
||||
|
||||
err := json.NewEncoder(l.writer).Encode(vals)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
if _, ok := err.(*json.UnsupportedTypeError); ok {
|
||||
plainVal := l.jsonMapEntry(t, level, msg)
|
||||
plainVal["@warn"] = errJsonUnsupportedTypeMsg
|
||||
|
||||
json.NewEncoder(l.writer).Encode(plainVal)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (l intLogger) jsonMapEntry(t time.Time, level Level, msg string) map[string]interface{} {
|
||||
vals := map[string]interface{}{
|
||||
"@message": msg,
|
||||
"@timestamp": t.Format("2006-01-02T15:04:05.000000Z07:00"),
|
||||
}
|
||||
|
||||
var levelStr string
|
||||
switch level {
|
||||
case Error:
|
||||
levelStr = "error"
|
||||
case Warn:
|
||||
levelStr = "warn"
|
||||
case Info:
|
||||
levelStr = "info"
|
||||
case Debug:
|
||||
levelStr = "debug"
|
||||
case Trace:
|
||||
levelStr = "trace"
|
||||
default:
|
||||
levelStr = "all"
|
||||
}
|
||||
|
||||
vals["@level"] = levelStr
|
||||
|
||||
if l.name != "" {
|
||||
vals["@module"] = l.name
|
||||
}
|
||||
|
||||
if l.caller {
|
||||
if _, file, line, ok := runtime.Caller(4); ok {
|
||||
vals["@caller"] = fmt.Sprintf("%s:%d", file, line)
|
||||
}
|
||||
}
|
||||
return vals
|
||||
}
|
||||
|
||||
// Emit the message and args at DEBUG level
|
||||
func (l *intLogger) Debug(msg string, args ...interface{}) {
|
||||
l.Log(Debug, msg, args...)
|
||||
@@ -507,5 +519,9 @@ func (l *intLogger) StandardLogger(opts *StandardLoggerOptions) *log.Logger {
|
||||
}
|
||||
|
||||
func (l *intLogger) StandardWriter(opts *StandardLoggerOptions) io.Writer {
|
||||
return &stdlogAdapter{l, opts.InferLevels}
|
||||
return &stdlogAdapter{
|
||||
log: l,
|
||||
inferLevels: opts.InferLevels,
|
||||
forceLevel: opts.ForceLevel,
|
||||
}
|
||||
}
|
||||
|
||||
6
vendor/github.com/hashicorp/go-hclog/logger.go
сгенерированный
поставляемый
6
vendor/github.com/hashicorp/go-hclog/logger.go
сгенерированный
поставляемый
@@ -143,6 +143,12 @@ type StandardLoggerOptions struct {
|
||||
// This supports the strings like [ERROR], [ERR] [TRACE], [WARN], [INFO],
|
||||
// [DEBUG] and strip it off before reapplying it.
|
||||
InferLevels bool
|
||||
|
||||
// ForceLevel is used to force all output from the standard logger to be at
|
||||
// the specified level. Similar to InferLevels, this will strip any level
|
||||
// prefix contained in the logged string before applying the forced level.
|
||||
// If set, this override InferLevels.
|
||||
ForceLevel Level
|
||||
}
|
||||
|
||||
// LoggerOptions can be used to configure a new logger.
|
||||
|
||||
23
vendor/github.com/hashicorp/go-hclog/stdlog.go
сгенерированный
поставляемый
23
vendor/github.com/hashicorp/go-hclog/stdlog.go
сгенерированный
поставляемый
@@ -11,6 +11,7 @@ import (
|
||||
type stdlogAdapter struct {
|
||||
log Logger
|
||||
inferLevels bool
|
||||
forceLevel Level
|
||||
}
|
||||
|
||||
// Take the data, infer the levels if configured, and send it through
|
||||
@@ -18,7 +19,27 @@ type stdlogAdapter struct {
|
||||
func (s *stdlogAdapter) Write(data []byte) (int, error) {
|
||||
str := string(bytes.TrimRight(data, " \t\n"))
|
||||
|
||||
if s.inferLevels {
|
||||
if s.forceLevel != NoLevel {
|
||||
// Use pickLevel to strip log levels included in the line since we are
|
||||
// forcing the level
|
||||
_, str := s.pickLevel(str)
|
||||
|
||||
// Log at the forced level
|
||||
switch s.forceLevel {
|
||||
case Trace:
|
||||
s.log.Trace(str)
|
||||
case Debug:
|
||||
s.log.Debug(str)
|
||||
case Info:
|
||||
s.log.Info(str)
|
||||
case Warn:
|
||||
s.log.Warn(str)
|
||||
case Error:
|
||||
s.log.Error(str)
|
||||
default:
|
||||
s.log.Info(str)
|
||||
}
|
||||
} else if s.inferLevels {
|
||||
level, str := s.pickLevel(str)
|
||||
switch level {
|
||||
case Trace:
|
||||
|
||||
9
vendor/github.com/hashicorp/go-immutable-radix/CHANGELOG.md
сгенерированный
поставляемый
Обычный файл
9
vendor/github.com/hashicorp/go-immutable-radix/CHANGELOG.md
сгенерированный
поставляемый
Обычный файл
@@ -0,0 +1,9 @@
|
||||
# 1.1.0 (May 22nd, 2019)
|
||||
|
||||
FEATURES
|
||||
|
||||
* Add `SeekLowerBound` to allow for range scans. [[GH-24](https://github.com/hashicorp/go-immutable-radix/pull/24)]
|
||||
|
||||
# 1.0.0 (August 30th, 2018)
|
||||
|
||||
* go mod adopted
|
||||
25
vendor/github.com/hashicorp/go-immutable-radix/README.md
сгенерированный
поставляемый
25
vendor/github.com/hashicorp/go-immutable-radix/README.md
сгенерированный
поставляемый
@@ -39,3 +39,28 @@ if string(m) != "foo" {
|
||||
}
|
||||
```
|
||||
|
||||
Here is an example of performing a range scan of the keys.
|
||||
|
||||
```go
|
||||
// Create a tree
|
||||
r := iradix.New()
|
||||
r, _, _ = r.Insert([]byte("001"), 1)
|
||||
r, _, _ = r.Insert([]byte("002"), 2)
|
||||
r, _, _ = r.Insert([]byte("005"), 5)
|
||||
r, _, _ = r.Insert([]byte("010"), 10)
|
||||
r, _, _ = r.Insert([]byte("100"), 10)
|
||||
|
||||
// Range scan over the keys that sort lexicographically between [003, 050)
|
||||
it := r.Root().Iterator()
|
||||
it.SeekLowerBound([]byte("003"))
|
||||
for key, _, ok := it.Next(); ok; key, _, ok = it.Next() {
|
||||
if key >= "050" {
|
||||
break
|
||||
}
|
||||
fmt.Println(key)
|
||||
}
|
||||
// Output:
|
||||
// 005
|
||||
// 010
|
||||
```
|
||||
|
||||
|
||||
99
vendor/github.com/hashicorp/go-immutable-radix/iter.go
сгенерированный
поставляемый
99
vendor/github.com/hashicorp/go-immutable-radix/iter.go
сгенерированный
поставляемый
@@ -1,6 +1,8 @@
|
||||
package iradix
|
||||
|
||||
import "bytes"
|
||||
import (
|
||||
"bytes"
|
||||
)
|
||||
|
||||
// Iterator is used to iterate over a set of nodes
|
||||
// in pre-order
|
||||
@@ -53,6 +55,101 @@ func (i *Iterator) SeekPrefix(prefix []byte) {
|
||||
i.SeekPrefixWatch(prefix)
|
||||
}
|
||||
|
||||
func (i *Iterator) recurseMin(n *Node) *Node {
|
||||
// Traverse to the minimum child
|
||||
if n.leaf != nil {
|
||||
return n
|
||||
}
|
||||
if len(n.edges) > 0 {
|
||||
// Add all the other edges to the stack (the min node will be added as
|
||||
// we recurse)
|
||||
i.stack = append(i.stack, n.edges[1:])
|
||||
return i.recurseMin(n.edges[0].node)
|
||||
}
|
||||
// Shouldn't be possible
|
||||
return nil
|
||||
}
|
||||
|
||||
// SeekLowerBound is used to seek the iterator to the smallest key that is
|
||||
// greater or equal to the given key. There is no watch variant as it's hard to
|
||||
// predict based on the radix structure which node(s) changes might affect the
|
||||
// result.
|
||||
func (i *Iterator) SeekLowerBound(key []byte) {
|
||||
// Wipe the stack. Unlike Prefix iteration, we need to build the stack as we
|
||||
// go because we need only a subset of edges of many nodes in the path to the
|
||||
// leaf with the lower bound.
|
||||
i.stack = []edges{}
|
||||
n := i.node
|
||||
search := key
|
||||
|
||||
found := func(n *Node) {
|
||||
i.node = n
|
||||
i.stack = append(i.stack, edges{edge{node: n}})
|
||||
}
|
||||
|
||||
for {
|
||||
// Compare current prefix with the search key's same-length prefix.
|
||||
var prefixCmp int
|
||||
if len(n.prefix) < len(search) {
|
||||
prefixCmp = bytes.Compare(n.prefix, search[0:len(n.prefix)])
|
||||
} else {
|
||||
prefixCmp = bytes.Compare(n.prefix, search)
|
||||
}
|
||||
|
||||
if prefixCmp > 0 {
|
||||
// Prefix is larger, that means the lower bound is greater than the search
|
||||
// and from now on we need to follow the minimum path to the smallest
|
||||
// leaf under this subtree.
|
||||
n = i.recurseMin(n)
|
||||
if n != nil {
|
||||
found(n)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if prefixCmp < 0 {
|
||||
// Prefix is smaller than search prefix, that means there is no lower
|
||||
// bound
|
||||
i.node = nil
|
||||
return
|
||||
}
|
||||
|
||||
// Prefix is equal, we are still heading for an exact match. If this is a
|
||||
// leaf we're done.
|
||||
if n.leaf != nil {
|
||||
if bytes.Compare(n.leaf.key, key) < 0 {
|
||||
i.node = nil
|
||||
return
|
||||
}
|
||||
found(n)
|
||||
return
|
||||
}
|
||||
|
||||
// Consume the search prefix
|
||||
if len(n.prefix) > len(search) {
|
||||
search = []byte{}
|
||||
} else {
|
||||
search = search[len(n.prefix):]
|
||||
}
|
||||
|
||||
// Otherwise, take the lower bound next edge.
|
||||
idx, lbNode := n.getLowerBoundEdge(search[0])
|
||||
if lbNode == nil {
|
||||
i.node = nil
|
||||
return
|
||||
}
|
||||
|
||||
// Create stack edges for the all strictly higher edges in this node.
|
||||
if idx+1 < len(n.edges) {
|
||||
i.stack = append(i.stack, n.edges[idx+1:])
|
||||
}
|
||||
|
||||
i.node = lbNode
|
||||
// Recurse
|
||||
n = lbNode
|
||||
}
|
||||
}
|
||||
|
||||
// Next returns the next node in order
|
||||
func (i *Iterator) Next() ([]byte, interface{}, bool) {
|
||||
// Initialize our stack if needed
|
||||
|
||||
12
vendor/github.com/hashicorp/go-immutable-radix/node.go
сгенерированный
поставляемый
12
vendor/github.com/hashicorp/go-immutable-radix/node.go
сгенерированный
поставляемый
@@ -79,6 +79,18 @@ func (n *Node) getEdge(label byte) (int, *Node) {
|
||||
return -1, nil
|
||||
}
|
||||
|
||||
func (n *Node) getLowerBoundEdge(label byte) (int, *Node) {
|
||||
num := len(n.edges)
|
||||
idx := sort.Search(num, func(i int) bool {
|
||||
return n.edges[i].label >= label
|
||||
})
|
||||
// we want lower bound behavior so return even if it's not an exact match
|
||||
if idx < num {
|
||||
return idx, n.edges[idx].node
|
||||
}
|
||||
return -1, nil
|
||||
}
|
||||
|
||||
func (n *Node) delEdge(label byte) {
|
||||
num := len(n.edges)
|
||||
idx := sort.Search(num, func(i int) bool {
|
||||
|
||||
2
vendor/github.com/hashicorp/go-msgpack/codec/decode.go
сгенерированный
поставляемый
2
vendor/github.com/hashicorp/go-msgpack/codec/decode.go
сгенерированный
поставляемый
@@ -527,7 +527,7 @@ func (f *decFnInfo) kMap(rv reflect.Value) {
|
||||
}
|
||||
}
|
||||
rvv := rv.MapIndex(rvk)
|
||||
if !rvv.IsValid() {
|
||||
if !rvv.IsValid() || !rvv.CanSet() {
|
||||
rvv = reflect.New(vtype).Elem()
|
||||
}
|
||||
|
||||
|
||||
7
vendor/github.com/hashicorp/go-msgpack/codec/helper.go
сгенерированный
поставляемый
7
vendor/github.com/hashicorp/go-msgpack/codec/helper.go
сгенерированный
поставляемый
@@ -45,6 +45,13 @@ const (
|
||||
// for debugging, set this to false, to catch panic traces.
|
||||
// Note that this will always cause rpc tests to fail, since they need io.EOF sent via panic.
|
||||
recoverPanicToErr = true
|
||||
|
||||
// if checkStructForEmptyValue, check structs fields to see if an empty value.
|
||||
// This could be an expensive call, so possibly disable it.
|
||||
checkStructForEmptyValue = false
|
||||
|
||||
// if derefForIsEmptyValue, deref pointers and interfaces when checking isEmptyValue
|
||||
derefForIsEmptyValue = false
|
||||
)
|
||||
|
||||
type charEncoding uint8
|
||||
|
||||
13
vendor/github.com/hashicorp/go-msgpack/codec/helper_internal.go
сгенерированный
поставляемый
13
vendor/github.com/hashicorp/go-msgpack/codec/helper_internal.go
сгенерированный
поставляемый
@@ -33,8 +33,10 @@ func panicValToErr(panicVal interface{}, err *error) {
|
||||
return
|
||||
}
|
||||
|
||||
func isEmptyValueDeref(v reflect.Value, deref bool) bool {
|
||||
func hIsEmptyValue(v reflect.Value, deref, checkStruct bool) bool {
|
||||
switch v.Kind() {
|
||||
case reflect.Invalid:
|
||||
return true
|
||||
case reflect.Array, reflect.Map, reflect.Slice, reflect.String:
|
||||
return v.Len() == 0
|
||||
case reflect.Bool:
|
||||
@@ -50,18 +52,21 @@ func isEmptyValueDeref(v reflect.Value, deref bool) bool {
|
||||
if v.IsNil() {
|
||||
return true
|
||||
}
|
||||
return isEmptyValueDeref(v.Elem(), deref)
|
||||
return hIsEmptyValue(v.Elem(), deref, checkStruct)
|
||||
} else {
|
||||
return v.IsNil()
|
||||
}
|
||||
case reflect.Struct:
|
||||
if !checkStruct {
|
||||
return false
|
||||
}
|
||||
// return true if all fields are empty. else return false.
|
||||
|
||||
// we cannot use equality check, because some fields may be maps/slices/etc
|
||||
// and consequently the structs are not comparable.
|
||||
// return v.Interface() == reflect.Zero(v.Type()).Interface()
|
||||
for i, n := 0, v.NumField(); i < n; i++ {
|
||||
if !isEmptyValueDeref(v.Field(i), deref) {
|
||||
if !hIsEmptyValue(v.Field(i), deref, checkStruct) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -71,7 +76,7 @@ func isEmptyValueDeref(v reflect.Value, deref bool) bool {
|
||||
}
|
||||
|
||||
func isEmptyValue(v reflect.Value) bool {
|
||||
return isEmptyValueDeref(v, true)
|
||||
return hIsEmptyValue(v, derefForIsEmptyValue, checkStructForEmptyValue)
|
||||
}
|
||||
|
||||
func debugf(format string, args ...interface{}) {
|
||||
|
||||
1
vendor/github.com/hashicorp/go-plugin/.gitignore
сгенерированный
поставляемый
1
vendor/github.com/hashicorp/go-plugin/.gitignore
сгенерированный
поставляемый
@@ -1 +1,2 @@
|
||||
.DS_Store
|
||||
.idea
|
||||
|
||||
30
vendor/github.com/hashicorp/go-plugin/client.go
сгенерированный
поставляемый
30
vendor/github.com/hashicorp/go-plugin/client.go
сгенерированный
поставляемый
@@ -87,6 +87,10 @@ type Client struct {
|
||||
// goroutines.
|
||||
clientWaitGroup sync.WaitGroup
|
||||
|
||||
// stderrWaitGroup is used to prevent the command's Wait() function from
|
||||
// being called before we've finished reading from the stderr pipe.
|
||||
stderrWaitGroup sync.WaitGroup
|
||||
|
||||
// processKilled is used for testing only, to flag when the process was
|
||||
// forcefully killed.
|
||||
processKilled bool
|
||||
@@ -590,6 +594,12 @@ func (c *Client) Start() (addr net.Addr, err error) {
|
||||
// Create a context for when we kill
|
||||
c.doneCtx, c.ctxCancel = context.WithCancel(context.Background())
|
||||
|
||||
// Start goroutine that logs the stderr
|
||||
c.clientWaitGroup.Add(1)
|
||||
c.stderrWaitGroup.Add(1)
|
||||
// logStderr calls Done()
|
||||
go c.logStderr(cmdStderr)
|
||||
|
||||
c.clientWaitGroup.Add(1)
|
||||
go func() {
|
||||
// ensure the context is cancelled when we're done
|
||||
@@ -602,6 +612,10 @@ func (c *Client) Start() (addr net.Addr, err error) {
|
||||
pid := c.process.Pid
|
||||
path := cmd.Path
|
||||
|
||||
// wait to finish reading from stderr since the stderr pipe reader
|
||||
// will be closed by the subsequent call to cmd.Wait().
|
||||
c.stderrWaitGroup.Wait()
|
||||
|
||||
// Wait for the command to end.
|
||||
err := cmd.Wait()
|
||||
|
||||
@@ -624,11 +638,6 @@ func (c *Client) Start() (addr net.Addr, err error) {
|
||||
c.exited = true
|
||||
}()
|
||||
|
||||
// Start goroutine that logs the stderr
|
||||
c.clientWaitGroup.Add(1)
|
||||
// logStderr calls Done()
|
||||
go c.logStderr(cmdStderr)
|
||||
|
||||
// Start a goroutine that is going to be reading the lines
|
||||
// out of stdout
|
||||
linesCh := make(chan string)
|
||||
@@ -936,6 +945,7 @@ var stdErrBufferSize = 64 * 1024
|
||||
|
||||
func (c *Client) logStderr(r io.Reader) {
|
||||
defer c.clientWaitGroup.Done()
|
||||
defer c.stderrWaitGroup.Done()
|
||||
l := c.logger.Named(filepath.Base(c.config.Cmd.Path))
|
||||
|
||||
reader := bufio.NewReaderSize(r, stdErrBufferSize)
|
||||
@@ -976,15 +986,15 @@ func (c *Client) logStderr(r io.Reader) {
|
||||
// Attempt to infer the desired log level from the commonly used
|
||||
// string prefixes
|
||||
switch line := string(line); {
|
||||
case strings.HasPrefix("[TRACE]", line):
|
||||
case strings.HasPrefix(line, "[TRACE]"):
|
||||
l.Trace(line)
|
||||
case strings.HasPrefix("[DEBUG]", line):
|
||||
case strings.HasPrefix(line, "[DEBUG]"):
|
||||
l.Debug(line)
|
||||
case strings.HasPrefix("[INFO]", line):
|
||||
case strings.HasPrefix(line, "[INFO]"):
|
||||
l.Info(line)
|
||||
case strings.HasPrefix("[WARN]", line):
|
||||
case strings.HasPrefix(line, "[WARN]"):
|
||||
l.Warn(line)
|
||||
case strings.HasPrefix("[ERROR]", line):
|
||||
case strings.HasPrefix(line, "[ERROR]"):
|
||||
l.Error(line)
|
||||
default:
|
||||
l.Debug(line)
|
||||
|
||||
6
vendor/github.com/hashicorp/go-plugin/grpc_client.go
сгенерированный
поставляемый
6
vendor/github.com/hashicorp/go-plugin/grpc_client.go
сгенерированный
поставляемый
@@ -3,6 +3,7 @@ package plugin
|
||||
import (
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"math"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
@@ -32,6 +33,11 @@ func dialGRPCConn(tls *tls.Config, dialer func(string, time.Duration) (net.Conn,
|
||||
credentials.NewTLS(tls)))
|
||||
}
|
||||
|
||||
opts = append(opts,
|
||||
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(math.MaxInt32)),
|
||||
grpc.WithDefaultCallOptions(grpc.MaxCallSendMsgSize(math.MaxInt32)))
|
||||
|
||||
|
||||
// Connect. Note the first parameter is unused because we use a custom
|
||||
// dialer that has the state to see the address.
|
||||
conn, err := grpc.Dial("unused", opts...)
|
||||
|
||||
32
vendor/github.com/hashicorp/go-plugin/server.go
сгенерированный
поставляемый
32
vendor/github.com/hashicorp/go-plugin/server.go
сгенерированный
поставляемый
@@ -363,14 +363,34 @@ func serverListener() (net.Listener, error) {
|
||||
}
|
||||
|
||||
func serverListener_tcp() (net.Listener, error) {
|
||||
minPort, err := strconv.ParseInt(os.Getenv("PLUGIN_MIN_PORT"), 10, 32)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
envMinPort := os.Getenv("PLUGIN_MIN_PORT")
|
||||
envMaxPort := os.Getenv("PLUGIN_MAX_PORT")
|
||||
|
||||
var minPort, maxPort int64
|
||||
var err error
|
||||
|
||||
switch {
|
||||
case len(envMinPort) == 0:
|
||||
minPort = 0
|
||||
default:
|
||||
minPort, err = strconv.ParseInt(envMinPort, 10, 32)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Couldn't get value from PLUGIN_MIN_PORT: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
maxPort, err := strconv.ParseInt(os.Getenv("PLUGIN_MAX_PORT"), 10, 32)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
switch {
|
||||
case len(envMaxPort) == 0:
|
||||
maxPort = 0
|
||||
default:
|
||||
maxPort, err = strconv.ParseInt(envMaxPort, 10, 32)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Couldn't get value from PLUGIN_MAX_PORT: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
if minPort > maxPort {
|
||||
return nil, fmt.Errorf("ENV_MIN_PORT value of %d is greater than PLUGIN_MAX_PORT value of %d", minPort, maxPort)
|
||||
}
|
||||
|
||||
for port := minPort; port <= maxPort; port++ {
|
||||
|
||||
5
vendor/github.com/hashicorp/memberlist/config.go
сгенерированный
поставляемый
5
vendor/github.com/hashicorp/memberlist/config.go
сгенерированный
поставляемый
@@ -215,6 +215,11 @@ type Config struct {
|
||||
// This is a legacy name for backward compatibility but should really be
|
||||
// called PacketBufferSize now that we have generalized the transport.
|
||||
UDPBufferSize int
|
||||
|
||||
// DeadNodeReclaimTime controls the time before a dead node's name can be
|
||||
// reclaimed by one with a different address or port. By default, this is 0,
|
||||
// meaning nodes cannot be reclaimed this way.
|
||||
DeadNodeReclaimTime time.Duration
|
||||
}
|
||||
|
||||
// DefaultLANConfig returns a sane set of configurations for Memberlist.
|
||||
|
||||
46
vendor/github.com/hashicorp/memberlist/state.go
сгенерированный
поставляемый
46
vendor/github.com/hashicorp/memberlist/state.go
сгенерированный
поставляемый
@@ -9,7 +9,7 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/armon/go-metrics"
|
||||
metrics "github.com/armon/go-metrics"
|
||||
)
|
||||
|
||||
type nodeStateType int
|
||||
@@ -891,6 +891,7 @@ func (m *Memberlist) aliveNode(a *alive, notify chan struct{}, bootstrap bool) {
|
||||
|
||||
// Check if we've never seen this node before, and if not, then
|
||||
// store this node in our node map.
|
||||
var updatesNode bool
|
||||
if !ok {
|
||||
state = &nodeState{
|
||||
Node: Node{
|
||||
@@ -926,29 +927,40 @@ func (m *Memberlist) aliveNode(a *alive, notify chan struct{}, bootstrap bool) {
|
||||
|
||||
// Update numNodes after we've added a new node
|
||||
atomic.AddUint32(&m.numNodes, 1)
|
||||
}
|
||||
} else {
|
||||
// Check if this address is different than the existing node unless the old node is dead.
|
||||
if !bytes.Equal([]byte(state.Addr), a.Addr) || state.Port != a.Port {
|
||||
// If DeadNodeReclaimTime is configured, check if enough time has elapsed since the node died.
|
||||
canReclaim := (m.config.DeadNodeReclaimTime > 0 &&
|
||||
time.Since(state.StateChange) > m.config.DeadNodeReclaimTime)
|
||||
|
||||
// Check if this address is different than the existing node
|
||||
if !bytes.Equal([]byte(state.Addr), a.Addr) || state.Port != a.Port {
|
||||
m.logger.Printf("[ERR] memberlist: Conflicting address for %s. Mine: %v:%d Theirs: %v:%d",
|
||||
state.Name, state.Addr, state.Port, net.IP(a.Addr), a.Port)
|
||||
// Allow the address to be updated if a dead node is being replaced.
|
||||
if state.State == stateDead && canReclaim {
|
||||
m.logger.Printf("[INFO] memberlist: Updating address for failed node %s from %v:%d to %v:%d",
|
||||
state.Name, state.Addr, state.Port, net.IP(a.Addr), a.Port)
|
||||
updatesNode = true
|
||||
} else {
|
||||
m.logger.Printf("[ERR] memberlist: Conflicting address for %s. Mine: %v:%d Theirs: %v:%d Old state: %v",
|
||||
state.Name, state.Addr, state.Port, net.IP(a.Addr), a.Port, state.State)
|
||||
|
||||
// Inform the conflict delegate if provided
|
||||
if m.config.Conflict != nil {
|
||||
other := Node{
|
||||
Name: a.Node,
|
||||
Addr: a.Addr,
|
||||
Port: a.Port,
|
||||
Meta: a.Meta,
|
||||
// Inform the conflict delegate if provided
|
||||
if m.config.Conflict != nil {
|
||||
other := Node{
|
||||
Name: a.Node,
|
||||
Addr: a.Addr,
|
||||
Port: a.Port,
|
||||
Meta: a.Meta,
|
||||
}
|
||||
m.config.Conflict.NotifyConflict(&state.Node, &other)
|
||||
}
|
||||
return
|
||||
}
|
||||
m.config.Conflict.NotifyConflict(&state.Node, &other)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Bail if the incarnation number is older, and this is not about us
|
||||
isLocalNode := state.Name == m.config.Name
|
||||
if a.Incarnation <= state.Incarnation && !isLocalNode {
|
||||
if a.Incarnation <= state.Incarnation && !isLocalNode && !updatesNode {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1006,6 +1018,8 @@ func (m *Memberlist) aliveNode(a *alive, notify chan struct{}, bootstrap bool) {
|
||||
// Update the state and incarnation number
|
||||
state.Incarnation = a.Incarnation
|
||||
state.Meta = a.Meta
|
||||
state.Addr = a.Addr
|
||||
state.Port = a.Port
|
||||
if state.State != stateAlive {
|
||||
state.State = stateAlive
|
||||
state.StateChange = time.Now()
|
||||
|
||||
Ссылка в новой задаче
Block a user