prometheus/protocol_buffer_encoder.go

20 lines
356 B
Go
Raw Normal View History

2012-11-24 03:33:34 -08:00
package main
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,
}
}