servers

package
v0.0.0-...-132f1c2 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReadBuf

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

ReadBuf为一次性读取,不会分批次读数据,这个为udp server上接收到的trace包内存数据

func (*ReadBuf) GetBytes

func (r *ReadBuf) GetBytes() []byte

GetBytes方法用于返回当前trace数据

func (*ReadBuf) Read

func (r *ReadBuf) Read(p []byte) (int, error)

Read方法用于读取所有数据到传入的比特流中,如果传入的内存引用空间不够,则直接截取

这个ReadBuf虽然可以多次读取,但一般是用来一次性读取的,因为反复读取都是相同内容

type Server

type Server interface {
	Serve()
	IsServing() bool
	Stop()
	DataChan() chan *ReadBuf
	DataRecd(*ReadBuf) // must be called by consumer after reading data from the ReadBuf
}

Server为agent processors的udp server,用于接收微服务发送过来的trace

type TBufferedServer

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

TBufferedServer用于读取微服务发送过来的trace包数据的相关存储参数

func NewTBufferedServer

func NewTBufferedServer(
	transport thrift.TTransport,
	maxQueueSize int,
	maxPacketSize int,
	mFactory metrics.Factory,
) (*TBufferedServer, error)

NewTBufferedServer方法用于创建一个TBufferedServer实例, 通过这个实例进行udp server监听数据读取

func (*TBufferedServer) DataChan

func (s *TBufferedServer) DataChan() chan *ReadBuf

DataChan方法用于每个processor worker的阻塞等待channel队列上trace包的到来

func (*TBufferedServer) DataRecd

func (s *TBufferedServer) DataRecd(buf *ReadBuf)

DataRecd方法用于当process worker消费者处理完一个trace包后,就表示待处理的trace包数量-1 并把trace包释放到临时对象池

func (*TBufferedServer) IsServing

func (s *TBufferedServer) IsServing() bool

IsServing方法用于校验udp server是否要退出

func (*TBufferedServer) Serve

func (s *TBufferedServer) Serve()

Serve方法用于初始化ReadBuf,并开启udp server监听

func (*TBufferedServer) Stop

func (s *TBufferedServer) Stop()

Stop 方法用于退出udp server监听, 并关闭channel队列

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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