Upgrade x/sync, Prometheus client and faas-provider

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alex@openfaas.com>
This commit is contained in:
Alex Ellis (OpenFaaS Ltd)
2022-08-24 18:12:23 +01:00
parent 20b62e3cc9
commit ce5ea178ec
347 changed files with 23183 additions and 18188 deletions

View File

@ -5,12 +5,12 @@
package order
import (
pref "google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/reflect/protoreflect"
)
// FieldOrder specifies the ordering to visit message fields.
// It is a function that reports whether x is ordered before y.
type FieldOrder func(x, y pref.FieldDescriptor) bool
type FieldOrder func(x, y protoreflect.FieldDescriptor) bool
var (
// AnyFieldOrder specifies no specific field ordering.
@ -18,9 +18,9 @@ var (
// LegacyFieldOrder sorts fields in the same ordering as emitted by
// wire serialization in the github.com/golang/protobuf implementation.
LegacyFieldOrder FieldOrder = func(x, y pref.FieldDescriptor) bool {
LegacyFieldOrder FieldOrder = func(x, y protoreflect.FieldDescriptor) bool {
ox, oy := x.ContainingOneof(), y.ContainingOneof()
inOneof := func(od pref.OneofDescriptor) bool {
inOneof := func(od protoreflect.OneofDescriptor) bool {
return od != nil && !od.IsSynthetic()
}
@ -41,14 +41,14 @@ var (
}
// NumberFieldOrder sorts fields by their field number.
NumberFieldOrder FieldOrder = func(x, y pref.FieldDescriptor) bool {
NumberFieldOrder FieldOrder = func(x, y protoreflect.FieldDescriptor) bool {
return x.Number() < y.Number()
}
// IndexNameFieldOrder sorts non-extension fields before extension fields.
// Non-extensions are sorted according to their declaration index.
// Extensions are sorted according to their full name.
IndexNameFieldOrder FieldOrder = func(x, y pref.FieldDescriptor) bool {
IndexNameFieldOrder FieldOrder = func(x, y protoreflect.FieldDescriptor) bool {
// Non-extension fields sort before extension fields.
if x.IsExtension() != y.IsExtension() {
return !x.IsExtension() && y.IsExtension()
@ -64,7 +64,7 @@ var (
// KeyOrder specifies the ordering to visit map entries.
// It is a function that reports whether x is ordered before y.
type KeyOrder func(x, y pref.MapKey) bool
type KeyOrder func(x, y protoreflect.MapKey) bool
var (
// AnyKeyOrder specifies no specific key ordering.
@ -72,7 +72,7 @@ var (
// GenericKeyOrder sorts false before true, numeric keys in ascending order,
// and strings in lexicographical ordering according to UTF-8 codepoints.
GenericKeyOrder KeyOrder = func(x, y pref.MapKey) bool {
GenericKeyOrder KeyOrder = func(x, y protoreflect.MapKey) bool {
switch x.Interface().(type) {
case bool:
return !x.Bool() && y.Bool()

View File

@ -9,12 +9,12 @@ import (
"sort"
"sync"
pref "google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/reflect/protoreflect"
)
type messageField struct {
fd pref.FieldDescriptor
v pref.Value
fd protoreflect.FieldDescriptor
v protoreflect.Value
}
var messageFieldPool = sync.Pool{
@ -25,8 +25,8 @@ type (
// FieldRnger is an interface for visiting all fields in a message.
// The protoreflect.Message type implements this interface.
FieldRanger interface{ Range(VisitField) }
// VisitField is called everytime a message field is visited.
VisitField = func(pref.FieldDescriptor, pref.Value) bool
// VisitField is called every time a message field is visited.
VisitField = func(protoreflect.FieldDescriptor, protoreflect.Value) bool
)
// RangeFields iterates over the fields of fs according to the specified order.
@ -47,7 +47,7 @@ func RangeFields(fs FieldRanger, less FieldOrder, fn VisitField) {
}()
// Collect all fields in the message and sort them.
fs.Range(func(fd pref.FieldDescriptor, v pref.Value) bool {
fs.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
fields = append(fields, messageField{fd, v})
return true
})
@ -64,8 +64,8 @@ func RangeFields(fs FieldRanger, less FieldOrder, fn VisitField) {
}
type mapEntry struct {
k pref.MapKey
v pref.Value
k protoreflect.MapKey
v protoreflect.Value
}
var mapEntryPool = sync.Pool{
@ -76,8 +76,8 @@ type (
// EntryRanger is an interface for visiting all fields in a message.
// The protoreflect.Map type implements this interface.
EntryRanger interface{ Range(VisitEntry) }
// VisitEntry is called everytime a map entry is visited.
VisitEntry = func(pref.MapKey, pref.Value) bool
// VisitEntry is called every time a map entry is visited.
VisitEntry = func(protoreflect.MapKey, protoreflect.Value) bool
)
// RangeEntries iterates over the entries of es according to the specified order.
@ -98,7 +98,7 @@ func RangeEntries(es EntryRanger, less KeyOrder, fn VisitEntry) {
}()
// Collect all entries in the map and sort them.
es.Range(func(k pref.MapKey, v pref.Value) bool {
es.Range(func(k protoreflect.MapKey, v protoreflect.Value) bool {
entries = append(entries, mapEntry{k, v})
return true
})