epollgo

package
v0.0.0-...-9493ce7 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcceptEventHook

type AcceptEventHook func() bool

AcceptEventHook 接受事件钩子

type Ctx

type Ctx struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Ctx 处理器

func NewCtx

func NewCtx(options ...CtxOption) *Ctx

NewCtx 工厂方法

func (*Ctx) AcceptEvent

func (object *Ctx) AcceptEvent(fd int, addr unix.Sockaddr) bool

AcceptEvent 接受

func (*Ctx) Close

func (object *Ctx) Close()

Close 关闭

func (*Ctx) GetID

func (object *Ctx) GetID() int32

GetID 获取ID

func (*Ctx) GetPort

func (object *Ctx) GetPort() int

GetPort 获取端口

func (*Ctx) GetV4IP

func (object *Ctx) GetV4IP() string

GetV4IP 获取IP地址

func (*Ctx) IsReadShutdown

func (object *Ctx) IsReadShutdown() bool

IsReadShutdown 是否读已关闭

func (*Ctx) IsWriteShutdown

func (object *Ctx) IsWriteShutdown() bool

IsShutdownWrite 是否写已关闭

func (*Ctx) ReadEvent

func (object *Ctx) ReadEvent()

ReadEvent 处理读

func (*Ctx) SetOption

func (object *Ctx) SetOption(options ...CtxOption) *Ctx

SetOption 设置可选项

func (*Ctx) ShutdownSocket

func (object *Ctx) ShutdownSocket(readOrWrite bool)

ShutdownSocket 关闭socket

func (*Ctx) Write

func (object *Ctx) Write(buf *byte_buf.ByteBuf)

Write 异步写

func (*Ctx) WriteEvent

func (object *Ctx) WriteEvent(buf *byte_buf.ByteBuf, err error)

WriteEvent 处理写

type CtxFactory

type CtxFactory func(eventLoop *EventLoop) *Ctx

CtxFactory Ctx工厂

type CtxOption

type CtxOption func(ctx *Ctx)

CtxOption 上下文选项

func CtxAcceptEventHookOption

func CtxAcceptEventHookOption(hook AcceptEventHook) CtxOption

CtxAcceptEventHookOption 接受事件钩子选项

func CtxBufferSizeOption

func CtxBufferSizeOption(size int) CtxOption

CtxBufferSizeOption 缓冲区大小选项

func CtxEventLoopOption

func CtxEventLoopOption(eventLoop *EventLoop) CtxOption

CtxEventLoopOption EventLoop选项

func CtxIDOption

func CtxIDOption(id int32) CtxOption

CtxIDOption ID选项

func CtxReadEventHookOption

func CtxReadEventHookOption(hook ReadEventHook) CtxOption

CtxReadEventHookOption 读取事件钩子选项

func CtxWriteEventHookOption

func CtxWriteEventHookOption(hook WriteEventHook) CtxOption

CtxWriteEventHookOption 写事件钩子选项

type EventLoop

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

EventLoop 事件循环

func New

func New() (object *EventLoop, err error)

New 工厂方法

func (*EventLoop) Group

func (object *EventLoop) Group(slave *EventLoop) *EventLoop

Group 组合

func (*EventLoop) Listen

func (object *EventLoop) Listen(port int,
	options ...EventLoopOption,
) (err error)

Listen 侦听

func (*EventLoop) SetCtxFactory

func (object *EventLoop) SetCtxFactory(factory CtxFactory) *EventLoop

SetCtxFactory 设置Ctx工厂

func (*EventLoop) Start

func (object *EventLoop) Start() (err error)

Start 启动

func (*EventLoop) Stop

func (object *EventLoop) Stop()

Stop 停止

type EventLoopOption

type EventLoopOption func(object *EventLoop)

EventLoopOption 事件循环选项

func EventLoopBacklogOption

func EventLoopBacklogOption(backlog int) EventLoopOption

EventLoopBacklogOption 完成队列长度选项

type ReadEventHook

type ReadEventHook func(buf *byte_buf.ByteBuf, err error)

ReadEventHook 读事件钩子

type WriteEventHook

type WriteEventHook func(buf *byte_buf.ByteBuf, err error)

WriteEventHook 写事件钩子

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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