Documentation ¶
Overview ¶
Package basic gives a default implementation of the Engine interface. It only connects to local forwarding node via Unix socket.
Index ¶
- Constants
- func NewTimer() ndn.Timer
- type Engine
- func (e *Engine) AttachHandler(prefix enc.Name, handler ndn.InterestHandler) error
- func (e *Engine) DetachHandler(prefix enc.Name) error
- func (e *Engine) EngineTrait() ndn.Engine
- func (e *Engine) ExecMgmtCmd(module string, cmd string, args any) error
- func (e *Engine) Express(interest *ndn.EncodedInterest, callback ndn.ExpressCallbackFunc) error
- func (e *Engine) IsRunning() bool
- func (e *Engine) RegisterRoute(prefix enc.Name) error
- func (*Engine) Spec() ndn.Spec
- func (e *Engine) Start() error
- func (e *Engine) Stop() error
- func (e *Engine) Timer() ndn.Timer
- func (e *Engine) UnregisterRoute(prefix enc.Name) error
- type NameTrie
- func (n *NameTrie[V]) Delete()
- func (n *NameTrie[V]) DeleteIf(pred func(V) bool)
- func (n *NameTrie[V]) Depth() int
- func (n *NameTrie[V]) ExactMatch(name enc.Name) *NameTrie[V]
- func (n *NameTrie[V]) FirstNodeIf(pred func(V) bool) *NameTrie[V]
- func (n *NameTrie[V]) FirstSatisfyOrNew(name enc.Name, pred func(V) bool) *NameTrie[V]
- func (n *NameTrie[V]) HasChildren() bool
- func (n *NameTrie[V]) MatchAlways(name enc.Name) *NameTrie[V]
- func (n *NameTrie[V]) Parent() *NameTrie[V]
- func (n *NameTrie[V]) PrefixMatch(name enc.Name) *NameTrie[V]
- func (n *NameTrie[V]) SetValue(value V)
- func (n *NameTrie[V]) Value() V
- type Timer
Constants ¶
const DefaultInterestLife = 4 * time.Second
const TimeoutMargin = 10 * time.Millisecond
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func (*Engine) AttachHandler ¶
func (*Engine) EngineTrait ¶
func (*Engine) ExecMgmtCmd ¶
func (*Engine) Express ¶
func (e *Engine) Express(interest *ndn.EncodedInterest, callback ndn.ExpressCallbackFunc) error
type NameTrie ¶
type NameTrie[V any] struct { // contains filtered or unexported fields }
NameTrie is a simple implementation of a Name trie (node/subtree) used for PIT and FIB. It is slow due to the usage of String(). Subject to change when it explicitly affects performance.
func NewNameTrie ¶
NewNameTrie creates a new NameTrie and returns the root node.
func (*NameTrie[V]) Delete ¶
func (n *NameTrie[V]) Delete()
Delete deletes the node itself. Altomatically removes the parent node if it is empty.
func (*NameTrie[V]) DeleteIf ¶
DeleteIf deletes the node and its ancestors if they are empty. Whether empty or not is defined by a given function.
func (*NameTrie[V]) ExactMatch ¶
ExactMatch returns the node that matches the name exactly. If no node matches, it returns nil.
func (*NameTrie[V]) FirstNodeIf ¶
FirstNodeIf returns the first node that satisfies given condition, in DFS order.
func (*NameTrie[V]) FirstSatisfyOrNew ¶
FirstSatisfyOrNew finds or creates the first node along the path that satisfies the predicate.
func (*NameTrie[V]) HasChildren ¶
HasChildren returns whether the node has children.
func (*NameTrie[V]) MatchAlways ¶
MatchAlways finds or creates the node that matches the name exactly.
func (*NameTrie[V]) PrefixMatch ¶
PrefixMatch returns the longest prefix match of the name. Always succeeds, but the returned node may be empty.