aio

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2025 License: LGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReadyOperationStatus int64 = iota
	ProcessingOperationStatus
	HijackedOperationStatus
	CompletedOperationStatus
)
View Source
const (
	DefaultFlagsSchema     = "DEFAULT"
	PerformanceFlagsSchema = "PERFORMANCE"
)
View Source
const (
	MaxSpliceSize = 1 << 20
)

Variables

View Source
var (
	Uncompleted   = errors.New("uncompleted")
	Timeout       = &TimeoutError{}
	UnsupportedOp = errors.New("unsupported op")
)

Functions

func CheckSendMsdZCEnable

func CheckSendMsdZCEnable() bool

func CheckSendZCEnable

func CheckSendZCEnable() bool

func IsTimeout

func IsTimeout(err error) bool

func IsUncompleted

func IsUncompleted(err error) bool

func IsUnsupported

func IsUnsupported(err error) bool

func PrepareInitIOURingOptions added in v1.2.2

func PrepareInitIOURingOptions(options ...Option)

func Release added in v1.1.0

func Release(v *Vortex) (err error)

func ReleaseSplicePipe

func ReleaseSplicePipe(pipe *SplicePipe)

Types

type Curve

type Curve []struct {
	N       uint32
	Timeout time.Duration
}

type CurveTransmission

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

func (*CurveTransmission) Down added in v0.5.0

func (tran *CurveTransmission) Down() (uint32, *syscall.Timespec)

func (*CurveTransmission) Up added in v0.5.0

func (tran *CurveTransmission) Up() (uint32, *syscall.Timespec)

type FixedBuffer added in v1.3.0

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

func (*FixedBuffer) Index added in v1.3.0

func (buf *FixedBuffer) Index() int

func (*FixedBuffer) Length added in v1.3.0

func (buf *FixedBuffer) Length() int

func (*FixedBuffer) Read added in v1.3.0

func (buf *FixedBuffer) Read(b []byte) (int, error)

func (*FixedBuffer) Reset added in v1.3.0

func (buf *FixedBuffer) Reset()

func (*FixedBuffer) Source added in v1.5.3

func (buf *FixedBuffer) Source() uint32

func (*FixedBuffer) Validate added in v1.3.0

func (buf *FixedBuffer) Validate() bool

func (*FixedBuffer) Write added in v1.3.0

func (buf *FixedBuffer) Write(b []byte) (n int, err error)

type Future

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

func (Future) Await

func (f Future) Await(ctx context.Context) (n int, cqeFlags uint32, err error)

func (Future) AwaitMsg

func (f Future) AwaitMsg(ctx context.Context) (n int, oobn int, flags int, addr unsafe.Pointer, addrLen uint32, cqeFlags uint32, err error)

type Operation

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

func NewOperation

func NewOperation(resultChanBuffer int) *Operation

func (*Operation) Addr

func (op *Operation) Addr() (addr *syscall.RawSockaddrAny, addrLen int)

func (*Operation) Close added in v1.5.4

func (op *Operation) Close()

func (*Operation) Complete added in v1.5.4

func (op *Operation) Complete()

func (*Operation) Control

func (op *Operation) Control() []byte

func (*Operation) ControlLen

func (op *Operation) ControlLen() int

func (*Operation) Flags

func (op *Operation) Flags() int

func (*Operation) Hijack added in v1.5.4

func (op *Operation) Hijack()

func (*Operation) Name

func (op *Operation) Name() string

func (*Operation) PrepareAccept

func (op *Operation) PrepareAccept(fd int, addr *syscall.RawSockaddrAny, addrLen int)

func (*Operation) PrepareCancel

func (op *Operation) PrepareCancel(target *Operation)

func (*Operation) PrepareClose added in v0.2.0

func (op *Operation) PrepareClose(fd int)

func (*Operation) PrepareConnect

func (op *Operation) PrepareConnect(fd int, addr *syscall.RawSockaddrAny, addrLen int)

func (*Operation) PrepareNop

func (op *Operation) PrepareNop() (err error)

func (*Operation) PrepareReadFixed added in v1.3.0

func (op *Operation) PrepareReadFixed(fd int, buf *FixedBuffer)

