cache

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

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

func (c *Cache) CycleCount() int64

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

Update swaps msg with the cache contents, and returns the evicted value.

Jump to

Keyboard shortcuts

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