Documentation ¶
Overview ¶
Package ndt implements the Name Dispatch Table.
Index ¶
- Constants
- Variables
- type Config
- type Entry
- type Ndt
- func (ndt *Ndt) Close() error
- func (ndt *Ndt) ComputeHash(name ndn.Name) uint64
- func (ndt *Ndt) Config() Config
- func (ndt *Ndt) Get(index uint64) (entry Entry)
- func (ndt *Ndt) IndexOfHash(hash uint64) uint64
- func (ndt *Ndt) IndexOfName(name ndn.Name) uint64
- func (ndt *Ndt) List() (list []Entry)
- func (ndt *Ndt) Lookup(name ndn.Name) (index uint64, value uint8)
- func (ndt *Ndt) Randomize(max uint8)
- func (ndt *Ndt) Update(index uint64, value uint8)
- type Querier
Constants ¶
View Source
const ( MinPrefixLen = 1 MaxPrefixLen = ndni.PNameCachedComponents DefaultPrefixLen = 2 MinCapacity = 1 << 4 MaxCapacity = 1 << 31 DefaultCapacity = 1 << 16 MinSampleInterval = 1 << 0 MaxSampleInterval = 1 << 30 DefaultSampleInterval = 1 << 10 )
Limits and defaults.
Variables ¶
View Source
var ( GqlConfigType *graphql.Object GqlEntryType *graphql.Object )
GraphQL types.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // PrefixLen is the number of name components considered in NDT lookup. // // If this value is zero, it defaults to DefaultPrefixLen. // Otherwise, it is clamped between MinPrefixLen and MaxPrefixLen. PrefixLen int `json:"prefixLen,omitempty" gqldesc:"Number of name components considered in NDT lookup."` // Capacity is the number of NDT entries. // // If this value is zero, it defaults to DefaultCapacity. // Otherwise, it is clamped between MinCapacity and MaxCapacity, and adjusted up to the next power of 2. Capacity int `json:"capacity,omitempty" gqldesc:"Number of NDT entries."` // SampleInterval indicates how often per-entry counters are incremented within a lookup thread. // // If this value is zero, it defaults to DefaultSampleInterval. // Otherwise, it is clamped between MinSampleInterval and MaxSampleInterval, and adjusted up to the next power of 2. SampleInterval int `json:"sampleInterval,omitempty" gqldesc:"How often per-entry counters are incremented."` }
Config contains NDT configuration.
type Entry ¶
type Entry struct { Index uint64 `json:"index" gqldesc:"Entry index."` Value uint8 `json:"value" gqldesc:"Entry value, i.e. forwarding thread index."` Hits uint32 `json:"hits" gqldesc:"Hit counter value, uint32 wraparound."` }
Entry contains information from an NDT entry.
type Ndt ¶
type Ndt struct {
// contains filtered or unexported fields
}
Ndt represents a Name Dispatch Table (NDT).
var ( // GqlNdt is the NDT instance accessible via GraphQL. GqlNdt *Ndt )
func New ¶
func New(cfg Config, sockets []eal.NumaSocket) (ndt *Ndt)
New creates an NDT. sockets are NUMA sockets where NDT replicas are needed; duplicates are permitted.
func (*Ndt) ComputeHash ¶
ComputeHash computes the hash used for a name.
func (*Ndt) IndexOfHash ¶
IndexOfHash returns table index used for a hash.
func (*Ndt) IndexOfName ¶
IndexOfName returns table index used for a name.
type Querier ¶
type Querier C.NdtQuerier
Querier represents an NDT querier with counters.
func (*Querier) Init ¶
func (ndq *Querier) Init(ndt *Ndt, socket eal.NumaSocket)
Init initializes the Querier.
Click to show internal directories.
Click to hide internal directories.