Example #1
0
func (uf UniqueFilter) Filter(msg parse.Message) bool {
	checksum := msg.Checksum()
	mid := uint(msg.MeterID())

	if val, ok := uf[mid]; ok && bytes.Compare(val, checksum) == 0 {
		return false
	}

	uf[mid] = make([]byte, len(checksum))
	copy(uf[mid], checksum)
	return true
}
Example #2
0
func (m MeterTypeFilter) Filter(msg parse.Message) bool {
	return m.UintMap[uint(msg.MeterType())]
}