func (*Operation) PrepareReceive

func (op *Operation) PrepareReceive(fd int, b []byte)

func (*Operation) PrepareReceiveMsg

func (op *Operation) PrepareReceiveMsg(fd int, b []byte, oob []byte, addr *syscall.RawSockaddrAny, addrLen int, flags int32)

func (*Operation) PrepareSend

func (op *Operation) PrepareSend(fd int, b []byte)

func (*Operation) PrepareSendMsg

func (op *Operation) PrepareSendMsg(fd int, b []byte, oob []byte, addr *syscall.RawSockaddrAny, addrLen int, flags int32)

func (*Operation) PrepareSendMsgZC

func (op *Operation) PrepareSendMsgZC(fd int, b []byte, oob []byte, addr *syscall.RawSockaddrAny, addrLen int, flags int32)

func (*Operation) PrepareSendZC

func (op *Operation) PrepareSendZC(fd int, b []byte)

func (*Operation) PrepareSplice

func (op *Operation) PrepareSplice(fdIn int, offIn int64, fdOut int, offOut int64, nbytes uint32, flags uint32)

func (*Operation) PrepareTee

func (op *Operation) PrepareTee(fdIn int, fdOut int, nbytes uint32, flags uint32)

func (*Operation) PrepareWriteFixed added in v1.3.0

func (op *Operation) PrepareWriteFixed(fd int, buf *FixedBuffer)

func (*Operation) Timeout

func (op *Operation) Timeout() time.Duration

func (*Operation) WithDeadline

func (op *Operation) WithDeadline(deadline time.Time) *Operation

type Option

type Option func(*Options)

func WithEntries

func WithEntries(entries int) Option

func WithFlags

func WithFlags(flags uint32) Option

func WithFlagsSchema added in v1.2.2

func WithFlagsSchema(schema string) Option

func WithPrepareSQEAFFCPU added in v1.5.3

func WithPrepareSQEAFFCPU(cpu int) Option

func WithPrepareSQEBatchSize added in v1.5.3

func WithPrepareSQEBatchSize(size uint32) Option

func WithPrepareSQEIdleTime added in v1.5.3

func WithPrepareSQEIdleTime(d time.Duration) Option

func WithRegisterFixedBuffer added in v1.3.0

func WithRegisterFixedBuffer(size uint32, count uint32) Option

func WithSQThreadCPU added in v1.2.0

func WithSQThreadCPU(cpuId uint32) Option

func WithSQThreadIdle added in v1.2.0

func WithSQThreadIdle(idle uint32) Option

func WithWaitCQEAFFCPU added in v1.5.3

func WithWaitCQEAFFCPU(cpu int) Option

func WithWaitCQEBatchSize added in v1.5.3

func WithWaitCQEBatchSize(size uint32) Option

func WithWaitCQETimeCurve added in v1.5.3

func WithWaitCQETimeCurve(curve Curve) Option

type Options

type Options struct {
	Entries                  uint32
	Flags                    uint32
	SQThreadCPU              uint32
	SQThreadIdle             uint32
	RegisterFixedBufferSize  uint32
	RegisterFixedBufferCount uint32
	PrepSQEBatchSize         uint32
	PrepSQEIdleTime          time.Duration
	PrepSQEAffCPU            int
	WaitCQEBatchSize         uint32
	WaitCQETimeCurve         Curve
	WaitCQEAffCPU            int
}

type Queue

type Queue[E any] struct {
	// contains filtered or unexported fields
}

func NewQueue

func NewQueue[E any]() *Queue[E]

func (*Queue[E]) Advance

func (q *Queue[E]) Advance(n uint32)

func (*Queue[E]) Dequeue

func (q *Queue[E]) Dequeue() *E

func (*Queue[E]) Enqueue

func (q *Queue[E]) Enqueue(entry *E)

func (*Queue[E]) Length

func (q *Queue[E]) Length() int64

func (*Queue[E]) PeekBatch

func (q *Queue[E]) PeekBatch(entries []*E) (n uint32)

type Result

type Result struct {
	N     int
	Flags uint32
	Err   error
}

type SplicePipe

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

func AcquireSplicePipe

