mockmaps

package
v1.10.2 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2021 License: Apache-2.0 Imports: 9 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 {
	BackendByID      map[uint16]*lb.Backend
	ServiceByID      map[uint16]*lb.SVC
	AffinityMatch    lbmap.BackendIDByServiceIDSet
	SourceRanges     lbmap.SourceRangeSetByServiceID
	DummyMaglevTable map[uint16]int // svcID => backends count
}

func NewLBMockMap

func NewLBMockMap() *LBMockMap

func (*LBMockMap) AddAffinityMatch

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

func (*LBMockMap) AddBackend

func (m *LBMockMap) AddBackend(id uint16, ip net.IP, port uint16, ipv6 bool) error

func (*LBMockMap) DeleteAffinityMatch

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

func (*LBMockMap) DeleteBackendByID

func (m *LBMockMap) DeleteBackendByID(id uint16, ipv6 bool) error

func (*LBMockMap) DeleteService

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

func (*LBMockMap) DumpAffinityMatches

func (m *LBMockMap) DumpAffinityMatches() (lbmap.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) (lbmap.SourceRangeSetByServiceID, error)

func (*LBMockMap) IsMaglevLookupTableRecreated

func (*LBMockMap) IsMaglevLookupTableRecreated(ipv6 bool) bool

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]uint16, ipv6 bool) error

func (*LBMockMap) UpsertService

func (m *LBMockMap) UpsertService(p *lbmap.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