示例#1
0
// Load deserializes this SampleKey from a DTO.
func (s *SampleKey) Load(d *dto.SampleKey) {
	f := &clientmodel.Fingerprint{}
	loadFingerprint(f, d.GetFingerprint())
	s.Fingerprint = f
	s.FirstTimestamp = indexable.DecodeTime(d.Timestamp)
	s.LastTimestamp = clientmodel.TimestampFromUnix(d.GetLastTimestamp())
	s.SampleCount = d.GetSampleCount()
}
示例#2
0
// Dump converts this SampleKey into a DTO for use in serialization purposes.
func (s *SampleKey) Dump(d *dto.SampleKey) {
	d.Reset()
	fp := &dto.Fingerprint{}
	dumpFingerprint(fp, s.Fingerprint)

	d.Fingerprint = fp
	d.Timestamp = indexable.EncodeTime(s.FirstTimestamp)
	d.LastTimestamp = proto.Int64(s.LastTimestamp.Unix())
	d.SampleCount = proto.Uint32(s.SampleCount)
}
示例#3
0
func (l *dtoSampleKeyList) Give(v *dto.SampleKey) bool {
	v.Reset()

	return l.l.Give(v)
}