dedup

package
v0.0.0-...-b8a1a0e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ENTRY_TIMEOUT = 100 * time.Millisecond

	// 哈希表大小限制
	HASH_TABLE_SIZE_BIT_OFFSET = 17                              // 必须大于等于15
	HASH_TABLE_SIZE            = 1 << HASH_TABLE_SIZE_BIT_OFFSET // 128K

	ELEMENTS_LIMIT = HASH_TABLE_SIZE * 4

	PACKET_ID_SIZE_V6 = 96
	PACKET_ID_SIZE_V4 = 64
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PacketDedupMap

type PacketDedupMap struct {
	utils.Closable
	// contains filtered or unexported fields
}

注意:不是线程安全的,且要求Packet的时间戳是非降序列

func NewPacketDedupMap

func NewPacketDedupMap(name string) *PacketDedupMap

func (*PacketDedupMap) GetCounter

func (m *PacketDedupMap) GetCounter() interface{}

func (*PacketDedupMap) IsDuplicate

func (m *PacketDedupMap) IsDuplicate(packet []byte, timestamp time.Duration) bool

func (*PacketDedupMap) SetIgnoreTTL

func (t *PacketDedupMap) SetIgnoreTTL(b bool)

func (*PacketDedupMap) Size

func (m *PacketDedupMap) Size() int

func (*PacketDedupMap) Width

func (m *PacketDedupMap) Width() int

type PacketDedupMapCounter

type PacketDedupMapCounter struct {
	Total     uint64 `statsd:"total,counter"`
	Hit       uint64 `statsd:"hit,counter"`
	Timeout   uint64 `statsd:"timeout,counter"`
	Drop      uint64 `statsd:"drop,counter"`
	MaxBucket int    `statsd:"max_bucket,gauge"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL