epoll

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventRead  = 1 << 1
	EventWrite = 1 << 2
)

Variables

View Source
var (
	ErrUnsupportedProtocol = errors.New("only tcp/tcp4/tcp6/unix supported")
)

Functions

func TcpListener

func TcpListener(addr string, reuseport bool) (l *tcpListener, err error)

Types

type Connection

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

func (*Connection) Access

func (c *Connection) Access()

func (*Connection) Close

func (c *Connection) Close() (err error)

func (*Connection) DelValue

func (c *Connection) DelValue(keys ...string)

func (*Connection) GetLatestAccessTime

func (c *Connection) GetLatestAccessTime() (latestAccessTime int64)

func (*Connection) GetValue

func (c *Connection) GetValue(key string) (value interface{}, exits bool)

func (*Connection) SetValue

func (c *Connection) SetValue(key string, value interface{})

type Epoll

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

func NewEpoll

func NewEpoll() (epoll *Epoll, err error)

func (*Epoll) AddRead

func (e *Epoll) AddRead(fd int) error

func (*Epoll) AddReadWrite

func (e *Epoll) AddReadWrite(fd int) error

func (*Epoll) AddWrite

func (e *Epoll) AddWrite(fd int) error

func (*Epoll) ModRead

func (e *Epoll) ModRead(fd int) error

func (*Epoll) ModReadWrite

func (e *Epoll) ModReadWrite(fd int) error

func (*Epoll) ModWrite

func (e *Epoll) ModWrite(fd int) error

func (*Epoll) Poll

func (e *Epoll) Poll(handler EventHandler)

func (*Epoll) Remove

func (e *Epoll) Remove(fd int) error

func (*Epoll) Stop

func (e *Epoll) Stop()

type EventHandler

type EventHandler func(fd int, event uint8)

type EventLoop

type EventLoop interface {
	Start() (err error)
	Accept(fd int) (err error)
	Read(conn *Connection) (err error)
	Write(conn *Connection) (err error)
}

type Listener

type Listener interface {
	Listen() (err error)
}

type Manager

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

func NewManager

func NewManager(max int) *Manager

func (*Manager) TotalConnections

func (m *Manager) TotalConnections() (count uint64)

type Server

type Server interface {
	OnInitComplete()
	OnShutdown()
	OnConnect(conn *Connection)
	OnReceive(conn *Connection, buffer []byte)
	OnClosed(conn *Connection, err error)
}

Jump to

Keyboard shortcuts

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