aio

package
v1.2.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ReadyOperationStatus int64 = iota
	ProcessingOperationStatus
	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) Match added in v0.9.0

func (tran *CurveTransmission) Match(n uint32) syscall.Timespec

type Future

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

func (Future) Await

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

func (Future) AwaitMsg

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

type Operation

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

func NewOperation

func NewOperation() *Operation

func (*Operation) Addr

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

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) 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) 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) 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 WithCurveWaitTransmission added in v1.2.2

func WithCurveWaitTransmission(curve Curve) Option

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 WithPrepareBatchSize

func WithPrepareBatchSize(size 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 WithUseCPUAffinity added in v1.1.0

func WithUseCPUAffinity(use bool) Option

func WithWaitTransmission added in v1.1.0

func WithWaitTransmission(transmission Transmission) Option

type Options

type Options struct {
	Entries          uint32
	Flags            uint32
	SQThreadCPU      uint32
	SQThreadIdle     uint32
	PrepareBatchSize uint32
	UseCPUAffinity   bool
	WaitTransmission Transmission
}

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
	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 {
	Match(n 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) 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) 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) 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) 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)

Jump to

Keyboard shortcuts

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