Documentation ¶
Overview ¶
Package cache keeps a cache of connection info records. Cache is NOT threadsafe.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInetDiagParseFailed = errors.New("Error parsing inetdiag message") ErrLocal = errors.New("Connection is loopback") ErrUnknownMessageType = errors.New("Unknown netlink message type") )
Package error messages
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a cache of all connection status.
func NewCache ¶
func NewCache() *Cache
NewCache creates a cache object with capacity of 1000. The map size is adjusted on every sampling round, but we have to start somewhere.
func (*Cache) CycleCount ¶
CycleCount returns the number of times EndCycle() has been called.
func (*Cache) EndCycle ¶
func (c *Cache) EndCycle() map[uint64]*netlink.ArchivalRecord
EndCycle marks the completion of updates from one set of netlink messages. It returns all messages that did not have corresponding inodes in the most recent batch of messages.
func (*Cache) Update ¶
func (c *Cache) Update(msg *netlink.ArchivalRecord) (*netlink.ArchivalRecord, error)
Update swaps msg with the cache contents, and returns the evicted value.
Click to show internal directories.
Click to hide internal directories.