mockmaps

package
v1.15.0-pre.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CtMockMap

type CtMockMap struct {
	Entries []ctmap.CtMapRecord
}

CtMockMap implements the CtMap interface and can be used for unit tests.

func NewCtMockMap

func NewCtMockMap(records []ctmap.CtMapRecord) *CtMockMap

NewCtMockMap is a constructor for a CtMockMap.

func (*CtMockMap) Close

func (m *CtMockMap) Close() error

Close does nothing, mock maps need not be closed either.

func (*CtMockMap) DumpEntries

func (m *CtMockMap) DumpEntries() (string, error)

DumpEntries iterates through Map m and writes the values of the ct entries in m to a string.

func (*CtMockMap) DumpWithCallback

func (m *CtMockMap) DumpWithCallback(cb bpf.DumpCallback) error

DumpWithCallback runs the callback on each entry of the mock map.

func (*CtMockMap) Open

func (m *CtMockMap) Open() error

Open does nothing, mock maps need not be opened.

func (*CtMockMap) Path

func (m *CtMockMap) Path() (string, error)

Path returns a mock path for the mock map.

type LBMockMap

type LBMockMap struct {
	lock.Mutex
	BackendByID            map[lb.BackendID]*lb.Backend
	ServiceByID            map[uint16]*lb.SVC
	AffinityMatch          datapathTypes.BackendIDByServiceIDSet
	SourceRanges           datapathTypes.SourceRangeSetByServiceID
	DummyMaglevTable       map[uint16]int // svcID => backends count
	SvcActiveBackendsCount map[uint16]int
}

func NewLBMockMap

func NewLBMockMap() *LBMockMap

func (*LBMockMap) AddAffinityMatch

func (m *LBMockMap) AddAffinityMatch(revNATID uint16, backendID lb.BackendID) error

func (*LBMockMap) AddBackend

func (m *LBMockMap) AddBackend(b *lb.Backend, ipv6 bool) error

func (*LBMockMap) DeleteAffinityMatch

func (m *LBMockMap) DeleteAffinityMatch(revNATID uint16, backendID lb.BackendID) error

func (*LBMockMap) DeleteBackendByID

func (m *LBMockMap) DeleteBackendByID(id lb.BackendID) error

func (*LBMockMap) DeleteService

func (m *LBMockMap) DeleteService(addr lb.L3n4AddrID, backendCount int, maglev bool, natPolicy lb.SVCNatPolicy) error

func (*LBMockMap) DumpAffinityMatches

func (m *LBMockMap) DumpAffinityMatches() (datapathTypes.BackendIDByServiceIDSet, error)

func (*LBMockMap) DumpBackendMaps

func (m *LBMockMap) DumpBackendMaps() ([]*lb.Backend, error)

func (*LBMockMap) DumpServiceMaps

func (m *LBMockMap) DumpServiceMaps() ([]*lb.SVC, []error)

func (*LBMockMap) DumpSourceRanges

func (m *LBMockMap) DumpSourceRanges(ipv6 bool) (datapathTypes.SourceRangeSetByServiceID, error)

func (*LBMockMap) IsMaglevLookupTableRecreated

func (*LBMockMap) IsMaglevLookupTableRecreated(ipv6 bool) bool

func (*LBMockMap) UpdateBackendWithState

func (m *LBMockMap) UpdateBackendWithState(b *lb.Backend) error

func (*LBMockMap) UpdateSourceRanges

func (m *LBMockMap) UpdateSourceRanges(revNATID uint16, prevRanges []*cidr.CIDR,
	ranges []*cidr.CIDR, ipv6 bool) error

func (*LBMockMap) UpsertMaglevLookupTable

func (m *LBMockMap) UpsertMaglevLookupTable(svcID uint16, backends map[string]*lb.Backend, ipv6 bool) error

func (*LBMockMap) UpsertService

func (m *LBMockMap) UpsertService(p *datapathTypes.UpsertServiceParams) error

type MetricsMockMap

type MetricsMockMap struct {
	Entries []MetricsRecord
}

MetricsMockMap implements the MetricsMap interface and can be used for unit tests.

func NewMetricsMockMap

func NewMetricsMockMap(records []MetricsRecord) *MetricsMockMap

NewMetricsMockMap is a constructor for a MetricsMockMap.

func (*MetricsMockMap) IterateWithCallback

func (m *MetricsMockMap) IterateWithCallback(cb metricsmap.IterateCallback) error

DumpWithCallback runs the callback on each entry of the mock map.

type MetricsRecord

type MetricsRecord struct {
	Key    metricsmap.Key
	Values metricsmap.Values
}

MetricsRecord designates a map entry (key + value). This type is used for mock maps.

type NatMockMap

type NatMockMap struct {
	Entries []nat.NatMapRecord
}

NatMockMap implements the NatMap interface and can be used for unit tests.

func NewNatMockMap

func NewNatMockMap(records []nat.NatMapRecord) *NatMockMap

NewNatMockMap is a constructor for a NatMockMap.

func (*NatMockMap) Close

func (m *NatMockMap) Close() error

Close does nothing, mock maps need not be closed either.

func (*NatMockMap) DumpEntries

func (m *NatMockMap) DumpEntries() (string, error)

DumpEntries iterates through Map m and writes the values of the ct entries in m to a string.

func (*NatMockMap) DumpWithCallback

func (m *NatMockMap) DumpWithCallback(cb bpf.DumpCallback) error

DumpWithCallback runs the callback on each entry of the mock map.

func (*NatMockMap) Open

func (m *NatMockMap) Open() error

Open does nothing, mock maps need not be opened.

func (*NatMockMap) Path

func (m *NatMockMap) Path() (string, error)

Path returns a mock path for the mock map.

Jump to

Keyboard shortcuts

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