servers

package
v0.0.0-...-437ec41 Latest Latest
Warning

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

Go to latest
Published: May 16, 2017 License: MIT 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 is a structure that holds the bytes to read into as well as the number of bytes that was read. The slice is typically pre-allocated to the max packet size and the buffers themselves are polled to avoid memory allocations for every new inbound message.

func (*ReadBuf) GetBytes

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

GetBytes returns the contents of the Readbuf as bytes

func (*ReadBuf) Read

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

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 is the interface for servers that receive inbound span submissions from client.

type TBufferedServer

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

TBufferedServer is a custom thrift server that reads traffic using the transport provided and places messages into a buffered channel to be processed by the processor provided

func NewTBufferedServer

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

NewTBufferedServer creates a TBufferedServer

func (*TBufferedServer) DataChan

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

DataChan returns the data chan of the buffered server

func (*TBufferedServer) DataRecd

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

DataRecd is called by the consumers every time they read a data item from DataChan

func (*TBufferedServer) IsServing

func (s *TBufferedServer) IsServing() bool

IsServing indicates whether the server is currently serving traffic

func (*TBufferedServer) Serve

func (s *TBufferedServer) Serve()

Serve initiates the readers and starts serving traffic

func (*TBufferedServer) Stop

func (s *TBufferedServer) Stop()

Stop stops the serving of traffic and waits until the queue is emptied by the readers

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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