2023-04-05 16:15:59 +08:00
|
|
|
package router
|
|
|
|
|
|
|
|
import (
|
|
|
|
"git.hpds.cc/Component/network/frame"
|
|
|
|
"git.hpds.cc/Component/network/metadata"
|
|
|
|
)
|
2022-10-11 17:36:09 +08:00
|
|
|
|
|
|
|
// Router is the interface to manage the routes for applications.
|
|
|
|
type Router interface {
|
|
|
|
// Route gets the route
|
2023-04-05 16:15:59 +08:00
|
|
|
Route(metadata metadata.Metadata) Route
|
2022-10-11 17:36:09 +08:00
|
|
|
// Clean the routes.
|
|
|
|
Clean()
|
|
|
|
}
|
|
|
|
|
|
|
|
// Route manages data subscribers according to their observed data tags.
|
|
|
|
type Route interface {
|
|
|
|
// Add a route.
|
2023-04-05 16:15:59 +08:00
|
|
|
Add(connId string, name string, observeDataTags []frame.Tag) error
|
2022-10-11 17:36:09 +08:00
|
|
|
// Remove a route.
|
|
|
|
Remove(connId string) error
|
|
|
|
// GetForwardRoutes returns all the subscribers by the given data tag.
|
2023-04-05 16:15:59 +08:00
|
|
|
GetForwardRoutes(tag frame.Tag) (streamIds []string)
|
2022-10-11 17:36:09 +08:00
|
|
|
}
|