forked from cisco-app-networking/networkservicemesh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
remote_connection_monitor_server.go
37 lines (32 loc) · 1.22 KB
/
remote_connection_monitor_server.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package remote
import (
"cisco-app-networking.github.io/networkservicemesh/controlplane/api/connection"
"cisco-app-networking.github.io/networkservicemesh/controlplane/pkg/services"
"cisco-app-networking.github.io/networkservicemesh/sdk/monitor"
"cisco-app-networking.github.io/networkservicemesh/sdk/monitor/connectionmonitor"
)
// MonitorServer is a monitor.Server for remote/connection GRPC API
type MonitorServer interface {
monitor.Server
connection.MonitorConnectionServer
}
type monitorServer struct {
connectionmonitor.MonitorServer
manager *services.ClientConnectionManager
}
// NewMonitorServer creates a new MonitorServer
func NewMonitorServer(manager *services.ClientConnectionManager) MonitorServer {
rv := &monitorServer{
MonitorServer: connectionmonitor.NewMonitorServer("RemoteConnection"),
manager: manager,
}
return rv
}
// MonitorConnections adds recipient for MonitorServer events
func (s *monitorServer) MonitorConnections(selector *connection.MonitorScopeSelector, recipient connection.MonitorConnection_MonitorConnectionsServer) error {
err := s.MonitorServer.MonitorConnections(selector, recipient)
if s.manager != nil {
s.manager.UpdateRemoteMonitorDone(selector.GetPathSegments())
}
return err
}