network/router.go

20 lines
534 B
Go
Raw Normal View History

2022-10-11 17:36:09 +08:00
package network
// Router is the interface to manage the routes for applications.
type Router interface {
// Route gets the route
Route(metadata Metadata) Route
// Clean the routes.
Clean()
}
// Route manages data subscribers according to their observed data tags.
type Route interface {
// Add a route.
Add(connId string, name string, observeDataTags []byte) error
// Remove a route.
Remove(connId string) error
// GetForwardRoutes returns all the subscribers by the given data tag.
GetForwardRoutes(tag byte) []string
}