Documentation ¶
Index ¶
- func AcceptAndListenTCPBuf(l net.Listener, queue chan<- [][]byte, term <-chan struct{}, ...)
- func ListenGRPC(l net.Listener, queue chan []byte, stop <-chan struct{}, ...)
- func ListenUDP(conn net.PacketConn, queue chan []byte, stop <-chan struct{}, ...)
- func ListenUDPBuf(conn net.PacketConn, queue chan [][]byte, stop <-chan struct{}, ...)
- type BatchChan
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AcceptAndListenTCPBuf ¶
func AcceptAndListenTCPBuf(l net.Listener, queue chan<- [][]byte, term <-chan struct{}, rateLimiters []*ratelimiter.SlidingWindow, cfg *conf.Main, connWG *sync.WaitGroup, ms *metrics.Prom, lg *zap.Logger)
AcceptAndListenTCPBuf is batched version of AcceptAndListenTCP.
func ListenGRPC ¶
func ListenGRPC(l net.Listener, queue chan []byte, stop <-chan struct{}, connWG *sync.WaitGroup, cfg *conf.Main, ms *metrics.Prom, lg *zap.Logger)
ListenGRPC listens for incoming gRPC connections. Blocking. Returns when server returns.
func ListenUDP ¶
func ListenUDP(conn net.PacketConn, queue chan []byte, stop <-chan struct{}, connWG *sync.WaitGroup, ms *metrics.Prom, lg *zap.Logger)
ListenUDP listens for incoming UDP connections.
func ListenUDPBuf ¶
func ListenUDPBuf(conn net.PacketConn, queue chan [][]byte, stop <-chan struct{}, rateLimiters []*ratelimiter.SlidingWindow, connWG *sync.WaitGroup, cfg *conf.Main, ms *metrics.Prom, lg *zap.Logger)
ListenUDPBuf is a buffered version of ListenUDP.
Types ¶
type BatchChan ¶
type BatchChan struct {
// contains filtered or unexported fields
}
BatchChan represents a buffer to send records into a chan in batches. BatchChan accumulates records in a buffer. When buffer is full, it sends it as a batch to a chan. It also periodically flushes the buffer to prevent losing data when it's not enough to fill the buffer.
func NewBatchChan ¶
NewBatchChan makes a new batched chan buffer. It also starts a flushing goroutine in the background if periodSec > 0.
func (*BatchChan) Close ¶
func (qb *BatchChan) Close()
Close closes the batch channel. It does not close the target channel. Must be called exactly once for every new instance.