table

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2025 License: MIT Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NetworkRegion = &networkRegionTable{}

NetworkRegion contains producer region names for this forwarder..

View Source
var PitCsPools = &PitCsPoolsT{
	PitInRecord: sync_pool.New(
		func() *PitInRecord { return &PitInRecord{} },
		func(obj *PitInRecord) {

			obj.PitToken = make([]byte, 0, 8)
		},
	),

	PitOutRecord: sync_pool.New(
		func() *PitOutRecord { return &PitOutRecord{} },
		func(obj *PitOutRecord) {},
	),

	NameTreePitEntry: sync_pool.New(
		func() *nameTreePitEntry {
			entry := &nameTreePitEntry{}
			entry.inRecords = make(map[uint64]*PitInRecord)
			entry.outRecords = make(map[uint64]*PitOutRecord)
			return entry
		},
		func(obj *nameTreePitEntry) {
			clear(obj.inRecords)
			clear(obj.outRecords)
		},
	),

	PitCsTreeNode: sync_pool.New(
		func() *pitCsTreeNode {
			return &pitCsTreeNode{
				children:   make(map[uint64]*pitCsTreeNode),
				pitEntries: make([]*nameTreePitEntry, 0, 4),
			}
		},
		func(obj *pitCsTreeNode) {
			clear(obj.children)
			obj.name = nil
			obj.pitEntries = obj.pitEntries[:0]
			obj.csEntry = nil
		},
	),
}
View Source
var Rib = RibTable{
	// contains filtered or unexported fields
}

Rib is the Routing Information Base.

Functions

func AddReadvertiser

func AddReadvertiser(r RibReadvertise)

func At

func At(n enc.Name, index int) enc.Component

func CfgCsAdmit added in v1.4.3

func CfgCsAdmit() bool

CfgCsAdmit returns whether contents will be admitted to the Content Store.

func CfgCsCapacity added in v1.4.3

func CfgCsCapacity() int

CfgCsCapacity returns the capacity of each forwarding thread's Content Store.

func CfgCsReplacementPolicy added in v1.4.3

func CfgCsReplacementPolicy() string

CfgCsReplacementPolicy returns the replacement policy used by Content Stores in the forwarder.

func CfgCsServe added in v1.4.3

func CfgCsServe() bool

CfgCsServe returns whether contents will be served from the Content Store.

func CfgDeadNonceListLifetime added in v1.4.3

func CfgDeadNonceListLifetime() time.Duration

CfgDeadNonceListLifetime returns the lifetime of entries in the dead nonce list.

func CfgSetCsAdmit added in v1.4.3

func CfgSetCsAdmit(admit bool)

CfgSetCsAdmit sets whether contents will be admitted to the Content Store.

func CfgSetCsCapacity added in v1.4.3

func CfgSetCsCapacity(capacity int)

CfgSetCsCapacity sets the capacity of each forwarding thread's Content Store.

func CfgSetCsServe added in v1.4.3

func CfgSetCsServe(serve bool)

CfgSetCsServe sets whether contents will be served from the Content Store.

func Initialize added in v1.4.3

func Initialize()

Initialize creates tables and configuration.

func UpdateExpirationTimer

func UpdateExpirationTimer(e PitEntry, t time.Time)

UpdateExpirationTimer sets the expiration time of the PIT entry.

Types

type CsEntry

type CsEntry interface {
	Index() uint64 // the hash of the entry, for fast lookup
	StaleTime() time.Time
	Copy() (*defn.FwData, []byte, error)
}

CsEntry is an entry in a thread's CS.

type CsLRU

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

CsLRU is a least recently used (LRU) replacement policy for the Content Store.

func NewCsLRU

func NewCsLRU(cs PitCsTable) *CsLRU

NewCsLRU creates a new LRU replacement policy for the Content Store.

func (*CsLRU) AfterInsert

func (l *CsLRU) AfterInsert(index uint64, wire []byte, data *defn.FwData)

AfterInsert is called after a new entry is inserted into the Content Store.

func (*CsLRU) AfterRefresh

func (l *CsLRU) AfterRefresh(index uint64, wire []byte, data *defn.FwData)

AfterRefresh is called after a new data packet refreshes an existing entry in the Content Store.

func (*CsLRU) BeforeErase

func (l *CsLRU) BeforeErase(index uint64, wire []byte)

BeforeErase is called before an entry is erased from the Content Store through management.

func (*CsLRU) BeforeUse

func (l *CsLRU) BeforeUse(index uint64, wire []byte)

BeforeUse is called before an entry in the Content Store is used to satisfy a pending Interest.

func (*CsLRU) EvictEntries

func (l *CsLRU) EvictEntries()

EvictEntries is called to instruct the policy to evict enough entries to reduce the Content Store size below its size limit.

type CsReplacementPolicy

type CsReplacementPolicy interface {
	// AfterInsert is called after a new entry is inserted into the Content Store.
	AfterInsert(index uint64, wire []byte, data *defn.FwData)

	// AfterRefresh is called after a new data packet refreshes an existing entry in the Content Store.
	AfterRefresh(index uint64, wire []byte, data *defn.FwData)

	// BeforeErase is called before an entry is erased from the Content Store through management.
	BeforeErase(index uint64, wire []byte)

	// BeforeUse is called before an entry in the Content Store is used to satisfy a pending Interest.
	BeforeUse(index uint64, wire []byte)

	// EvictEntries is called to instruct the policy to evict enough entries to reduce
	// the Content Store size below its size limit.
	EvictEntries()
}

CsReplacementPolicy represents a cache replacement policy for the Content Store.

type DeadNonceList

type DeadNonceList struct {
	Ticker *time.Ticker
	// contains filtered or unexported fields
}

DeadNonceList represents the Dead Nonce List for a forwarding thread.

func NewDeadNonceList

func NewDeadNonceList() *DeadNonceList

NewDeadNonceList creates a new Dead Nonce List for a forwarding thread.

func (*DeadNonceList) Find

func (d *DeadNonceList) Find(name enc.Name, nonce uint32) bool

Find returns whether the specified name and nonce combination are present in the Dead Nonce List.

func (*DeadNonceList) Insert

func (d *DeadNonceList) Insert(name enc.Name, nonce uint32) bool

Insert inserts an entry in the Dead Nonce List with the specified name and nonce. Returns whether nonce already present.

func (*DeadNonceList) RemoveExpiredEntries

func (d *DeadNonceList) RemoveExpiredEntries()

RemoveExpiredEntry removes all expired entries from Dead Nonce List.

type FibNextHopEntry

type FibNextHopEntry struct {
	Nexthop uint64
	Cost    uint64
}

FibNextHopEntry represents a nexthop in a FIB entry.

type FibStrategy

type FibStrategy interface {
	FindNextHopsEnc(name enc.Name) []*FibNextHopEntry
	FindStrategyEnc(name enc.Name) enc.Name
	InsertNextHopEnc(name enc.Name, nextHop uint64, cost uint64)
	ClearNextHopsEnc(name enc.Name)
	RemoveNextHopEnc(name enc.Name, nextHop uint64)
	GetNumFIBEntries() int
	GetAllFIBEntries() []FibStrategyEntry
	SetStrategyEnc(name enc.Name, strategy enc.Name)
	UnSetStrategyEnc(name enc.Name)
	GetAllForwardingStrategies() []FibStrategyEntry
}

FibStrategy represents the functionality that a FIB-strategy table should implement.

var FibStrategyTable FibStrategy

FibStrategy is a table containing FIB and Strategy entries for given prefixes.

type FibStrategyEntry

type FibStrategyEntry interface {
	Name() enc.Name
	GetStrategy() enc.Name
	GetNextHops() []*FibNextHopEntry
}

FibStrategyEntry represents an entry in the FIB-Strategy table.

type FibStrategyHashTable

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

FibStrategyHashTable represents a tree implementation of the FIB-Strategy table.

func (*FibStrategyHashTable) ClearNextHopsEnc

func (f *FibStrategyHashTable) ClearNextHopsEnc(name enc.Name)

ClearNextHops clears all nexthops for the specified prefix.

func (*FibStrategyHashTable) FindNextHopsEnc

func (f *FibStrategyHashTable) FindNextHopsEnc(name enc.Name) []*FibNextHopEntry

func (*FibStrategyHashTable) FindStrategyEnc

func (f *FibStrategyHashTable) FindStrategyEnc(name enc.Name) enc.Name

func (*FibStrategyHashTable) GetAllFIBEntries

func (f *FibStrategyHashTable) GetAllFIBEntries() []FibStrategyEntry

GetAllFIBEntries returns all nexthop entries in the FIB.

func (*FibStrategyHashTable) GetAllForwardingStrategies

func (f *FibStrategyHashTable) GetAllForwardingStrategies() []FibStrategyEntry

GetAllForwardingStrategies returns all strategy choice entries in the Strategy Table.

func (*FibStrategyHashTable) GetNumFIBEntries added in v1.5.0

func (f *FibStrategyHashTable) GetNumFIBEntries() int

GetNumFIBEntries returns the number of entries in the FIB.

func (*FibStrategyHashTable) InsertNextHopEnc

func (f *FibStrategyHashTable) InsertNextHopEnc(name enc.Name, nexthop uint64, cost uint64)

InsertNextHop adds or updates a nexthop entry for the specified prefix.

func (*FibStrategyHashTable) RemoveNextHopEnc

func (f *FibStrategyHashTable) RemoveNextHopEnc(name enc.Name, nexthop uint64)

func (*FibStrategyHashTable) SetStrategyEnc

func (f *FibStrategyHashTable) SetStrategyEnc(name enc.Name, strategy enc.Name)

func (*FibStrategyHashTable) UnSetStrategyEnc

func (f *FibStrategyHashTable) UnSetStrategyEnc(name enc.Name)

UnsetStrategy unsets the strategy for the specified prefix.

type FibStrategyTree

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

FibStrategy Tree represents a tree implementation of the FIB-Strategy table.

func (*FibStrategyTree) ClearNextHopsEnc

func (f *FibStrategyTree) ClearNextHopsEnc(name enc.Name)

ClearNextHops clears all nexthops for the specified prefix.

func (*FibStrategyTree) FindNextHopsEnc

func (f *FibStrategyTree) FindNextHopsEnc(name enc.Name) []*FibNextHopEntry

FindNextHops returns the longest-prefix matching nexthop(s) matching the specified name.

func (*FibStrategyTree) FindStrategyEnc

func (f *FibStrategyTree) FindStrategyEnc(name enc.Name) enc.Name

FindStrategy returns the longest-prefix matching strategy choice entry for the specified name.

func (*FibStrategyTree) GetAllFIBEntries

func (f *FibStrategyTree) GetAllFIBEntries() []FibStrategyEntry

GetAllFIBEntries returns all nexthop entries in the FIB.

func (*FibStrategyTree) GetAllForwardingStrategies

func (f *FibStrategyTree) GetAllForwardingStrategies() []FibStrategyEntry

GetAllForwardingStrategies returns all strategy choice entries in the Strategy Table.

func (*FibStrategyTree) GetNumFIBEntries added in v1.5.0

func (f *FibStrategyTree) GetNumFIBEntries() int

GetNumFIBEntries returns the number of nexthop entries in the FIB.

func (*FibStrategyTree) InsertNextHopEnc

func (f *FibStrategyTree) InsertNextHopEnc(name enc.Name, nexthop uint64, cost uint64)

InsertNextHop adds or updates a nexthop entry for the specified prefix.

func (*FibStrategyTree) RemoveNextHopEnc

func (f *FibStrategyTree) RemoveNextHopEnc(name enc.Name, nexthop uint64)

RemoveNextHop removes the specified nexthop entry from the specified prefix.

func (*FibStrategyTree) SetStrategyEnc

func (f *FibStrategyTree) SetStrategyEnc(name enc.Name, strategy enc.Name)

SetStrategy sets the strategy for the specified prefix.

func (*FibStrategyTree) UnSetStrategyEnc

func (f *FibStrategyTree) UnSetStrategyEnc(name enc.Name)

UnsetStrategy unsets the strategy for the specified prefix.

type OnPitExpiration

type OnPitExpiration func(PitEntry)

type PitCsPoolsT added in v1.5.0

type PitCsPoolsT struct {
	PitInRecord      sync_pool.SyncPool[*PitInRecord]
	PitOutRecord     sync_pool.SyncPool[*PitOutRecord]
	NameTreePitEntry sync_pool.SyncPool[*nameTreePitEntry]
	PitCsTreeNode    sync_pool.SyncPool[*pitCsTreeNode]
}

type PitCsTable

type PitCsTable interface {
	// InsertInterest inserts an Interest into the PIT.
	InsertInterest(interest *defn.FwInterest, hint enc.Name, inFace uint64) (PitEntry, bool)
	// RemoveInterest removes an Interest from the PIT.
	RemoveInterest(pitEntry PitEntry) bool
	// FindInterestExactMatch finds an exact match for an Interest in the PIT.
	FindInterestExactMatchEnc(interest *defn.FwInterest) PitEntry
	// FindInterestPrefixMatchByDataEnc finds a prefix match for a Data in the PIT.
	FindInterestPrefixMatchByDataEnc(data *defn.FwData, token *uint32) []PitEntry
	// PitSize returns the number of entries in the PIT.
	PitSize() int

	// InsertData inserts a Data into the CS.
	InsertData(data *defn.FwData, wire []byte)
	// FindMatchingDataFromCS finds a matching Data in the CS.
	FindMatchingDataFromCS(interest *defn.FwInterest) CsEntry
	// CsSize returns the number of entries in the CS.
	CsSize() int
	// IsCsAdmitting returns whether the CS is admitting new entries.
	IsCsAdmitting() bool
	// IsCsServing returns whether the CS is serving entries.
	IsCsServing() bool

	// UpdateTicker returns the channel used to signal regular Update() calls in the forwarding thread.
	UpdateTicker() <-chan time.Time
	// Update() does whatever the PIT table needs to do regularly.
	Update()
	// contains filtered or unexported methods
}

PitCsTable dictates what functionality a Pit-Cs table should implement Warning: All functions must be called in the same forwarding goroutine as the creation of the table.

type PitCsTree

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

PitCsTree represents a PIT-CS implementation that uses a name tree

func NewPitCS

func NewPitCS(onExpiration OnPitExpiration) *PitCsTree

NewPitCS creates a new combined PIT-CS for a forwarding thread.

func (*PitCsTree) CsSize

func (p *PitCsTree) CsSize() int

CsSize returns the number of entries in the CS.

func (*PitCsTree) FindInterestExactMatchEnc

func (p *PitCsTree) FindInterestExactMatchEnc(interest *defn.FwInterest) PitEntry

FindInterestPrefixMatchByData returns all interests that could be satisfied by the given data. Example: If we have interests /a and /a/b, a prefix search for data with name /a/b will return PitEntries for both /a and /a/b

func (*PitCsTree) FindInterestPrefixMatchByDataEnc

func (p *PitCsTree) FindInterestPrefixMatchByDataEnc(data *defn.FwData, token *uint32) []PitEntry

FindInterestPrefixMatchByData returns all interests that could be satisfied by the given data. Example: If we have interests /a and /a/b, a prefix search for data with name /a/b will return PitEntries for both /a and /a/b

func (*PitCsTree) FindMatchingDataFromCS

func (p *PitCsTree) FindMatchingDataFromCS(interest *defn.FwInterest) CsEntry

FindMatchingDataFromCS finds the best matching entry in the CS (if any). If MustBeFresh is set to true in the Interest, only non-stale CS entries will be returned.

func (*PitCsTree) InsertData

func (p *PitCsTree) InsertData(data *defn.FwData, wire []byte)

InsertData inserts a Data packet into the Content Store.

func (*PitCsTree) InsertInterest

func (p *PitCsTree) InsertInterest(interest *defn.FwInterest, hint enc.Name, inFace uint64) (PitEntry, bool)

InsertInterest inserts an entry in the PIT upon receipt of an Interest. Returns tuple of PIT entry and whether the Nonce is a duplicate.

func (*PitCsTree) IsCsAdmitting

func (p *PitCsTree) IsCsAdmitting() bool

IsCsAdmitting returns whether the CS is admitting content.

func (*PitCsTree) IsCsServing

func (p *PitCsTree) IsCsServing() bool

IsCsServing returns whether the CS is serving content.

func (*PitCsTree) PitSize

func (p *PitCsTree) PitSize() int

PitSize returns the number of entries in the PIT.

func (*PitCsTree) RemoveInterest

func (p *PitCsTree) RemoveInterest(pitEntry PitEntry) bool

RemoveInterest removes the specified PIT entry, returning true if the entry was removed and false if was not (because it does not exist).

func (*PitCsTree) Update

func (p *PitCsTree) Update()

func (*PitCsTree) UpdateTicker added in v1.5.0

func (p *PitCsTree) UpdateTicker() <-chan time.Time

type PitEntry

type PitEntry interface {
	PitCs() PitCsTable
	EncName() enc.Name
	CanBePrefix() bool
	MustBeFresh() bool

	// Interests must match in terms of Forwarding Hint to be aggregated in PIT.
	ForwardingHintNew() enc.Name

	InRecords() map[uint64]*PitInRecord   // Key is face ID
	OutRecords() map[uint64]*PitOutRecord // Key is face ID

	ExpirationTime() time.Time

	Satisfied() bool
	SetSatisfied(isSatisfied bool)

	Token() uint32

	InsertInRecord(interest *defn.FwInterest, face uint64, incomingPitToken []byte) (*PitInRecord, bool, uint32)
	InsertOutRecord(interest *defn.FwInterest, face uint64) *PitOutRecord

	RemoveInRecord(face uint64)
	RemoveOutRecord(face uint64)
	ClearOutRecords()
	ClearInRecords()
	// contains filtered or unexported methods
}

PitEntry dictates what entries in a PIT-CS table should implement

type PitInRecord

type PitInRecord struct {
	Face            uint64
	LatestTimestamp time.Time
	LatestNonce     uint32
	ExpirationTime  time.Time
	PitToken        []byte
}

PitInRecord records an incoming Interest on a given face.

type PitOutRecord

type PitOutRecord struct {
	Face            uint64
	LatestTimestamp time.Time
	LatestNonce     uint32
	ExpirationTime  time.Time
}

PitOutRecord records an outgoing Interest on a given face.

type RibEntry

type RibEntry struct {
	Name enc.Name
	// contains filtered or unexported fields
}

RibEntry represents an entry in the RIB table.

func (*RibEntry) GetRoutes

func (r *RibEntry) GetRoutes() []*Route

GetRoutes returns all routes in the RIB entry.

func (*RibEntry) HasCaptureRoute

func (r *RibEntry) HasCaptureRoute() bool

type RibReadvertise

type RibReadvertise interface {
	// Advertise a route in the RIB
	Announce(name enc.Name, route *Route)
	// Remove a route from the RIB
	Withdraw(name enc.Name, route *Route)
}

type RibTable

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

RibTable represents the Routing Information Base (RIB).

func (*RibTable) AddEncRoute

func (r *RibTable) AddEncRoute(name enc.Name, route *Route)

AddRoute adds or updates a RIB entry for the specified prefix.

func (*RibTable) CleanUpFace added in v1.4.2

func (r *RibTable) CleanUpFace(faceId uint64)

func (*RibTable) GetAllEntries

func (r *RibTable) GetAllEntries() []*RibEntry

GetAllEntries returns all routes in the RIB.

func (*RibTable) RemoveRouteEnc

func (r *RibTable) RemoveRouteEnc(name enc.Name, faceID uint64, origin uint64)

RemoveRoute removes the specified route from the specified prefix.

type Route

type Route struct {
	FaceID           uint64
	Origin           uint64
	Cost             uint64
	Flags            uint64
	ExpirationPeriod *time.Duration
}

Route represents a route in a RIB entry.

func (*Route) HasCaptureFlag

func (r *Route) HasCaptureFlag() bool

func (*Route) HasChildInheritFlag

func (r *Route) HasChildInheritFlag() bool

Jump to

Keyboard shortcuts

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