entries

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package entries contains implementation of various P4 entitites such as tables, groups, meters, etc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Action *p4info.Action
}

Action represents a P4 action

func NewAction

func NewAction(table *p4info.Action) *Action

NewAction creates a new action

type BatchSender

type BatchSender func(entities []*p4api.Entity) error

BatchSender is an abstract function for returning batches of read entities

type Counter

type Counter struct {
	// contains filtered or unexported fields
}

Counter represents all cells of a specific counter

func (*Counter) Cell

func (c *Counter) Cell(index int64) *p4api.CounterEntry

Cell returns the specified cell of the counter

func (*Counter) ID

func (c *Counter) ID() uint32

ID returns the counter ID

func (*Counter) Name added in v0.1.1

func (c *Counter) Name() string

Name returns the counter name

func (*Counter) Size

func (c *Counter) Size() int

Size returns the number of cells for the counter

type Counters

type Counters struct {
	// contains filtered or unexported fields
}

Counters represents a set of P4 counters

func NewCounters

func NewCounters(info []*p4info.Counter) *Counters

NewCounters creates a new counters store

func (*Counters) Counters

func (cs *Counters) Counters() []*Counter

Counters returns the list of counters

func (*Counters) ModifyCounterEntry

func (cs *Counters) ModifyCounterEntry(entry *p4api.CounterEntry, insert bool) error

ModifyCounterEntry modifies the specified counter entry cell

func (*Counters) NewCounter

func (cs *Counters) NewCounter(info *p4info.Counter) *Counter

NewCounter creates a new counter and all its cell entries

type Meter

type Meter struct {
	// contains filtered or unexported fields
}

Meter represents all cells of a specific meter

func (*Meter) Cell

func (m *Meter) Cell(index int64) *p4api.MeterEntry

Cell returns the specified cell of the meter

func (*Meter) ID

func (m *Meter) ID() uint32

ID returns the meter ID

func (*Meter) Name added in v0.1.1

func (m *Meter) Name() string

Name returns the meter name

func (*Meter) Size

func (m *Meter) Size() int

Size returns the number of cells for the meter

type Meters

type Meters struct {
	// contains filtered or unexported fields
}

Meters represents a set of P4 meters

func NewMeters

func NewMeters(info []*p4info.Meter) *Meters

NewMeters creates a new meters store

func (*Meters) Meters

func (ms *Meters) Meters() []*Meter

Meters returns the list of meters

func (*Meters) ModifyMeterEntry

func (ms *Meters) ModifyMeterEntry(entry *p4api.MeterEntry, insert bool) error

ModifyMeterEntry modifies the specified meter entry cell

func (*Meters) NewMeter

func (ms *Meters) NewMeter(info *p4info.Meter) *Meter

NewMeter creates a new meter and all its cell entries

type ReadType

type ReadType byte

ReadType specifies whether to read table entry, its direct counter or its direct meter

const (
	// ReadTableEntry specified that reads should return entities with TableEntry
	ReadTableEntry ReadType = iota
	// ReadDirectCounter specified that reads should return entities with DirectCounterEntry
	ReadDirectCounter
	// ReadDirectMeter specified that reads should return entities with DirectMeterEntry
	ReadDirectMeter
)

type Row

type Row struct {
	// contains filtered or unexported fields
}

Row represents table row entry and its mutable direct resources

type Table

type Table struct {
	// contains filtered or unexported fields
}

Table represents a single P4 table

func (*Table) Entries added in v0.1.2

func (t *Table) Entries() []*p4api.TableEntry

Entries returns a copy of the table entries; in no particular order

func (*Table) ID

func (t *Table) ID() uint32

ID returns the table ID

func (*Table) ModifyDirectCounterEntry

func (t *Table) ModifyDirectCounterEntry(entry *p4api.DirectCounterEntry) error

ModifyDirectCounterEntry modifies the specified direct counter entry data

func (*Table) ModifyDirectMeterEntry

func (t *Table) ModifyDirectMeterEntry(entry *p4api.DirectMeterEntry) error

ModifyDirectMeterEntry modifies the specified direct meter entry data

func (*Table) ModifyTableEntry

func (t *Table) ModifyTableEntry(entry *p4api.TableEntry, insert bool) error

ModifyTableEntry inserts or modifies the specified entry

func (*Table) Name added in v0.1.1

func (t *Table) Name() string

Name returns the table name

func (*Table) ReadTableEntries

func (t *Table) ReadTableEntries(request *p4api.TableEntry, readType ReadType, sender BatchSender) error

ReadTableEntries reads the table entries matching the specified table entry request

func (*Table) RemoveTableEntry

func (t *Table) RemoveTableEntry(entry *p4api.TableEntry) error

RemoveTableEntry removes the specified table entry and any direct counter data and meter configs for that entry

func (*Table) Size

func (t *Table) Size() int

Size returns the number of entries in the table

type Tables

type Tables struct {
	// contains filtered or unexported fields
}

Tables represents a set of P4 tables

func NewTables

func NewTables(tablesInfo []*p4info.Table) *Tables

NewTables creates a new set of tables from the given P4 info descriptor

func (*Tables) ModifyDirectCounterEntry

func (ts *Tables) ModifyDirectCounterEntry(entry *p4api.DirectCounterEntry, insert bool) error

ModifyDirectCounterEntry modifies the specified direct counter entry in its appropriate table

func (*Tables) ModifyDirectMeterEntry

func (ts *Tables) ModifyDirectMeterEntry(entry *p4api.DirectMeterEntry, insert bool) error

ModifyDirectMeterEntry modifies the specified direct meter entry in its appropriate table

func (*Tables) ModifyTableEntry

func (ts *Tables) ModifyTableEntry(entry *p4api.TableEntry, insert bool) error

ModifyTableEntry modifies the specified table entry in its appropriate table

func (*Tables) NewTable

func (ts *Tables) NewTable(table *p4info.Table) *Table

NewTable creates a new device table

func (*Tables) ReadTableEntries

func (ts *Tables) ReadTableEntries(request *p4api.TableEntry, readType ReadType, sender BatchSender) error

ReadTableEntries reads the table entries matching the specified table entry, from the appropriate table

func (*Tables) RemoveTableEntry

func (ts *Tables) RemoveTableEntry(entry *p4api.TableEntry) error

RemoveTableEntry removes the specified table entry from its appropriate table

func (*Tables) Table added in v0.1.2

func (ts *Tables) Table(id uint32) *Table

Table returns the table with the specified ID

func (*Tables) Tables

func (ts *Tables) Tables() []*Table

Tables returns the list of tables

Jump to

Keyboard shortcuts

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