import "github.com/cockroachdb/cockroach/pkg/util/protoutil"
clone.go clone.pb.go jsonpb_marshal.go marshal.go marshaler.go
var ( ErrInvalidLengthClone = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowClone = fmt.Errorf("proto: integer overflow") )
Interceptor will be called with every proto before it is marshaled. Interceptor is not safe to modify concurrently with calls to Marshal.
Marshal encodes pb into the wire format. It is used throughout the code base to intercept calls to proto.Marshal.
MarshalTo encodes pb into the wire format. It is used throughout the code base to intercept calls to pb.MarshalTo.
RegisterUnclonableType registers a type as not being allowed for cloning. This is an added hack on top of the hack to allow clients of this package to disallow cloning of certain types which are not recursed into due to how oneof is implemented. In particular it may be the case that one of the implementations of an interface is unclonable. In this case, due to the type (rather than value) traversal, we'd not discover this fact.
See the comment on Clone.
Unmarshal parses the protocol buffer representation in buf and places the decoded result in pb. If the struct underlying pb does not match the data in buf, the results can be unpredictable.
Unmarshal resets pb before starting to unmarshal, so any existing data in pb is always removed.
JSONPb is a gwruntime.Marshaler that uses github.com/gogo/protobuf/jsonpb.
ContentType implements gwruntime.Marshaler.
Delimiter implements gwruntime.Delimited.
Marshal implements gwruntime.Marshaler.
NewDecoder implements gwruntime.Marshaler.
NewEncoder implements gwruntime.Marshaler.
Unmarshal implements gwruntime.Marshaler.
type Message interface { proto.Message MarshalTo(data []byte) (int, error) Unmarshal(data []byte) error Size() int }
Message extends the proto.Message interface with the MarshalTo and Size methods we tell gogoproto to generate for us.
Clone uses proto.Clone to return a deep copy of pb. It panics if pb recursively contains any instances of types which are known to be unsupported by proto.Clone.
This function and its associated lint (see build/style_test.go) exist to ensure we do not attempt to proto.Clone types which are not supported by proto.Clone. This hackery is necessary because proto.Clone gives no direct indication that it has incompletely cloned a type; it merely logs to standard output (see https://github.com/golang/protobuf/blob/89238a3/proto/clone.go#L204).
The concrete case against which this is currently guarding may be resolved upstream, see https://github.com/gogo/protobuf/issues/147.
type ProtoPb struct{}
ProtoPb is a gwruntime.Marshaler that uses github.com/gogo/protobuf/proto.
ContentType implements gwruntime.Marshaler.
Delimiter implements gwruntime.Delimited.
Marshal implements gwruntime.Marshaler.
NewDecoder implements gwruntime.Marshaler.
NewEncoder implements gwruntime.Marshaler.
Unmarshal implements gwruntime.Marshaler.
type RecursiveAndUncloneable struct { R *RecursiveAndUncloneable `protobuf:"bytes,1,opt,name=r,proto3" json:"r,omitempty"` Uuid github_com_cockroachdb_cockroach_pkg_util_uuid.UUID `protobuf:"bytes,2,opt,name=uuid,proto3,customtype=github.com/cockroachdb/cockroach/pkg/util/uuid.UUID" json:"uuid"` }
func (*RecursiveAndUncloneable) Descriptor() ([]byte, []int)
func (m *RecursiveAndUncloneable) Marshal() (dAtA []byte, err error)
func (m *RecursiveAndUncloneable) MarshalTo(dAtA []byte) (int, error)
func (*RecursiveAndUncloneable) ProtoMessage()
func (m *RecursiveAndUncloneable) Reset()
func (m *RecursiveAndUncloneable) Size() (n int)
func (m *RecursiveAndUncloneable) String() string
func (m *RecursiveAndUncloneable) Unmarshal(dAtA []byte) error
func (m *RecursiveAndUncloneable) XXX_DiscardUnknown()
func (dst *RecursiveAndUncloneable) XXX_Merge(src proto.Message)
func (m *RecursiveAndUncloneable) XXX_Size() int
func (m *RecursiveAndUncloneable) XXX_Unmarshal(b []byte) error
Package protoutil imports 13 packages (graph) and is imported by 706 packages. Updated 2021-01-21. Refresh now. Tools for package owners.