common

package
v0.0.0-...-701ea4a Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package common contains constants and basic structures used in snmp integration

Index

Constants

View Source
const SnmpExternalTagsSourceType = "snmp"

SnmpExternalTagsSourceType is the source id used for external tags

View Source
const SnmpIntegrationName = "snmp"

SnmpIntegrationName is the name of the snmp integration

Variables

View Source
var MockTimeNow = func() time.Time {
	layout := "2006-01-02 15:04:05"
	str := "2000-01-01 00:00:00"
	t, _ := time.Parse(layout, str)
	return t
}

MockTimeNow mocks time.Now

Functions

func CreateStringBatches

func CreateStringBatches(elements []string, size int) ([][]string, error)

CreateStringBatches batches strings into chunks with specific size

Types

type OIDTrie

type OIDTrie struct {
	Children map[int]*OIDTrie
}

OIDTrie is a trie structure that represent OIDs as tree It's an efficient data structure for verifying if an OID is known or not. The search complexity of NonLeafNodeExist / LeafExist methods are O(n), where n is the length of the OID (number of dot separated numbers). The search complexity doesn't depend on the size of the trie.

func BuildOidTrie

func BuildOidTrie(allOIDs []string) *OIDTrie

BuildOidTrie builds the OIDTrie from a list of OIDs

func (*OIDTrie) DebugPrint

func (o *OIDTrie) DebugPrint()

DebugPrint is used to print the whole Trie for debugging purpose

func (*OIDTrie) LeafExist

func (o *OIDTrie) LeafExist(oid string) bool

LeafExist checks if the oid is a known leaf

func (*OIDTrie) NonLeafNodeExist

func (o *OIDTrie) NonLeafNodeExist(oid string) bool

NonLeafNodeExist checks if the oid is a known node (a node have at least one child)

Jump to

Keyboard shortcuts

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