Documentation ¶
Overview ¶
Package direct provides a concrete implementation of the dndm.Endpoint interface, facilitating direct communications by managing links between intents and interests. It integrates robust lifecycle management and ensures proper resource handling through its BaseEndpoint and custom Linker logic.
Index ¶
- type Endpoint
- func (t *Endpoint) Close() error
- func (t *Endpoint) Init(ctx context.Context, logger *slog.Logger, addIntent dndm.IntentCallback, ...) error
- func (t *Endpoint) OnClose(f func()) dndm.Endpoint
- func (t *Endpoint) Publish(route dndm.Route, opt ...dndm.PubOpt) (dndm.Intent, error)
- func (t *Endpoint) Subscribe(route dndm.Route, opt ...dndm.SubOpt) (dndm.Interest, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Endpoint ¶
type Endpoint struct { dndm.BaseEndpoint // contains filtered or unexported fields }
func New ¶
New creates and returns a new instance of Endpoint with specified buffer size. The size parameter affects internal buffering and link management capacities.
func (*Endpoint) Close ¶
Close terminates the Endpoint and cleans up resources, particularly closing the internal Linker if it has been initialized. It ensures all associated resources are properly released.
func (*Endpoint) Init ¶
func (t *Endpoint) Init(ctx context.Context, logger *slog.Logger, addIntent dndm.IntentCallback, addInterest dndm.InterestCallback) error
Init initializes the Endpoint with necessary context, logging, and callbacks for intents and interests. This setup is crucial for the Endpoint to function properly within a networked environment, ensuring that it can handle incoming and outgoing data flows as expected.
func (*Endpoint) OnClose ¶
OnClose registers a callback function that will be invoked when the endpoint is closed. This method allows for cleanup activities or notifications to be scheduled upon closure.
func (*Endpoint) Publish ¶
Publish creates and registers a new intent based on the provided route. This method leverages the internal Linker to manage the intent lifecycle and connectivity.