func AcquireSplicePipe() (*SplicePipe, error)

func NewSplicePipe

func NewSplicePipe() *SplicePipe

func (*SplicePipe) Close

func (pipe *SplicePipe) Close() (err error)

func (*SplicePipe) DrainN

func (pipe *SplicePipe) DrainN(n int)

func (*SplicePipe) PumpN

func (pipe *SplicePipe) PumpN(n int)

func (*SplicePipe) ReaderFd

func (pipe *SplicePipe) ReaderFd() int

func (*SplicePipe) WriterFd

func (pipe *SplicePipe) WriterFd() int

type TimeoutError

type TimeoutError struct{}

func (*TimeoutError) Error

func (e *TimeoutError) Error() string

func (*TimeoutError) Is

func (e *TimeoutError) Is(err error) bool

func (*TimeoutError) Temporary

func (e *TimeoutError) Temporary() bool

func (*TimeoutError) Timeout

func (e *TimeoutError) Timeout() bool

type Transmission

type Transmission interface {
	Up() (uint32, *syscall.Timespec)
	Down() (uint32, *syscall.Timespec)
}

func NewCurveTransmission

func NewCurveTransmission(curve Curve) Transmission

type Vortex

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

func Acquire added in v1.1.0

func Acquire() (v *Vortex, err error)

func New

func New(options ...Option) (v *Vortex, err error)

func (*Vortex) Accept added in v1.2.0

func (vortex *Vortex) Accept(ctx context.Context, fd int, addr *syscall.RawSockaddrAny, addrLen int, deadline time.Time) (n int, err error)

func (*Vortex) AcquireBuffer added in v1.3.0

func (vortex *Vortex) AcquireBuffer() *FixedBuffer

func (*Vortex) AwaitOperation added in v1.5.4

func (vortex *Vortex) AwaitOperation(ctx context.Context, op *Operation) (n int, cqeFlags uint32, err error)

func (*Vortex) Cancel

func (vortex *Vortex) Cancel(target *Operation) (ok bool)

func (*Vortex) Close

func (vortex *Vortex) Close(ctx context.Context, fd int) (err error)

func (*Vortex) Connect added in v1.2.0

func (vortex *Vortex) Connect(ctx context.Context, fd int, addr *syscall.RawSockaddrAny, addrLen int, deadline time.Time) (n int, err error)

func (*Vortex) PrepareAccept

func (vortex *Vortex) PrepareAccept(fd int, addr *syscall.RawSockaddrAny, addrLen int, deadline time.Time) Future

func (*Vortex) PrepareClose added in v0.2.0

func (vortex *Vortex) PrepareClose(fd int) Future

func (*Vortex) PrepareConnect

func (vortex *Vortex) PrepareConnect(fd int, addr *syscall.RawSockaddrAny, addrLen int, deadline time.Time) Future

func (*Vortex) PrepareOperation

func (vortex *Vortex) PrepareOperation(op *Operation) Future

func (*Vortex) PrepareReadFixed added in v1.3.0

func (vortex *Vortex) PrepareReadFixed(fd int, buf *FixedBuffer, deadline time.Time) Future

func (*Vortex) PrepareReceive

func (vortex *Vortex) PrepareReceive(fd int, b []byte, deadline time.Time) Future

func (*Vortex) PrepareReceiveMsg

func (vortex *Vortex) PrepareReceiveMsg(fd int, b []byte, oob []byte, addr *syscall.RawSockaddrAny, addrLen int, flags int32, deadline time.Time) Future

func (*Vortex) PrepareSend

func (vortex *Vortex) PrepareSend(fd int, b []byte, deadline time.Time) Future

func (*Vortex) PrepareSendMsg

func (vortex *Vortex) PrepareSendMsg(fd int, b []byte, oob []byte, addr *syscall.RawSockaddrAny, addrLen int, flags int32, deadline time.Time) Future

func (*Vortex) PrepareSendMsgZC

func (vortex *Vortex) PrepareSendMsgZC(fd int, b []byte, oob []byte, addr *syscall.RawSockaddrAny, addrLen int, flags int32, deadline time.Time) Future

func (*Vortex) PrepareSendZC

