vendor/github.com/golang/protobuf/proto/lib.go
changeset 251 1c52a0eeb952
parent 242 2a9ec03fe5a1
equal deleted inserted replaced
250:c040f992052f 251:1c52a0eeb952
   339 	Reset()
   339 	Reset()
   340 	String() string
   340 	String() string
   341 	ProtoMessage()
   341 	ProtoMessage()
   342 }
   342 }
   343 
   343 
   344 // Stats records allocation details about the protocol buffer encoders
       
   345 // and decoders.  Useful for tuning the library itself.
       
   346 type Stats struct {
       
   347 	Emalloc uint64 // mallocs in encode
       
   348 	Dmalloc uint64 // mallocs in decode
       
   349 	Encode  uint64 // number of encodes
       
   350 	Decode  uint64 // number of decodes
       
   351 	Chit    uint64 // number of cache hits
       
   352 	Cmiss   uint64 // number of cache misses
       
   353 	Size    uint64 // number of sizes
       
   354 }
       
   355 
       
   356 // Set to true to enable stats collection.
       
   357 const collectStats = false
       
   358 
       
   359 var stats Stats
       
   360 
       
   361 // GetStats returns a copy of the global Stats structure.
       
   362 func GetStats() Stats { return stats }
       
   363 
       
   364 // A Buffer is a buffer manager for marshaling and unmarshaling
   344 // A Buffer is a buffer manager for marshaling and unmarshaling
   365 // protocol buffers.  It may be reused between invocations to
   345 // protocol buffers.  It may be reused between invocations to
   366 // reduce memory usage.  It is not necessary to use a Buffer;
   346 // reduce memory usage.  It is not necessary to use a Buffer;
   367 // the global functions Marshal and Unmarshal create a
   347 // the global functions Marshal and Unmarshal create a
   368 // temporary Buffer and are fine for most applications.
   348 // temporary Buffer and are fine for most applications.
   411 // canonical form, fingerprinting, etc.) should define their own
   391 // canonical form, fingerprinting, etc.) should define their own
   412 // canonicalization specification and implement their own serializer rather
   392 // canonicalization specification and implement their own serializer rather
   413 // than relying on this API.
   393 // than relying on this API.
   414 //
   394 //
   415 // If deterministic serialization is requested, map entries will be sorted
   395 // If deterministic serialization is requested, map entries will be sorted
   416 // by keys in lexographical order. This is an implementation detail and
   396 // by keys in lexicographical order. This is an implementation detail and
   417 // subject to change.
   397 // subject to change.
   418 func (p *Buffer) SetDeterministic(deterministic bool) {
   398 func (p *Buffer) SetDeterministic(deterministic bool) {
   419 	p.deterministic = deterministic
   399 	p.deterministic = deterministic
   420 }
   400 }
   421 
   401 
   958 		return v.String() == ""
   938 		return v.String() == ""
   959 	}
   939 	}
   960 	return false
   940 	return false
   961 }
   941 }
   962 
   942 
   963 // ProtoPackageIsVersion2 is referenced from generated protocol buffer files
   943 const (
   964 // to assert that that code is compatible with this version of the proto package.
   944 	// ProtoPackageIsVersion3 is referenced from generated protocol buffer files
   965 const ProtoPackageIsVersion2 = true
   945 	// to assert that that code is compatible with this version of the proto package.
   966 
   946 	ProtoPackageIsVersion3 = true
   967 // ProtoPackageIsVersion1 is referenced from generated protocol buffer files
   947 
   968 // to assert that that code is compatible with this version of the proto package.
   948 	// ProtoPackageIsVersion2 is referenced from generated protocol buffer files
   969 const ProtoPackageIsVersion1 = true
   949 	// to assert that that code is compatible with this version of the proto package.
       
   950 	ProtoPackageIsVersion2 = true
       
   951 
       
   952 	// ProtoPackageIsVersion1 is referenced from generated protocol buffer files
       
   953 	// to assert that that code is compatible with this version of the proto package.
       
   954 	ProtoPackageIsVersion1 = true
       
   955 )
   970 
   956 
   971 // InternalMessageInfo is a type used internally by generated .pb.go files.
   957 // InternalMessageInfo is a type used internally by generated .pb.go files.
   972 // This type is not intended to be used by non-generated code.
   958 // This type is not intended to be used by non-generated code.
   973 // This type is not subject to any compatibility guarantee.
   959 // This type is not subject to any compatibility guarantee.
   974 type InternalMessageInfo struct {
   960 type InternalMessageInfo struct {