mirror of
https://github.com/prometheus/prometheus.git
synced 2025-07-04 11:33:25 +00:00
Use index singleton and relocate encoder package.
This commit is contained in:
parent
b9928266b5
commit
720442d3d3
8 changed files with 51 additions and 62 deletions
19
coding/protocol_buffer.go
Normal file
19
coding/protocol_buffer.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
package coding
|
||||
|
||||
import (
|
||||
"code.google.com/p/goprotobuf/proto"
|
||||
)
|
||||
|
||||
type ProtocolBufferEncoder struct {
|
||||
message proto.Message
|
||||
}
|
||||
|
||||
func (p *ProtocolBufferEncoder) Encode() ([]byte, error) {
|
||||
return proto.Marshal(p.message)
|
||||
}
|
||||
|
||||
func NewProtocolBufferEncoder(message proto.Message) *ProtocolBufferEncoder {
|
||||
return &ProtocolBufferEncoder{
|
||||
message: message,
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue