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) Express(finalName enc.Name, config *ndn.InterestConfig, rawInterest enc.Wire, ...) error
- func (e *Engine) RegisterRoute(prefix enc.Name) error
- func (e *Engine) Shutdown() error
- func (*Engine) Spec() ndn.Spec
- func (e *Engine) Start() error
- func (e *Engine) Timer() ndn.Timer
- func (e *Engine) UnregisterRoute(prefix enc.Name) error
- type Face
- 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 StreamFace
- func (f *StreamFace) Close() error
- func (f *StreamFace) IsLocal() bool
- func (f *StreamFace) IsRunning() bool
- func (f *StreamFace) Open() error
- func (f *StreamFace) Run()
- func (f *StreamFace) Send(pkt enc.Wire) error
- func (f *StreamFace) SetCallback(onPkt func(r enc.ParseReader) error, onError func(err error) error)
- 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 ¶
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.
type StreamFace ¶
type StreamFace struct {
// contains filtered or unexported fields
}
func NewStreamFace ¶
func NewStreamFace(network string, addr string, local bool) *StreamFace
func (*StreamFace) Close ¶
func (f *StreamFace) Close() error
func (*StreamFace) IsLocal ¶
func (f *StreamFace) IsLocal() bool
func (*StreamFace) IsRunning ¶
func (f *StreamFace) IsRunning() bool
func (*StreamFace) Open ¶
func (f *StreamFace) Open() error
func (*StreamFace) Run ¶
func (f *StreamFace) Run()
func (*StreamFace) SetCallback ¶
func (f *StreamFace) SetCallback(onPkt func(r enc.ParseReader) error, onError func(err error) error)