code
stringlengths 12
335k
| docstring
stringlengths 20
20.8k
| func_name
stringlengths 1
105
| language
stringclasses 1
value | repo
stringclasses 498
values | path
stringlengths 5
172
| url
stringlengths 43
235
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
func (d *Digest) WriteString(s string) (n int, err error) {
d.Write(*(*[]byte)(unsafe.Pointer(&sliceHeader{s, len(s)})))
// d.Write always returns len(s), nil.
// Ignoring the return output and returning these fixed values buys a
// savings of 6 in the inliner's cost model.
return len(s), nil
} | WriteString adds more data to d. It always returns len(s), nil.
It may be faster than Write([]byte(s)) by avoiding a copy. | WriteString | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go | Apache-2.0 |
func Sum64(b []byte) uint64 {
// A simpler version would be
// d := New()
// d.Write(b)
// return d.Sum64()
// but this is faster, particularly for small inputs.
n := len(b)
var h uint64
if n >= 32 {
v1 := primes[0] + prime2
v2 := prime2
v3 := uint64(0)
v4 := -primes[0]
for len(b) >= 32 {
v1 = round(v1, u64(b[0:8:len(b)]))
v2 = round(v2, u64(b[8:16:len(b)]))
v3 = round(v3, u64(b[16:24:len(b)]))
v4 = round(v4, u64(b[24:32:len(b)]))
b = b[32:len(b):len(b)]
}
h = rol1(v1) + rol7(v2) + rol12(v3) + rol18(v4)
h = mergeRound(h, v1)
h = mergeRound(h, v2)
h = mergeRound(h, v3)
h = mergeRound(h, v4)
} else {
h = prime5
}
h += uint64(n)
for ; len(b) >= 8; b = b[8:] {
k1 := round(0, u64(b[:8]))
h ^= k1
h = rol27(h)*prime1 + prime4
}
if len(b) >= 4 {
h ^= uint64(u32(b[:4])) * prime1
h = rol23(h)*prime2 + prime3
b = b[4:]
}
for ; len(b) > 0; b = b[1:] {
h ^= uint64(b[0]) * prime5
h = rol11(h) * prime1
}
h ^= h >> 33
h *= prime2
h ^= h >> 29
h *= prime3
h ^= h >> 32
return h
} | Sum64 computes the 64-bit xxHash digest of b. | Sum64 | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/cespare/xxhash/v2/xxhash_other.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/cespare/xxhash/v2/xxhash_other.go | Apache-2.0 |
func New() *Digest {
var d Digest
d.Reset()
return &d
} | New creates a new Digest that computes the 64-bit xxHash algorithm. | New | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/cespare/xxhash/v2/xxhash.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/cespare/xxhash/v2/xxhash.go | Apache-2.0 |
func (d *Digest) Reset() {
d.v1 = primes[0] + prime2
d.v2 = prime2
d.v3 = 0
d.v4 = -primes[0]
d.total = 0
d.n = 0
} | Reset clears the Digest's state so that it can be reused. | Reset | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/cespare/xxhash/v2/xxhash.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/cespare/xxhash/v2/xxhash.go | Apache-2.0 |
func (d *Digest) Size() int { return 8 } | Size always returns 8 bytes. | Size | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/cespare/xxhash/v2/xxhash.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/cespare/xxhash/v2/xxhash.go | Apache-2.0 |
func (d *Digest) BlockSize() int { return 32 } | BlockSize always returns 32 bytes. | BlockSize | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/cespare/xxhash/v2/xxhash.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/cespare/xxhash/v2/xxhash.go | Apache-2.0 |
func (d *Digest) Write(b []byte) (n int, err error) {
n = len(b)
d.total += uint64(n)
memleft := d.mem[d.n&(len(d.mem)-1):]
if d.n+n < 32 {
// This new data doesn't even fill the current block.
copy(memleft, b)
d.n += n
return
}
if d.n > 0 {
// Finish off the partial block.
c := copy(memleft, b)
d.v1 = round(d.v1, u64(d.mem[0:8]))
d.v2 = round(d.v2, u64(d.mem[8:16]))
d.v3 = round(d.v3, u64(d.mem[16:24]))
d.v4 = round(d.v4, u64(d.mem[24:32]))
b = b[c:]
d.n = 0
}
if len(b) >= 32 {
// One or more full blocks left.
nw := writeBlocks(d, b)
b = b[nw:]
}
// Store any remaining partial block.
copy(d.mem[:], b)
d.n = len(b)
return
} | Write adds more data to d. It always returns len(b), nil. | Write | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/cespare/xxhash/v2/xxhash.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/cespare/xxhash/v2/xxhash.go | Apache-2.0 |
func (d *Digest) Sum(b []byte) []byte {
s := d.Sum64()
return append(
b,
byte(s>>56),
byte(s>>48),
byte(s>>40),
byte(s>>32),
byte(s>>24),
byte(s>>16),
byte(s>>8),
byte(s),
)
} | Sum appends the current hash to b and returns the resulting slice. | Sum | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/cespare/xxhash/v2/xxhash.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/cespare/xxhash/v2/xxhash.go | Apache-2.0 |
func (d *Digest) Sum64() uint64 {
var h uint64
if d.total >= 32 {
v1, v2, v3, v4 := d.v1, d.v2, d.v3, d.v4
h = rol1(v1) + rol7(v2) + rol12(v3) + rol18(v4)
h = mergeRound(h, v1)
h = mergeRound(h, v2)
h = mergeRound(h, v3)
h = mergeRound(h, v4)
} else {
h = d.v3 + prime5
}
h += d.total
b := d.mem[:d.n&(len(d.mem)-1)]
for ; len(b) >= 8; b = b[8:] {
k1 := round(0, u64(b[:8]))
h ^= k1
h = rol27(h)*prime1 + prime4
}
if len(b) >= 4 {
h ^= uint64(u32(b[:4])) * prime1
h = rol23(h)*prime2 + prime3
b = b[4:]
}
for ; len(b) > 0; b = b[1:] {
h ^= uint64(b[0]) * prime5
h = rol11(h) * prime1
}
h ^= h >> 33
h *= prime2
h ^= h >> 29
h *= prime3
h ^= h >> 32
return h
} | Sum64 returns the current hash. | Sum64 | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/cespare/xxhash/v2/xxhash.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/cespare/xxhash/v2/xxhash.go | Apache-2.0 |
func (d *Digest) MarshalBinary() ([]byte, error) {
b := make([]byte, 0, marshaledSize)
b = append(b, magic...)
b = appendUint64(b, d.v1)
b = appendUint64(b, d.v2)
b = appendUint64(b, d.v3)
b = appendUint64(b, d.v4)
b = appendUint64(b, d.total)
b = append(b, d.mem[:d.n]...)
b = b[:len(b)+len(d.mem)-d.n]
return b, nil
} | MarshalBinary implements the encoding.BinaryMarshaler interface. | MarshalBinary | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/cespare/xxhash/v2/xxhash.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/cespare/xxhash/v2/xxhash.go | Apache-2.0 |
func (d *Digest) UnmarshalBinary(b []byte) error {
if len(b) < len(magic) || string(b[:len(magic)]) != magic {
return errors.New("xxhash: invalid hash state identifier")
}
if len(b) != marshaledSize {
return errors.New("xxhash: invalid hash state size")
}
b = b[len(magic):]
b, d.v1 = consumeUint64(b)
b, d.v2 = consumeUint64(b)
b, d.v3 = consumeUint64(b)
b, d.v4 = consumeUint64(b)
b, d.total = consumeUint64(b)
copy(d.mem[:], b)
d.n = int(d.total % uint64(len(d.mem)))
return nil
} | UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. | UnmarshalBinary | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/cespare/xxhash/v2/xxhash.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/cespare/xxhash/v2/xxhash.go | Apache-2.0 |
func (jm *Marshaler) Marshal(w io.Writer, m proto.Message) error {
b, err := jm.marshal(m)
if len(b) > 0 {
if _, err := w.Write(b); err != nil {
return err
}
}
return err
} | Marshal serializes a protobuf message as JSON into w. | Marshal | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/jsonpb/encode.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/jsonpb/encode.go | Apache-2.0 |
func (jm *Marshaler) MarshalToString(m proto.Message) (string, error) {
b, err := jm.marshal(m)
if err != nil {
return "", err
}
return string(b), nil
} | MarshalToString serializes a protobuf message as JSON in string form. | MarshalToString | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/jsonpb/encode.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/jsonpb/encode.go | Apache-2.0 |
func (w *jsonWriter) marshalField(fd protoreflect.FieldDescriptor, v protoreflect.Value, indent string) error {
if w.Indent != "" {
w.write(indent)
w.write(w.Indent)
}
w.write(`"`)
switch {
case fd.IsExtension():
// For message set, use the fname of the message as the extension name.
name := string(fd.FullName())
if isMessageSet(fd.ContainingMessage()) {
name = strings.TrimSuffix(name, ".message_set_extension")
}
w.write("[" + name + "]")
case w.OrigName:
name := string(fd.Name())
if fd.Kind() == protoreflect.GroupKind {
name = string(fd.Message().Name())
}
w.write(name)
default:
w.write(string(fd.JSONName()))
}
w.write(`":`)
if w.Indent != "" {
w.write(" ")
}
return w.marshalValue(fd, v, indent)
} | marshalField writes field description and value to the Writer. | marshalField | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/jsonpb/encode.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/jsonpb/encode.go | Apache-2.0 |
func UnmarshalNext(d *json.Decoder, m proto.Message) error {
return new(Unmarshaler).UnmarshalNext(d, m)
} | UnmarshalNext unmarshals the next JSON object from d into m. | UnmarshalNext | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/jsonpb/decode.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/jsonpb/decode.go | Apache-2.0 |
func Unmarshal(r io.Reader, m proto.Message) error {
return new(Unmarshaler).Unmarshal(r, m)
} | Unmarshal unmarshals a JSON object from r into m. | Unmarshal | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/jsonpb/decode.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/jsonpb/decode.go | Apache-2.0 |
func UnmarshalString(s string, m proto.Message) error {
return new(Unmarshaler).Unmarshal(strings.NewReader(s), m)
} | UnmarshalString unmarshals a JSON object from s into m. | UnmarshalString | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/jsonpb/decode.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/jsonpb/decode.go | Apache-2.0 |
func (u *Unmarshaler) Unmarshal(r io.Reader, m proto.Message) error {
return u.UnmarshalNext(json.NewDecoder(r), m)
} | Unmarshal unmarshals a JSON object from r into m. | Unmarshal | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/jsonpb/decode.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/jsonpb/decode.go | Apache-2.0 |
func (u *Unmarshaler) UnmarshalNext(d *json.Decoder, m proto.Message) error {
if m == nil {
return errors.New("invalid nil message")
}
// Parse the next JSON object from the stream.
raw := json.RawMessage{}
if err := d.Decode(&raw); err != nil {
return err
}
// Check for custom unmarshalers first since they may not properly
// implement protobuf reflection that the logic below relies on.
if jsu, ok := m.(JSONPBUnmarshaler); ok {
return jsu.UnmarshalJSONPB(u, raw)
}
mr := proto.MessageReflect(m)
// NOTE: For historical reasons, a top-level null is treated as a noop.
// This is incorrect, but kept for compatibility.
if string(raw) == "null" && mr.Descriptor().FullName() != "google.protobuf.Value" {
return nil
}
if wrapJSONUnmarshalV2 {
// NOTE: If input message is non-empty, we need to preserve merge semantics
// of the old jsonpb implementation. These semantics are not supported by
// the protobuf JSON specification.
isEmpty := true
mr.Range(func(protoreflect.FieldDescriptor, protoreflect.Value) bool {
isEmpty = false // at least one iteration implies non-empty
return false
})
if !isEmpty {
// Perform unmarshaling into a newly allocated, empty message.
mr = mr.New()
// Use a defer to copy all unmarshaled fields into the original message.
dst := proto.MessageReflect(m)
defer mr.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
dst.Set(fd, v)
return true
})
}
// Unmarshal using the v2 JSON unmarshaler.
opts := protojson.UnmarshalOptions{
DiscardUnknown: u.AllowUnknownFields,
}
if u.AnyResolver != nil {
opts.Resolver = anyResolver{u.AnyResolver}
}
return opts.Unmarshal(raw, mr.Interface())
} else {
if err := u.unmarshalMessage(mr, raw); err != nil {
return err
}
return protoV2.CheckInitialized(mr.Interface())
}
} | UnmarshalNext unmarshals the next JSON object from d into m. | UnmarshalNext | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/jsonpb/decode.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/jsonpb/decode.go | Apache-2.0 |
func trimQuote(in []byte) []byte {
if len(in) >= 2 && in[0] == '"' && in[len(in)-1] == '"' {
in = in[1 : len(in)-1]
}
return in
} | trimQuote is like unquoteString but simply strips surrounding quotes.
This is incorrect, but is behavior done by the legacy implementation. | trimQuote | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/jsonpb/decode.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/jsonpb/decode.go | Apache-2.0 |
func Timestamp(ts *timestamppb.Timestamp) (time.Time, error) {
// Don't return the zero value on error, because corresponds to a valid
// timestamp. Instead return whatever time.Unix gives us.
var t time.Time
if ts == nil {
t = time.Unix(0, 0).UTC() // treat nil like the empty Timestamp
} else {
t = time.Unix(ts.Seconds, int64(ts.Nanos)).UTC()
}
return t, validateTimestamp(ts)
} | Timestamp converts a timestamppb.Timestamp to a time.Time.
It returns an error if the argument is invalid.
Unlike most Go functions, if Timestamp returns an error, the first return
value is not the zero time.Time. Instead, it is the value obtained from the
time.Unix function when passed the contents of the Timestamp, in the UTC
locale. This may or may not be a meaningful time; many invalid Timestamps
do map to valid time.Times.
A nil Timestamp returns an error. The first return value in that case is
undefined.
Deprecated: Call the ts.AsTime and ts.CheckValid methods instead. | Timestamp | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/ptypes/timestamp.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/ptypes/timestamp.go | Apache-2.0 |
func TimestampNow() *timestamppb.Timestamp {
ts, err := TimestampProto(time.Now())
if err != nil {
panic("ptypes: time.Now() out of Timestamp range")
}
return ts
} | TimestampNow returns a google.protobuf.Timestamp for the current time.
Deprecated: Call the timestamppb.Now function instead. | TimestampNow | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/ptypes/timestamp.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/ptypes/timestamp.go | Apache-2.0 |
func TimestampProto(t time.Time) (*timestamppb.Timestamp, error) {
ts := ×tamppb.Timestamp{
Seconds: t.Unix(),
Nanos: int32(t.Nanosecond()),
}
if err := validateTimestamp(ts); err != nil {
return nil, err
}
return ts, nil
} | TimestampProto converts the time.Time to a google.protobuf.Timestamp proto.
It returns an error if the resulting Timestamp is invalid.
Deprecated: Call the timestamppb.New function instead. | TimestampProto | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/ptypes/timestamp.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/ptypes/timestamp.go | Apache-2.0 |
func TimestampString(ts *timestamppb.Timestamp) string {
t, err := Timestamp(ts)
if err != nil {
return fmt.Sprintf("(%v)", err)
}
return t.Format(time.RFC3339Nano)
} | TimestampString returns the RFC 3339 string for valid Timestamps.
For invalid Timestamps, it returns an error message in parentheses.
Deprecated: Call the ts.AsTime method instead,
followed by a call to the Format method on the time.Time value. | TimestampString | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/ptypes/timestamp.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/ptypes/timestamp.go | Apache-2.0 |
func validateTimestamp(ts *timestamppb.Timestamp) error {
if ts == nil {
return errors.New("timestamp: nil Timestamp")
}
if ts.Seconds < minValidSeconds {
return fmt.Errorf("timestamp: %v before 0001-01-01", ts)
}
if ts.Seconds >= maxValidSeconds {
return fmt.Errorf("timestamp: %v after 10000-01-01", ts)
}
if ts.Nanos < 0 || ts.Nanos >= 1e9 {
return fmt.Errorf("timestamp: %v: nanos not in range [0, 1e9)", ts)
}
return nil
} | validateTimestamp determines whether a Timestamp is valid.
A valid timestamp represents a time in the range [0001-01-01, 10000-01-01)
and has a Nanos field in the range [0, 1e9).
If the Timestamp is valid, validateTimestamp returns nil.
Otherwise, it returns an error that describes the problem.
Every valid Timestamp can be represented by a time.Time,
but the converse is not true. | validateTimestamp | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/ptypes/timestamp.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/ptypes/timestamp.go | Apache-2.0 |
func AnyMessageName(any *anypb.Any) (string, error) {
name, err := anyMessageName(any)
return string(name), err
} | AnyMessageName returns the message name contained in an anypb.Any message.
Most type assertions should use the Is function instead.
Deprecated: Call the any.MessageName method instead. | AnyMessageName | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/ptypes/any.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/ptypes/any.go | Apache-2.0 |
func MarshalAny(m proto.Message) (*anypb.Any, error) {
switch dm := m.(type) {
case DynamicAny:
m = dm.Message
case *DynamicAny:
if dm == nil {
return nil, proto.ErrNil
}
m = dm.Message
} | MarshalAny marshals the given message m into an anypb.Any message.
Deprecated: Call the anypb.New function instead. | MarshalAny | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/ptypes/any.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/ptypes/any.go | Apache-2.0 |
func Empty(any *anypb.Any) (proto.Message, error) {
name, err := anyMessageName(any)
if err != nil {
return nil, err
}
mt, err := protoregistry.GlobalTypes.FindMessageByName(name)
if err != nil {
return nil, err
}
return proto.MessageV1(mt.New().Interface()), nil
} | Empty returns a new message of the type specified in an anypb.Any message.
It returns protoregistry.NotFound if the corresponding message type could not
be resolved in the global registry.
Deprecated: Use protoregistry.GlobalTypes.FindMessageByName instead
to resolve the message name and create a new instance of it. | Empty | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/ptypes/any.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/ptypes/any.go | Apache-2.0 |
func UnmarshalAny(any *anypb.Any, m proto.Message) error {
if dm, ok := m.(*DynamicAny); ok {
if dm.Message == nil {
var err error
dm.Message, err = Empty(any)
if err != nil {
return err
}
}
m = dm.Message
}
anyName, err := AnyMessageName(any)
if err != nil {
return err
}
msgName := proto.MessageName(m)
if anyName != msgName {
return fmt.Errorf("mismatched message type: got %q want %q", anyName, msgName)
}
return proto.Unmarshal(any.Value, m)
} | UnmarshalAny unmarshals the encoded value contained in the anypb.Any message
into the provided message m. It returns an error if the target message
does not match the type in the Any message or if an unmarshal error occurs.
The target message m may be a *DynamicAny message. If the underlying message
type could not be resolved, then this returns protoregistry.NotFound.
Deprecated: Call the any.UnmarshalTo method instead. | UnmarshalAny | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/ptypes/any.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/ptypes/any.go | Apache-2.0 |
func Is(any *anypb.Any, m proto.Message) bool {
if any == nil || m == nil {
return false
}
name := proto.MessageName(m)
if !strings.HasSuffix(any.TypeUrl, name) {
return false
}
return len(any.TypeUrl) == len(name) || any.TypeUrl[len(any.TypeUrl)-len(name)-1] == '/'
} | Is reports whether the Any message contains a message of the specified type.
Deprecated: Call the any.MessageIs method instead. | Is | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/ptypes/any.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/ptypes/any.go | Apache-2.0 |
func Duration(dur *durationpb.Duration) (time.Duration, error) {
if err := validateDuration(dur); err != nil {
return 0, err
}
d := time.Duration(dur.Seconds) * time.Second
if int64(d/time.Second) != dur.Seconds {
return 0, fmt.Errorf("duration: %v is out of range for time.Duration", dur)
}
if dur.Nanos != 0 {
d += time.Duration(dur.Nanos) * time.Nanosecond
if (d < 0) != (dur.Nanos < 0) {
return 0, fmt.Errorf("duration: %v is out of range for time.Duration", dur)
}
}
return d, nil
} | Duration converts a durationpb.Duration to a time.Duration.
Duration returns an error if dur is invalid or overflows a time.Duration.
Deprecated: Call the dur.AsDuration and dur.CheckValid methods instead. | Duration | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/ptypes/duration.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/ptypes/duration.go | Apache-2.0 |
func DurationProto(d time.Duration) *durationpb.Duration {
nanos := d.Nanoseconds()
secs := nanos / 1e9
nanos -= secs * 1e9
return &durationpb.Duration{
Seconds: int64(secs),
Nanos: int32(nanos),
}
} | DurationProto converts a time.Duration to a durationpb.Duration.
Deprecated: Call the durationpb.New function instead. | DurationProto | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/ptypes/duration.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/ptypes/duration.go | Apache-2.0 |
func validateDuration(dur *durationpb.Duration) error {
if dur == nil {
return errors.New("duration: nil Duration")
}
if dur.Seconds < minSeconds || dur.Seconds > maxSeconds {
return fmt.Errorf("duration: %v: seconds out of range", dur)
}
if dur.Nanos <= -1e9 || dur.Nanos >= 1e9 {
return fmt.Errorf("duration: %v: nanos out of range", dur)
}
// Seconds and Nanos must have the same sign, unless d.Nanos is zero.
if (dur.Seconds < 0 && dur.Nanos > 0) || (dur.Seconds > 0 && dur.Nanos < 0) {
return fmt.Errorf("duration: %v: seconds and nanos have different signs", dur)
}
return nil
} | validateDuration determines whether the durationpb.Duration is valid
according to the definition in google/protobuf/duration.proto.
A valid durpb.Duration may still be too large to fit into a time.Duration
Note that the range of durationpb.Duration is about 10,000 years,
while the range of time.Duration is about 290 years. | validateDuration | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/ptypes/duration.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/ptypes/duration.go | Apache-2.0 |
func Size(m Message) int {
if m == nil {
return 0
}
mi := MessageV2(m)
return protoV2.Size(mi)
} | Size returns the size in bytes of the wire-format encoding of m. | Size | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/wire.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/wire.go | Apache-2.0 |
func Marshal(m Message) ([]byte, error) {
b, err := marshalAppend(nil, m, false)
if b == nil {
b = zeroBytes
}
return b, err
} | Marshal returns the wire-format encoding of m. | Marshal | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/wire.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/wire.go | Apache-2.0 |
func Unmarshal(b []byte, m Message) error {
m.Reset()
return UnmarshalMerge(b, m)
} | Unmarshal parses a wire-format message in b and places the decoded results in m.
Unmarshal resets m before starting to unmarshal, so any existing data in m is always
removed. Use UnmarshalMerge to preserve and append to existing data. | Unmarshal | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/wire.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/wire.go | Apache-2.0 |
func UnmarshalMerge(b []byte, m Message) error {
mi := MessageV2(m)
out, err := protoV2.UnmarshalOptions{
AllowPartial: true,
Merge: true,
}.UnmarshalState(protoiface.UnmarshalInput{
Buf: b,
Message: mi.ProtoReflect(),
})
if err != nil {
return err
}
if out.Flags&protoiface.UnmarshalInitialized > 0 {
return nil
}
return checkRequiredNotSet(mi)
} | UnmarshalMerge parses a wire-format message in b and places the decoded results in m. | UnmarshalMerge | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/wire.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/wire.go | Apache-2.0 |
func HasExtension(m Message, xt *ExtensionDesc) (has bool) {
mr := MessageReflect(m)
if mr == nil || !mr.IsValid() {
return false
}
// Check whether any populated known field matches the field number.
xtd := xt.TypeDescriptor()
if isValidExtension(mr.Descriptor(), xtd) {
has = mr.Has(xtd)
} else {
mr.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool {
has = int32(fd.Number()) == xt.Field
return !has
})
}
// Check whether any unknown field matches the field number.
for b := mr.GetUnknown(); !has && len(b) > 0; {
num, _, n := protowire.ConsumeField(b)
has = int32(num) == xt.Field
b = b[n:]
}
return has
} | HasExtension reports whether the extension field is present in m
either as an explicitly populated field or as an unknown field. | HasExtension | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/extensions.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/extensions.go | Apache-2.0 |
func ClearExtension(m Message, xt *ExtensionDesc) {
mr := MessageReflect(m)
if mr == nil || !mr.IsValid() {
return
}
xtd := xt.TypeDescriptor()
if isValidExtension(mr.Descriptor(), xtd) {
mr.Clear(xtd)
} else {
mr.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool {
if int32(fd.Number()) == xt.Field {
mr.Clear(fd)
return false
}
return true
})
}
clearUnknown(mr, fieldNum(xt.Field))
} | ClearExtension removes the extension field from m
either as an explicitly populated field or as an unknown field. | ClearExtension | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/extensions.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/extensions.go | Apache-2.0 |
func ClearAllExtensions(m Message) {
mr := MessageReflect(m)
if mr == nil || !mr.IsValid() {
return
}
mr.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool {
if fd.IsExtension() {
mr.Clear(fd)
}
return true
})
clearUnknown(mr, mr.Descriptor().ExtensionRanges())
} | ClearAllExtensions clears all extensions from m.
This includes populated fields and unknown fields in the extension range. | ClearAllExtensions | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/extensions.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/extensions.go | Apache-2.0 |
func GetExtension(m Message, xt *ExtensionDesc) (interface{}, error) {
mr := MessageReflect(m)
if mr == nil || !mr.IsValid() || mr.Descriptor().ExtensionRanges().Len() == 0 {
return nil, errNotExtendable
}
// Retrieve the unknown fields for this extension field.
var bo protoreflect.RawFields
for bi := mr.GetUnknown(); len(bi) > 0; {
num, _, n := protowire.ConsumeField(bi)
if int32(num) == xt.Field {
bo = append(bo, bi[:n]...)
}
bi = bi[n:]
}
// For type incomplete descriptors, only retrieve the unknown fields.
if xt.ExtensionType == nil {
return []byte(bo), nil
}
// If the extension field only exists as unknown fields, unmarshal it.
// This is rarely done since proto.Unmarshal eagerly unmarshals extensions.
xtd := xt.TypeDescriptor()
if !isValidExtension(mr.Descriptor(), xtd) {
return nil, fmt.Errorf("proto: bad extended type; %T does not extend %T", xt.ExtendedType, m)
}
if !mr.Has(xtd) && len(bo) > 0 {
m2 := mr.New()
if err := (proto.UnmarshalOptions{
Resolver: extensionResolver{xt},
}.Unmarshal(bo, m2.Interface())); err != nil {
return nil, err
}
if m2.Has(xtd) {
mr.Set(xtd, m2.Get(xtd))
clearUnknown(mr, fieldNum(xt.Field))
}
}
// Check whether the message has the extension field set or a default.
var pv protoreflect.Value
switch {
case mr.Has(xtd):
pv = mr.Get(xtd)
case xtd.HasDefault():
pv = xtd.Default()
default:
return nil, ErrMissingExtension
}
v := xt.InterfaceOf(pv)
rv := reflect.ValueOf(v)
if isScalarKind(rv.Kind()) {
rv2 := reflect.New(rv.Type())
rv2.Elem().Set(rv)
v = rv2.Interface()
}
return v, nil
} | GetExtension retrieves a proto2 extended field from m.
If the descriptor is type complete (i.e., ExtensionDesc.ExtensionType is non-nil),
then GetExtension parses the encoded field and returns a Go value of the specified type.
If the field is not present, then the default value is returned (if one is specified),
otherwise ErrMissingExtension is reported.
If the descriptor is type incomplete (i.e., ExtensionDesc.ExtensionType is nil),
then GetExtension returns the raw encoded bytes for the extension field. | GetExtension | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/extensions.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/extensions.go | Apache-2.0 |
func GetExtensions(m Message, xts []*ExtensionDesc) ([]interface{}, error) {
mr := MessageReflect(m)
if mr == nil || !mr.IsValid() {
return nil, errNotExtendable
}
vs := make([]interface{}, len(xts))
for i, xt := range xts {
v, err := GetExtension(m, xt)
if err != nil {
if err == ErrMissingExtension {
continue
}
return vs, err
}
vs[i] = v
}
return vs, nil
} | GetExtensions returns a list of the extensions values present in m,
corresponding with the provided list of extension descriptors, xts.
If an extension is missing in m, the corresponding value is nil. | GetExtensions | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/extensions.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/extensions.go | Apache-2.0 |
func SetExtension(m Message, xt *ExtensionDesc, v interface{}) error {
mr := MessageReflect(m)
if mr == nil || !mr.IsValid() || mr.Descriptor().ExtensionRanges().Len() == 0 {
return errNotExtendable
}
rv := reflect.ValueOf(v)
if reflect.TypeOf(v) != reflect.TypeOf(xt.ExtensionType) {
return fmt.Errorf("proto: bad extension value type. got: %T, want: %T", v, xt.ExtensionType)
}
if rv.Kind() == reflect.Ptr {
if rv.IsNil() {
return fmt.Errorf("proto: SetExtension called with nil value of type %T", v)
}
if isScalarKind(rv.Elem().Kind()) {
v = rv.Elem().Interface()
}
}
xtd := xt.TypeDescriptor()
if !isValidExtension(mr.Descriptor(), xtd) {
return fmt.Errorf("proto: bad extended type; %T does not extend %T", xt.ExtendedType, m)
}
mr.Set(xtd, xt.ValueOf(v))
clearUnknown(mr, fieldNum(xt.Field))
return nil
} | SetExtension sets an extension field in m to the provided value. | SetExtension | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/extensions.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/extensions.go | Apache-2.0 |
func SetRawExtension(m Message, fnum int32, b []byte) {
mr := MessageReflect(m)
if mr == nil || !mr.IsValid() {
return
}
// Verify that the raw field is valid.
for b0 := b; len(b0) > 0; {
num, _, n := protowire.ConsumeField(b0)
if int32(num) != fnum {
panic(fmt.Sprintf("mismatching field number: got %d, want %d", num, fnum))
}
b0 = b0[n:]
}
ClearExtension(m, &ExtensionDesc{Field: fnum})
mr.SetUnknown(append(mr.GetUnknown(), b...))
} | SetRawExtension inserts b into the unknown fields of m.
Deprecated: Use Message.ProtoReflect.SetUnknown instead. | SetRawExtension | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/extensions.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/extensions.go | Apache-2.0 |
func ExtensionDescs(m Message) ([]*ExtensionDesc, error) {
mr := MessageReflect(m)
if mr == nil || !mr.IsValid() || mr.Descriptor().ExtensionRanges().Len() == 0 {
return nil, errNotExtendable
}
// Collect a set of known extension descriptors.
extDescs := make(map[protoreflect.FieldNumber]*ExtensionDesc)
mr.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
if fd.IsExtension() {
xt := fd.(protoreflect.ExtensionTypeDescriptor)
if xd, ok := xt.Type().(*ExtensionDesc); ok {
extDescs[fd.Number()] = xd
}
}
return true
})
// Collect a set of unknown extension descriptors.
extRanges := mr.Descriptor().ExtensionRanges()
for b := mr.GetUnknown(); len(b) > 0; {
num, _, n := protowire.ConsumeField(b)
if extRanges.Has(num) && extDescs[num] == nil {
extDescs[num] = nil
}
b = b[n:]
}
// Transpose the set of descriptors into a list.
var xts []*ExtensionDesc
for num, xt := range extDescs {
if xt == nil {
xt = &ExtensionDesc{Field: int32(num)}
}
xts = append(xts, xt)
}
return xts, nil
} | ExtensionDescs returns a list of extension descriptors found in m,
containing descriptors for both populated extension fields in m and
also unknown fields of m that are in the extension range.
For the later case, an type incomplete descriptor is provided where only
the ExtensionDesc.Field field is populated.
The order of the extension descriptors is undefined. | ExtensionDescs | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/extensions.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/extensions.go | Apache-2.0 |
func isValidExtension(md protoreflect.MessageDescriptor, xtd protoreflect.ExtensionTypeDescriptor) bool {
return xtd.ContainingMessage() == md && md.ExtensionRanges().Has(xtd.Number())
} | isValidExtension reports whether xtd is a valid extension descriptor for md. | isValidExtension | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/extensions.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/extensions.go | Apache-2.0 |
func isScalarKind(k reflect.Kind) bool {
switch k {
case reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String:
return true
default:
return false
}
} | isScalarKind reports whether k is a protobuf scalar kind (except bytes).
This function exists for historical reasons since the representation of
scalars differs between v1 and v2, where v1 uses *T and v2 uses T. | isScalarKind | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/extensions.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/extensions.go | Apache-2.0 |
func clearUnknown(m protoreflect.Message, remover interface {
Has(protoreflect.FieldNumber) bool
}) {
var bo protoreflect.RawFields
for bi := m.GetUnknown(); len(bi) > 0; {
num, _, n := protowire.ConsumeField(bi)
if !remover.Has(num) {
bo = append(bo, bi[:n]...)
}
bi = bi[n:]
}
if bi := m.GetUnknown(); len(bi) != len(bo) {
m.SetUnknown(bo)
}
} | clearUnknown removes unknown fields from m where remover.Has reports true. | clearUnknown | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/extensions.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/extensions.go | Apache-2.0 |
func EncodeVarint(v uint64) []byte {
return protowire.AppendVarint(nil, v)
} | EncodeVarint returns the varint encoded bytes of v. | EncodeVarint | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func SizeVarint(v uint64) int {
return protowire.SizeVarint(v)
} | SizeVarint returns the length of the varint encoded bytes of v.
This is equal to len(EncodeVarint(v)). | SizeVarint | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func DecodeVarint(b []byte) (uint64, int) {
v, n := protowire.ConsumeVarint(b)
if n < 0 {
return 0, 0
}
return v, n
} | DecodeVarint parses a varint encoded integer from b,
returning the integer value and the length of the varint.
It returns (0, 0) if there is a parse error. | DecodeVarint | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func NewBuffer(buf []byte) *Buffer {
return &Buffer{buf: buf}
} | NewBuffer allocates a new Buffer initialized with buf,
where the contents of buf are considered the unread portion of the buffer. | NewBuffer | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func (b *Buffer) SetDeterministic(deterministic bool) {
b.deterministic = deterministic
} | SetDeterministic specifies whether to use deterministic serialization.
Deterministic serialization guarantees that for a given binary, equal
messages will always be serialized to the same bytes. This implies:
- Repeated serialization of a message will return the same bytes.
- Different processes of the same binary (which may be executing on
different machines) will serialize equal messages to the same bytes.
Note that the deterministic serialization is NOT canonical across
languages. It is not guaranteed to remain stable over time. It is unstable
across different builds with schema changes due to unknown fields.
Users who need canonical serialization (e.g., persistent storage in a
canonical form, fingerprinting, etc.) should define their own
canonicalization specification and implement their own serializer rather
than relying on this API.
If deterministic serialization is requested, map entries will be sorted
by keys in lexographical order. This is an implementation detail and
subject to change. | SetDeterministic | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func (b *Buffer) SetBuf(buf []byte) {
b.buf = buf
b.idx = 0
} | SetBuf sets buf as the internal buffer,
where the contents of buf are considered the unread portion of the buffer. | SetBuf | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func (b *Buffer) Reset() {
b.buf = b.buf[:0]
b.idx = 0
} | Reset clears the internal buffer of all written and unread data. | Reset | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func (b *Buffer) Bytes() []byte {
return b.buf
} | Bytes returns the internal buffer. | Bytes | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func (b *Buffer) Unread() []byte {
return b.buf[b.idx:]
} | Unread returns the unread portion of the buffer. | Unread | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func (b *Buffer) Marshal(m Message) error {
var err error
b.buf, err = marshalAppend(b.buf, m, b.deterministic)
return err
} | Marshal appends the wire-format encoding of m to the buffer. | Marshal | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func (b *Buffer) Unmarshal(m Message) error {
err := UnmarshalMerge(b.Unread(), m)
b.idx = len(b.buf)
return err
} | Unmarshal parses the wire-format message in the buffer and
places the decoded results in m.
It does not reset m before unmarshaling. | Unmarshal | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func (*Buffer) DebugPrint(s string, b []byte) {
m := MessageReflect(new(unknownFields))
m.SetUnknown(b)
b, _ = prototext.MarshalOptions{AllowPartial: true, Indent: "\t"}.Marshal(m.Interface())
fmt.Printf("==== %s ====\n%s==== %s ====\n", s, b, s)
} | DebugPrint dumps the encoded bytes of b with a header and footer including s
to stdout. This is only intended for debugging. | DebugPrint | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func (b *Buffer) EncodeVarint(v uint64) error {
b.buf = protowire.AppendVarint(b.buf, v)
return nil
} | EncodeVarint appends an unsigned varint encoding to the buffer. | EncodeVarint | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func (b *Buffer) EncodeZigzag32(v uint64) error {
return b.EncodeVarint(uint64((uint32(v) << 1) ^ uint32((int32(v) >> 31))))
} | EncodeZigzag32 appends a 32-bit zig-zag varint encoding to the buffer. | EncodeZigzag32 | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func (b *Buffer) EncodeZigzag64(v uint64) error {
return b.EncodeVarint(uint64((uint64(v) << 1) ^ uint64((int64(v) >> 63))))
} | EncodeZigzag64 appends a 64-bit zig-zag varint encoding to the buffer. | EncodeZigzag64 | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func (b *Buffer) EncodeFixed32(v uint64) error {
b.buf = protowire.AppendFixed32(b.buf, uint32(v))
return nil
} | EncodeFixed32 appends a 32-bit little-endian integer to the buffer. | EncodeFixed32 | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func (b *Buffer) EncodeFixed64(v uint64) error {
b.buf = protowire.AppendFixed64(b.buf, uint64(v))
return nil
} | EncodeFixed64 appends a 64-bit little-endian integer to the buffer. | EncodeFixed64 | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func (b *Buffer) EncodeRawBytes(v []byte) error {
b.buf = protowire.AppendBytes(b.buf, v)
return nil
} | EncodeRawBytes appends a length-prefixed raw bytes to the buffer. | EncodeRawBytes | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func (b *Buffer) EncodeStringBytes(v string) error {
b.buf = protowire.AppendString(b.buf, v)
return nil
} | EncodeStringBytes appends a length-prefixed raw bytes to the buffer.
It does not validate whether v contains valid UTF-8. | EncodeStringBytes | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func (b *Buffer) EncodeMessage(m Message) error {
var err error
b.buf = protowire.AppendVarint(b.buf, uint64(Size(m)))
b.buf, err = marshalAppend(b.buf, m, b.deterministic)
return err
} | EncodeMessage appends a length-prefixed encoded message to the buffer. | EncodeMessage | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func (b *Buffer) DecodeVarint() (uint64, error) {
v, n := protowire.ConsumeVarint(b.buf[b.idx:])
if n < 0 {
return 0, protowire.ParseError(n)
}
b.idx += n
return uint64(v), nil
} | DecodeVarint consumes an encoded unsigned varint from the buffer. | DecodeVarint | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func (b *Buffer) DecodeZigzag32() (uint64, error) {
v, err := b.DecodeVarint()
if err != nil {
return 0, err
}
return uint64((uint32(v) >> 1) ^ uint32((int32(v&1)<<31)>>31)), nil
} | DecodeZigzag32 consumes an encoded 32-bit zig-zag varint from the buffer. | DecodeZigzag32 | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func (b *Buffer) DecodeZigzag64() (uint64, error) {
v, err := b.DecodeVarint()
if err != nil {
return 0, err
}
return uint64((uint64(v) >> 1) ^ uint64((int64(v&1)<<63)>>63)), nil
} | DecodeZigzag64 consumes an encoded 64-bit zig-zag varint from the buffer. | DecodeZigzag64 | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func (b *Buffer) DecodeFixed32() (uint64, error) {
v, n := protowire.ConsumeFixed32(b.buf[b.idx:])
if n < 0 {
return 0, protowire.ParseError(n)
}
b.idx += n
return uint64(v), nil
} | DecodeFixed32 consumes a 32-bit little-endian integer from the buffer. | DecodeFixed32 | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func (b *Buffer) DecodeFixed64() (uint64, error) {
v, n := protowire.ConsumeFixed64(b.buf[b.idx:])
if n < 0 {
return 0, protowire.ParseError(n)
}
b.idx += n
return uint64(v), nil
} | DecodeFixed64 consumes a 64-bit little-endian integer from the buffer. | DecodeFixed64 | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func (b *Buffer) DecodeRawBytes(alloc bool) ([]byte, error) {
v, n := protowire.ConsumeBytes(b.buf[b.idx:])
if n < 0 {
return nil, protowire.ParseError(n)
}
b.idx += n
if alloc {
v = append([]byte(nil), v...)
}
return v, nil
} | DecodeRawBytes consumes a length-prefixed raw bytes from the buffer.
If alloc is specified, it returns a copy the raw bytes
rather than a sub-slice of the buffer. | DecodeRawBytes | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func (b *Buffer) DecodeStringBytes() (string, error) {
v, n := protowire.ConsumeString(b.buf[b.idx:])
if n < 0 {
return "", protowire.ParseError(n)
}
b.idx += n
return v, nil
} | DecodeStringBytes consumes a length-prefixed raw bytes from the buffer.
It does not validate whether the raw bytes contain valid UTF-8. | DecodeStringBytes | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func (b *Buffer) DecodeMessage(m Message) error {
v, err := b.DecodeRawBytes(false)
if err != nil {
return err
}
return UnmarshalMerge(v, m)
} | DecodeMessage consumes a length-prefixed message from the buffer.
It does not reset m before unmarshaling. | DecodeMessage | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func (b *Buffer) DecodeGroup(m Message) error {
v, n, err := consumeGroup(b.buf[b.idx:])
if err != nil {
return err
}
b.idx += n
return UnmarshalMerge(v, m)
} | DecodeGroup consumes a message group from the buffer.
It assumes that the start group marker has already been consumed and
consumes all bytes until (and including the end group marker).
It does not reset m before unmarshaling. | DecodeGroup | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func consumeGroup(b []byte) ([]byte, int, error) {
b0 := b
depth := 1 // assume this follows a start group marker
for {
_, wtyp, tagLen := protowire.ConsumeTag(b)
if tagLen < 0 {
return nil, 0, protowire.ParseError(tagLen)
}
b = b[tagLen:]
var valLen int
switch wtyp {
case protowire.VarintType:
_, valLen = protowire.ConsumeVarint(b)
case protowire.Fixed32Type:
_, valLen = protowire.ConsumeFixed32(b)
case protowire.Fixed64Type:
_, valLen = protowire.ConsumeFixed64(b)
case protowire.BytesType:
_, valLen = protowire.ConsumeBytes(b)
case protowire.StartGroupType:
depth++
case protowire.EndGroupType:
depth--
default:
return nil, 0, errors.New("proto: cannot parse reserved wire type")
}
if valLen < 0 {
return nil, 0, protowire.ParseError(valLen)
}
b = b[valLen:]
if depth == 0 {
return b0[:len(b0)-len(b)-tagLen], len(b0) - len(b), nil
}
}
} | consumeGroup parses b until it finds an end group marker, returning
the raw bytes of the message (excluding the end group marker) and the
the total length of the message (including the end group marker). | consumeGroup | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/buffer.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/buffer.go | Apache-2.0 |
func SetDefaults(m Message) {
if m != nil {
setDefaults(MessageReflect(m))
}
} | SetDefaults sets unpopulated scalar fields to their default values.
Fields within a oneof are not set even if they have a default value.
SetDefaults is recursively called upon any populated message fields. | SetDefaults | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/defaults.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/defaults.go | Apache-2.0 |
func Bool(v bool) *bool { return &v } | Bool stores v in a new bool value and returns a pointer to it. | Bool | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/wrappers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/wrappers.go | Apache-2.0 |
func Int(v int) *int32 { return Int32(int32(v)) } | Int stores v in a new int32 value and returns a pointer to it.
Deprecated: Use Int32 instead. | Int | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/wrappers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/wrappers.go | Apache-2.0 |
func Int32(v int32) *int32 { return &v } | Int32 stores v in a new int32 value and returns a pointer to it. | Int32 | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/wrappers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/wrappers.go | Apache-2.0 |
func Int64(v int64) *int64 { return &v } | Int64 stores v in a new int64 value and returns a pointer to it. | Int64 | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/wrappers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/wrappers.go | Apache-2.0 |
func Uint32(v uint32) *uint32 { return &v } | Uint32 stores v in a new uint32 value and returns a pointer to it. | Uint32 | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/wrappers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/wrappers.go | Apache-2.0 |
func Uint64(v uint64) *uint64 { return &v } | Uint64 stores v in a new uint64 value and returns a pointer to it. | Uint64 | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/wrappers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/wrappers.go | Apache-2.0 |
func Float32(v float32) *float32 { return &v } | Float32 stores v in a new float32 value and returns a pointer to it. | Float32 | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/wrappers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/wrappers.go | Apache-2.0 |
func Float64(v float64) *float64 { return &v } | Float64 stores v in a new float64 value and returns a pointer to it. | Float64 | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/wrappers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/wrappers.go | Apache-2.0 |
func String(v string) *string { return &v } | String stores v in a new string value and returns a pointer to it. | String | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/wrappers.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/wrappers.go | Apache-2.0 |
func (p *Properties) String() string {
s := p.Wire
s += "," + strconv.Itoa(p.Tag)
if p.Required {
s += ",req"
}
if p.Optional {
s += ",opt"
}
if p.Repeated {
s += ",rep"
}
if p.Packed {
s += ",packed"
}
s += ",name=" + p.OrigName
if p.JSONName != "" {
s += ",json=" + p.JSONName
}
if len(p.Enum) > 0 {
s += ",enum=" + p.Enum
}
if len(p.Weak) > 0 {
s += ",weak=" + p.Weak
}
if p.Proto3 {
s += ",proto3"
}
if p.Oneof {
s += ",oneof"
}
if p.HasDefault {
s += ",def=" + p.Default
}
return s
} | String formats the properties in the protobuf struct field tag style. | String | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/properties.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/properties.go | Apache-2.0 |
func (p *Properties) Parse(tag string) {
// For example: "bytes,49,opt,name=foo,def=hello!"
for len(tag) > 0 {
i := strings.IndexByte(tag, ',')
if i < 0 {
i = len(tag)
}
switch s := tag[:i]; {
case strings.HasPrefix(s, "name="):
p.OrigName = s[len("name="):]
case strings.HasPrefix(s, "json="):
p.JSONName = s[len("json="):]
case strings.HasPrefix(s, "enum="):
p.Enum = s[len("enum="):]
case strings.HasPrefix(s, "weak="):
p.Weak = s[len("weak="):]
case strings.Trim(s, "0123456789") == "":
n, _ := strconv.ParseUint(s, 10, 32)
p.Tag = int(n)
case s == "opt":
p.Optional = true
case s == "req":
p.Required = true
case s == "rep":
p.Repeated = true
case s == "varint" || s == "zigzag32" || s == "zigzag64":
p.Wire = s
p.WireType = WireVarint
case s == "fixed32":
p.Wire = s
p.WireType = WireFixed32
case s == "fixed64":
p.Wire = s
p.WireType = WireFixed64
case s == "bytes":
p.Wire = s
p.WireType = WireBytes
case s == "group":
p.Wire = s
p.WireType = WireStartGroup
case s == "packed":
p.Packed = true
case s == "proto3":
p.Proto3 = true
case s == "oneof":
p.Oneof = true
case strings.HasPrefix(s, "def="):
// The default tag is special in that everything afterwards is the
// default regardless of the presence of commas.
p.HasDefault = true
p.Default, i = tag[len("def="):], len(tag)
}
tag = strings.TrimPrefix(tag[i:], ",")
}
} | Parse populates p by parsing a string in the protobuf struct field tag style. | Parse | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/properties.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/properties.go | Apache-2.0 |
func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) {
p.Name = name
p.OrigName = name
if tag == "" {
return
}
p.Parse(tag)
if typ != nil && typ.Kind() == reflect.Map {
p.MapKeyProp = new(Properties)
p.MapKeyProp.Init(nil, "Key", f.Tag.Get("protobuf_key"), nil)
p.MapValProp = new(Properties)
p.MapValProp.Init(nil, "Value", f.Tag.Get("protobuf_val"), nil)
}
} | Init populates the properties from a protocol buffer struct tag.
Deprecated: Do not use. | Init | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/properties.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/properties.go | Apache-2.0 |
func GetProperties(t reflect.Type) *StructProperties {
if p, ok := propertiesCache.Load(t); ok {
return p.(*StructProperties)
}
p, _ := propertiesCache.LoadOrStore(t, newProperties(t))
return p.(*StructProperties)
} | GetProperties returns the list of properties for the type represented by t,
which must be a generated protocol buffer message in the open-struct API,
where protobuf message fields are represented by exported Go struct fields.
Deprecated: Use protobuf reflection instead. | GetProperties | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/properties.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/properties.go | Apache-2.0 |
func UnmarshalText(s string, m Message) error {
if u, ok := m.(encoding.TextUnmarshaler); ok {
return u.UnmarshalText([]byte(s))
}
m.Reset()
mi := MessageV2(m)
if wrapTextUnmarshalV2 {
err := prototext.UnmarshalOptions{
AllowPartial: true,
}.Unmarshal([]byte(s), mi)
if err != nil {
return &ParseError{Message: err.Error()}
}
return checkRequiredNotSet(mi)
} else {
if err := newTextParser(s).unmarshalMessage(mi.ProtoReflect(), ""); err != nil {
return err
}
return checkRequiredNotSet(mi)
}
} | UnmarshalText parses a proto text formatted string into m. | UnmarshalText | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/text_decode.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/text_decode.go | Apache-2.0 |
func (p *textParser) checkForColon(fd protoreflect.FieldDescriptor) *ParseError {
tok := p.next()
if tok.err != nil {
return tok.err
}
if tok.value != ":" {
if fd.Message() == nil {
return p.errorf("expected ':', found %q", tok.value)
}
p.back()
}
return nil
} | Consume a ':' from the input stream (if the next token is a colon),
returning an error if a colon is needed but not present. | checkForColon | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/text_decode.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/text_decode.go | Apache-2.0 |
func (p *textParser) consumeExtensionOrAnyName() (string, error) {
tok := p.next()
if tok.err != nil {
return "", tok.err
}
// If extension name or type url is quoted, it's a single token.
if len(tok.value) > 2 && isQuote(tok.value[0]) && tok.value[len(tok.value)-1] == tok.value[0] {
name, err := unquoteC(tok.value[1:len(tok.value)-1], rune(tok.value[0]))
if err != nil {
return "", err
}
return name, p.consumeToken("]")
}
// Consume everything up to "]"
var parts []string
for tok.value != "]" {
parts = append(parts, tok.value)
tok = p.next()
if tok.err != nil {
return "", p.errorf("unrecognized type_url or extension name: %s", tok.err)
}
if p.done && tok.value != "]" {
return "", p.errorf("unclosed type_url or extension name")
}
}
return strings.Join(parts, ""), nil
} | consumeExtensionOrAnyName consumes an extension name or an Any type URL and
the following ']'. It returns the name or URL consumed. | consumeExtensionOrAnyName | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/text_decode.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/text_decode.go | Apache-2.0 |
func (p *textParser) consumeOptionalSeparator() error {
tok := p.next()
if tok.err != nil {
return tok.err
}
if tok.value != ";" && tok.value != "," {
p.back()
}
return nil
} | consumeOptionalSeparator consumes an optional semicolon or comma.
It is used in unmarshalMessage to provide backward compatibility. | consumeOptionalSeparator | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/text_decode.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/text_decode.go | Apache-2.0 |
func (p *textParser) back() { p.backed = true } | Back off the parser by one token. Can only be done between calls to next().
It makes the next advance() a no-op. | back | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/text_decode.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/text_decode.go | Apache-2.0 |
func (p *textParser) next() *token {
if p.backed || p.done {
p.backed = false
return &p.cur
}
p.advance()
if p.done {
p.cur.value = ""
} else if len(p.cur.value) > 0 && isQuote(p.cur.value[0]) {
// Look for multiple quoted strings separated by whitespace,
// and concatenate them.
cat := p.cur
for {
p.skipWhitespace()
if p.done || !isQuote(p.s[0]) {
break
}
p.advance()
if p.cur.err != nil {
return &p.cur
}
cat.value += " " + p.cur.value
cat.unquoted += p.cur.unquoted
}
p.done = false // parser may have seen EOF, but we want to return cat
p.cur = cat
}
return &p.cur
} | Advances the parser and returns the new current token. | next | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/text_decode.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/text_decode.go | Apache-2.0 |
func MessageV1(m GeneratedMessage) protoiface.MessageV1 {
return protoimpl.X.ProtoMessageV1Of(m)
} | MessageV1 converts either a v1 or v2 message to a v1 message.
It returns nil if m is nil. | MessageV1 | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/proto.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/proto.go | Apache-2.0 |
func MessageV2(m GeneratedMessage) protoV2.Message {
return protoimpl.X.ProtoMessageV2Of(m)
} | MessageV2 converts either a v1 or v2 message to a v2 message.
It returns nil if m is nil. | MessageV2 | go | k8snetworkplumbingwg/multus-cni | vendor/github.com/golang/protobuf/proto/proto.go | https://github.com/k8snetworkplumbingwg/multus-cni/blob/master/vendor/github.com/golang/protobuf/proto/proto.go | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.