mirror of
https://github.com/openfaas/faas.git
synced 2025-06-20 04:56:38 +00:00
Migrate away from queue type in faas project
The queue type now resides in the provider, so that there is no risk of a circular reference. Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
committed by
Alex Ellis
parent
06a51373e2
commit
58394bb1de
60
gateway/vendor/google.golang.org/protobuf/proto/encode.go
generated
vendored
60
gateway/vendor/google.golang.org/protobuf/proto/encode.go
generated
vendored
@ -5,12 +5,9 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"sort"
|
||||
|
||||
"google.golang.org/protobuf/encoding/protowire"
|
||||
"google.golang.org/protobuf/internal/encoding/messageset"
|
||||
"google.golang.org/protobuf/internal/fieldsort"
|
||||
"google.golang.org/protobuf/internal/mapsort"
|
||||
"google.golang.org/protobuf/internal/order"
|
||||
"google.golang.org/protobuf/internal/pragma"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
"google.golang.org/protobuf/runtime/protoiface"
|
||||
@ -134,6 +131,9 @@ func (o MarshalOptions) MarshalState(in protoiface.MarshalInput) (protoiface.Mar
|
||||
return o.marshal(in.Buf, in.Message)
|
||||
}
|
||||
|
||||
// marshal is a centralized function that all marshal operations go through.
|
||||
// For profiling purposes, avoid changing the name of this function or
|
||||
// introducing other code paths for marshal that do not go through this.
|
||||
func (o MarshalOptions) marshal(b []byte, m protoreflect.Message) (out protoiface.MarshalOutput, err error) {
|
||||
allowPartial := o.AllowPartial
|
||||
o.AllowPartial = true
|
||||
@ -206,16 +206,17 @@ func growcap(oldcap, wantcap int) (newcap int) {
|
||||
|
||||
func (o MarshalOptions) marshalMessageSlow(b []byte, m protoreflect.Message) ([]byte, error) {
|
||||
if messageset.IsMessageSet(m.Descriptor()) {
|
||||
return marshalMessageSet(b, m, o)
|
||||
return o.marshalMessageSet(b, m)
|
||||
}
|
||||
fieldOrder := order.AnyFieldOrder
|
||||
if o.Deterministic {
|
||||
// TODO: This should use a more natural ordering like NumberFieldOrder,
|
||||
// but doing so breaks golden tests that make invalid assumption about
|
||||
// output stability of this implementation.
|
||||
fieldOrder = order.LegacyFieldOrder
|
||||
}
|
||||
// There are many choices for what order we visit fields in. The default one here
|
||||
// is chosen for reasonable efficiency and simplicity given the protoreflect API.
|
||||
// It is not deterministic, since Message.Range does not return fields in any
|
||||
// defined order.
|
||||
//
|
||||
// When using deterministic serialization, we sort the known fields.
|
||||
var err error
|
||||
o.rangeFields(m, func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
|
||||
order.RangeFields(m, fieldOrder, func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
|
||||
b, err = o.marshalField(b, fd, v)
|
||||
return err == nil
|
||||
})
|
||||
@ -226,27 +227,6 @@ func (o MarshalOptions) marshalMessageSlow(b []byte, m protoreflect.Message) ([]
|
||||
return b, nil
|
||||
}
|
||||
|
||||
// rangeFields visits fields in a defined order when deterministic serialization is enabled.
|
||||
func (o MarshalOptions) rangeFields(m protoreflect.Message, f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||
if !o.Deterministic {
|
||||
m.Range(f)
|
||||
return
|
||||
}
|
||||
var fds []protoreflect.FieldDescriptor
|
||||
m.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool {
|
||||
fds = append(fds, fd)
|
||||
return true
|
||||
})
|
||||
sort.Slice(fds, func(a, b int) bool {
|
||||
return fieldsort.Less(fds[a], fds[b])
|
||||
})
|
||||
for _, fd := range fds {
|
||||
if !f(fd, m.Get(fd)) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (o MarshalOptions) marshalField(b []byte, fd protoreflect.FieldDescriptor, value protoreflect.Value) ([]byte, error) {
|
||||
switch {
|
||||
case fd.IsList():
|
||||
@ -289,8 +269,12 @@ func (o MarshalOptions) marshalList(b []byte, fd protoreflect.FieldDescriptor, l
|
||||
func (o MarshalOptions) marshalMap(b []byte, fd protoreflect.FieldDescriptor, mapv protoreflect.Map) ([]byte, error) {
|
||||
keyf := fd.MapKey()
|
||||
valf := fd.MapValue()
|
||||
keyOrder := order.AnyKeyOrder
|
||||
if o.Deterministic {
|
||||
keyOrder = order.GenericKeyOrder
|
||||
}
|
||||
var err error
|
||||
o.rangeMap(mapv, keyf.Kind(), func(key protoreflect.MapKey, value protoreflect.Value) bool {
|
||||
order.RangeEntries(mapv, keyOrder, func(key protoreflect.MapKey, value protoreflect.Value) bool {
|
||||
b = protowire.AppendTag(b, fd.Number(), protowire.BytesType)
|
||||
var pos int
|
||||
b, pos = appendSpeculativeLength(b)
|
||||
@ -309,14 +293,6 @@ func (o MarshalOptions) marshalMap(b []byte, fd protoreflect.FieldDescriptor, ma
|
||||
return b, err
|
||||
}
|
||||
|
||||
func (o MarshalOptions) rangeMap(mapv protoreflect.Map, kind protoreflect.Kind, f func(protoreflect.MapKey, protoreflect.Value) bool) {
|
||||
if !o.Deterministic {
|
||||
mapv.Range(f)
|
||||
return
|
||||
}
|
||||
mapsort.Range(mapv, kind, f)
|
||||
}
|
||||
|
||||
// When encoding length-prefixed fields, we speculatively set aside some number of bytes
|
||||
// for the length, encode the data, and then encode the length (shifting the data if necessary
|
||||
// to make room).
|
||||
|
Reference in New Issue
Block a user