func (vortex *Vortex) PrepareSendZC(fd int, b []byte, deadline time.Time) Future

func (*Vortex) PrepareSplice

func (vortex *Vortex) PrepareSplice(fdIn int, offIn int64, fdOut int, offOut int64, nbytes uint32, flags uint32) Future

func (*Vortex) PrepareTee

func (vortex *Vortex) PrepareTee(fdIn int, fdOut int, nbytes uint32, flags uint32) Future

func (*Vortex) PrepareWriteFixed added in v1.3.0

func (vortex *Vortex) PrepareWriteFixed(fd int, buf *FixedBuffer, deadline time.Time) Future

func (*Vortex) ReadFixed added in v1.3.0

func (vortex *Vortex) ReadFixed(ctx context.Context, fd int, buf *FixedBuffer, deadline time.Time) (n int, err error)

func (*Vortex) Receive added in v1.2.0

func (vortex *Vortex) Receive(ctx context.Context, fd int, b []byte, deadline time.Time) (n int, err error)

func (*Vortex) ReceiveFrom added in v1.2.0

func (vortex *Vortex) ReceiveFrom(ctx context.Context, fd int, b []byte, addr *syscall.RawSockaddrAny, addrLen int, deadline time.Time) (n int, err error)

func (*Vortex) ReceiveMsg added in v1.2.0

func (vortex *Vortex) ReceiveMsg(ctx context.Context, fd int, b []byte, oob []byte, addr *syscall.RawSockaddrAny, addrLen int, flags int, deadline time.Time) (n int, oobn int, flag int, err error)

func (*Vortex) RegisterFixedFile added in v1.5.4

func (vortex *Vortex) RegisterFixedFile(fd int) (index uint32, err error)

func (*Vortex) ReleaseBuffer added in v1.3.0

func (vortex *Vortex) ReleaseBuffer(buf *FixedBuffer)

func (*Vortex) Send added in v1.2.0

func (vortex *Vortex) Send(ctx context.Context, fd int, b []byte, deadline time.Time) (n int, err error)

func (*Vortex) SendMsg added in v1.2.0

func (vortex *Vortex) SendMsg(ctx context.Context, fd int, b []byte, oob []byte, addr *syscall.RawSockaddrAny, addrLen int, deadline time.Time) (n int, oobn int, err error)

func (*Vortex) SendMsgZC added in v1.2.0

func (vortex *Vortex) SendMsgZC(ctx context.Context, fd int, b []byte, oob []byte, addr *syscall.RawSockaddrAny, addrLen int, deadline time.Time) (n int, oobn int, err error)

func (*Vortex) SendTo added in v1.2.0

func (vortex *Vortex) SendTo(ctx context.Context, fd int, b []byte, addr *syscall.RawSockaddrAny, addrLen int, deadline time.Time) (n int, err error)

func (*Vortex) SendToZC added in v1.2.0

func (vortex *Vortex) SendToZC(ctx context.Context, fd int, b []byte, addr *syscall.RawSockaddrAny, addrLen int, deadline time.Time) (n int, err error)

func (*Vortex) SendZC added in v1.2.0

func (vortex *Vortex) SendZC(ctx context.Context, fd int, b []byte, deadline time.Time) (n int, err error)

func (*Vortex) Sendfile

func (vortex *Vortex) Sendfile(ctx context.Context, dst int, r io.Reader, useZC bool) (written int64, err error)

func (*Vortex) Shutdown added in v1.2.0

func (vortex *Vortex) Shutdown() (err error)

func (*Vortex) Splice

func (vortex *Vortex) Splice(ctx context.Context, dst int, src int, remain int64) (n int64, err error)

func (*Vortex) Start

func (vortex *Vortex) Start(ctx context.Context) (err error)

func (*Vortex) UnregisterFixedFile added in v1.5.4

func (vortex *Vortex) UnregisterFixedFile(index uint32) (err error)

func (*Vortex) WriteFixed added in v1.3.0

func (vortex *Vortex) WriteFixed(ctx context.Context, fd int, buf *FixedBuffer, deadline time.Time) (n int, err error)

type WaitNTime added in v1.5.0

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

Jump to

Keyboard shortcuts

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