router

package
v1.16.4 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Overview

Package router providers a default implement of `router` and `Route`.

Package router defines the interface of router and route.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultRouter

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

DefaultRouter providers a default implement of `router`, It route the data according to observed tag or connID.

func (*DefaultRouter) Clean

func (r *DefaultRouter) Clean()

Clean clean router.

func (*DefaultRouter) Route

func (r *DefaultRouter) Route(metadata metadata.M) Route

Route get route from metadata.

type Route

type Route interface {
	// Add a route.
	Add(connID string, observeDataTags []frame.Tag) error
	// Remove a route.
	Remove(connID string) error
	// GetForwardRoutes returns all the subscribers by the given data tag.
	GetForwardRoutes(tag frame.Tag) (connIDs []string)
}

Route manages data subscribers according to their observed data tags.

type Router

type Router interface {
	// Route gets the route
	Route(metadata metadata.M) Route
	// Clean the routes.
	Clean()
}

Router is the interface to manage the routes for applications.

func Default

func Default() Router

Default return the DefaultRouter.

Jump to

Keyboard shortcuts

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