nfacct

package
v1.31.0-alpha.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const MaxLength = 31

MaxLength represents the maximum length allowed for the name in a nfacct counter.

Variables

View Source
var ErrEmptyName = errors.New("object name cannot be empty")
View Source
var ErrNameExceedsMaxLength = fmt.Errorf("object name exceeds the maximum allowed length of %d characters", MaxLength)
View Source
var ErrObjectAlreadyExists = errors.New("object already exists")
View Source
var ErrObjectNotFound = errors.New("object not found")
View Source
var ErrUnexpected = errors.New("unexpected error")

Functions

This section is empty.

Types

type Counter

type Counter struct {
	Name    string
	Packets uint64
	Bytes   uint64
}

Counter represents a nfacct accounting object.

type Interface

type Interface interface {
	// Ensure checks the existence of a nfacct counter with the provided name and creates it if absent.
	Ensure(name string) error
	// Add creates a nfacct counter with the given name, returning an error if it already exists.
	Add(name string) error
	// Get retrieves the nfacct counter with the specified name, returning an error if it doesn't exist.
	Get(name string) (*Counter, error)
	// List retrieves all nfacct counters.
	List() ([]*Counter, error)
}

Interface is an injectable interface for running nfacct commands.

func New

func New() (Interface, error)

New returns a new Interface.

Jump to

Keyboard shortcuts

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