Documentation ¶
Index ¶
- Constants
- type ClientStream
- type CloseAbleStream
- type CreateClientStreamFunc
- type Reporter
- func (s *Reporter) CreateStreamWithIndex(idx int) error
- func (s *Reporter) DestroyStreamWithIndex(idx int) error
- func (s *Reporter) GetClientStream(idx int) CloseAbleStream
- func (s *Reporter) GetClientStreamServer(idx int) network.ConnID
- func (s *Reporter) GetIPString() string
- func (s *Reporter) GetMonitorConnection() (*network.Connection, error)
- func (s *Reporter) ReleaseMonitorConnection(conn *network.Connection)
Constants ¶
View Source
const (
MinReportInterval = 1 * time.Second
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientStream ¶
type ClientStream struct { ConnectFunc CreateClientStreamFunc Stream CloseAbleStream IPString string // contains filtered or unexported fields }
一个与monitor连接的stream,用于发送和接收某种统计数据
func (*ClientStream) CreateStream ¶
func (cs *ClientStream) CreateStream(conn *network.Connection) error
创建一个clientStream
type CloseAbleStream ¶
type CloseAbleStream interface {
CloseSend() error
}
type CreateClientStreamFunc ¶
type CreateClientStreamFunc func(conn monitorpb.GrpcAPIClient) (client CloseAbleStream, cancelFunc context.CancelFunc, err error)
根据与monitor的连接创建clientStream
type Reporter ¶
type Reporter struct { *plugin.PluginBase *common.RunContext SDKToken model.SDKToken ClientStreams []*ClientStream ConnManager network.ConnectionManager // 插件工厂 Plugins plugin.Supplier // 本地缓存插件 Registry localregistry.LocalRegistry }
连接monitor的reporter的基类,具备一些大多数reporter需要的字段和连接管理方法
func InitBaseReporter ¶
func InitBaseReporter(ctx *plugin.InitContext, streamFunc []CreateClientStreamFunc) (*Reporter, error)
获取一个baseReporter
func (*Reporter) CreateStreamWithIndex ¶
连接monitor,并且创建对应的clientStream
func (*Reporter) DestroyStreamWithIndex ¶
断开与monitor的连接并且销毁所有clientStream
func (*Reporter) GetClientStream ¶
func (s *Reporter) GetClientStream(idx int) CloseAbleStream
获取对应的clientStream用于发送和接收数据
func (*Reporter) GetClientStreamServer ¶
func (*Reporter) GetMonitorConnection ¶
func (s *Reporter) GetMonitorConnection() (*network.Connection, error)
获取一个与monitor的连接
func (*Reporter) ReleaseMonitorConnection ¶
func (s *Reporter) ReleaseMonitorConnection(conn *network.Connection)
释放一个与monitor的连接
Click to show internal directories.
Click to hide internal directories.