Versions in this module Expand all Collapse all v1 v1.0.1 Feb 25, 2025 Changes in this version type TcpConnection + func (tc *TcpConnection) ForceClose() v1.0.0 Feb 23, 2025 Changes in this version + const BufferInitSize + const InitEventListSize + const InitRetryTime + const MaxRetryTime + const PrependSize + var AtomicNumber int64 = 0 + var Dlog = &Log + type Acceptor struct + func NewAcceptor(loop *EventLoop, listenAddr *netip.AddrPort, reusePort bool) (ac *Acceptor) + func (a *Acceptor) Listen() + func (a *Acceptor) Listening() bool + func (a *Acceptor) SetAcceptorNewConnectionCallback(cb AcceptorNewConnectionCallback) + type AcceptorNewConnectionCallback func(int, *netip.AddrPort) + type Buffer struct + func NewBuffer() *Buffer + func (b *Buffer) Append(data []byte) + func (b *Buffer) Peek() *byte + func (b *Buffer) Prepend(data []byte) + func (b *Buffer) PrependBytes() int + func (b *Buffer) ReadFd(fd int, saveErrno *error) int + func (b *Buffer) ReadableBytes() int + func (b *Buffer) Retrieve(size int) + func (b *Buffer) RetrieveAll() + func (b *Buffer) RetrieveAllString() []byte + func (b *Buffer) RetrieveAsString(size int) []byte + func (b *Buffer) WriteableBytes() int + type Channel struct + func NewChannel(loop *EventLoop, fdArg int32) *Channel + func (c *Channel) DisableAll() + func (c *Channel) DisableReading() + func (c *Channel) DisableWriting() + func (c *Channel) EnableReading() + func (c *Channel) EnableWriting() + func (c *Channel) Events() int16 + func (c *Channel) Fd() int32 + func (c *Channel) HandleEvent(time time.Time) + func (c *Channel) Index() int + func (c *Channel) IsNoneEvent() bool + func (c *Channel) IsReading() bool + func (c *Channel) IsWriting() bool + func (c *Channel) OwnerLoop() *EventLoop + func (c *Channel) Remove() + func (c *Channel) SetCloseCallback(cb EventCallback) + func (c *Channel) SetErrorCallback(cb EventCallback) + func (c *Channel) SetIndex(idx int) + func (c *Channel) SetReadCallback(cb ReadEventCallback) + func (c *Channel) SetRevents(revt int16) + func (c *Channel) SetWriteCallback(cb EventCallback) + type CloseCallback func(*TcpConnection) + type ConnectionCallback func(*TcpConnection) + type Connector struct + func NewConnector(loop *EventLoop, addr *netip.AddrPort) *Connector + func (c *Connector) Restart() + func (c *Connector) SetConnectorNewConnectionCallback(cb ConnectorNewConnectionCallback) + func (c *Connector) Start() + func (c *Connector) Stop() + type ConnectorNewConnectionCallback func(int) + type EpollPoller struct + func NewEpollPoller(loop *EventLoop) (ep *EpollPoller) + func (e *EpollPoller) AssertInLoopGoroutine() + func (e *EpollPoller) Poll(timeoutMs int, activeChannels *[]*Channel) time.Time + func (e *EpollPoller) RemoveChannel(channel *Channel) + func (e *EpollPoller) UpdateChannel(channel *Channel) + type EventCallback func() + type EventLoop struct + func NewEventLoop() (el *EventLoop) + func (loop *EventLoop) AssertInLoopGoroutine() + func (loop *EventLoop) Cancel(timerid TimerId) + func (loop *EventLoop) DoPendingFunctors() + func (loop *EventLoop) HandleRead(t time.Time) + func (loop *EventLoop) IsInLoopGoroutine() bool + func (loop *EventLoop) Loop() + func (loop *EventLoop) QueueInLoop(cb Functor) + func (loop *EventLoop) Quit() + func (loop *EventLoop) RemoveChannel(c *Channel) + func (loop *EventLoop) RunAfter(duration time.Duration, cb TimerCallback) TimerId + func (loop *EventLoop) RunAt(t time.Time, cb TimerCallback) TimerId + func (loop *EventLoop) RunEvery(interval float64, cb TimerCallback) TimerId + func (loop *EventLoop) RunInLoop(cb Functor) + func (loop *EventLoop) UpdateChannel(c *Channel) + func (loop *EventLoop) Wakeup() + type EventLoopGoroutine struct + func NewEventLoopGoroutine(cb GoroutineCallback) (elg *EventLoopGoroutine) + func (elg *EventLoopGoroutine) StartLoop() *EventLoop + type EventLoopGoroutinePool struct + func NewEventLoopGoroutinePool(baseLoop *EventLoop) *EventLoopGoroutinePool + func (ep *EventLoopGoroutinePool) GetNextLoop() (loop *EventLoop) + func (ep *EventLoopGoroutinePool) IsStarted() bool + func (ep *EventLoopGoroutinePool) SetGoroutineNum(num int) + func (ep *EventLoopGoroutinePool) Start(cb GoroutineCallback) + type Functor func() + type GoroutineCallback func(*EventLoop) + type HighWaterMarkCallback func(*TcpConnection, int) + type Log struct + IsOpenDebugLog bool + func (d *Log) Printf(format string, v ...any) + func (d *Log) TurnOffLog() + func (d *Log) TurnOnLog() + type MessageCallback func(*TcpConnection, *Buffer, time.Time) + type PollPoller struct + func NewPollPoller(loop *EventLoop) *PollPoller + func (p *PollPoller) AssertInLoopGoroutine() + func (p *PollPoller) Poll(timeoutMs int, activeChannels *[]*Channel) time.Time + func (p *PollPoller) RemoveChannel(channel *Channel) + func (p *PollPoller) UpdateChannel(channel *Channel) + type Poller interface + Poll func(timeoutMs int, activeChannels *[]*Channel) time.Time + RemoveChannel func(channel *Channel) + UpdateChannel func(channel *Channel) + func NewDefaultPoller(loop *EventLoop) Poller + type ReadEventCallback func(time.Time) + type TcpClient struct + func NewTcpClient(loop *EventLoop, serverAddr *netip.AddrPort, name string) (client *TcpClient) + func (tc *TcpClient) Connect() + func (tc *TcpClient) Disconnect() + func (tc *TcpClient) EnableRetry() + func (tc *TcpClient) GetLoop() *EventLoop + func (tc *TcpClient) IsRetry() bool + func (tc *TcpClient) Name() string + func (tc *TcpClient) SetConnectionCallback(cb ConnectionCallback) + func (tc *TcpClient) SetMessageCallback(cb MessageCallback) + func (tc *TcpClient) SetWriteCompleteCallback(cb WriteCompleteCallback) + func (tc *TcpClient) Stop() + type TcpConnection struct + func NewTcpConnection(loop *EventLoop, name string, fd int, localAddr *netip.AddrPort, ...) (conn *TcpConnection) + func (tc *TcpConnection) BindWriteCompleteCallback() func() + func (tc *TcpConnection) ConnectDestroyed() + func (tc *TcpConnection) ConnectEstablished() + func (tc *TcpConnection) Connected() bool + func (tc *TcpConnection) GetLoop() *EventLoop + func (tc *TcpConnection) InBuffer() *Buffer + func (tc *TcpConnection) LocalAddr() *netip.AddrPort + func (tc *TcpConnection) Name() string + func (tc *TcpConnection) OutBuffer() *Buffer + func (tc *TcpConnection) PeerAddr() *netip.AddrPort + func (tc *TcpConnection) Send(message []byte) + func (tc *TcpConnection) SendFromBuffer(buf *Buffer) + func (tc *TcpConnection) SetCloseCallback(cb CloseCallback) + func (tc *TcpConnection) SetConnectionCallback(cb ConnectionCallback) + func (tc *TcpConnection) SetHighWaterMarkCallback(cb HighWaterMarkCallback) + func (tc *TcpConnection) SetMessageCallback(cb MessageCallback) + func (tc *TcpConnection) SetTcpNoDelay(on bool) + func (tc *TcpConnection) SetWriteCompleteCallback(cb WriteCompleteCallback) + func (tc *TcpConnection) Shutdown() + type TcpServer struct + func NewTcpServer(loop *EventLoop, addr *netip.AddrPort, name string) (server *TcpServer) + func (t *TcpServer) SetConnectionCallback(cb ConnectionCallback) + func (t *TcpServer) SetGoroutineCallback(cb GoroutineCallback) + func (t *TcpServer) SetGoroutineNum(num int) + func (t *TcpServer) SetMessageCallback(cb MessageCallback) + func (t *TcpServer) SetWriteCompleteCallback(cb WriteCompleteCallback) + func (t *TcpServer) Start() + type TimeEntry struct + type Timer struct + func NewTimer(cb TimerCallback, when time.Time, interval float64) *Timer + func (t *Timer) Expiration() time.Time + func (t *Timer) Repeat() bool + func (t *Timer) Restart(now time.Time) + func (t *Timer) Run() + func (t *Timer) Sequence() int64 + type TimerCallback func() + type TimerId struct + Sequence_ int64 + Timer_ *Timer + func NewTimerId(timer *Timer, seq int64) TimerId + type TimerList []TimeEntry + func (t *TimerList) Pop() any + func (t *TimerList) Push(x any) + func (t TimerList) Len() int + func (t TimerList) Less(i, j int) bool + func (t TimerList) Swap(i, j int) + type TimerQueue struct + func NewTimerQueue(loop *EventLoop) (tq *TimerQueue) + func (tq *TimerQueue) AddTimer(cb TimerCallback, when time.Time, interval float64) TimerId + func (tq *TimerQueue) Cancel(timerid TimerId) + func (tq *TimerQueue) HandleRead(t time.Time) + type WriteCompleteCallback func(*TcpConnection)