loop

package
v0.0.0-...-6fb83e4 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// WaitPoll monitors completion queue by polling (or IO_URING_ENTER with minComplete=0 in case of IOPOLL)
	WaitPoll uint = iota
	// WaitEnter monitors completion queue by waiting on IO_URING_ENTER with minComplete=1
	// Registering files and buffers requires uring to become idle, with WaitEnter we are
	// blocking until the next event is completed. Even if queue is empty this
	// makes uring think that it is not idle. As a consequence Registering files
	// or buffers leads to deadlock.
	WaitEnter
	// WaitEventfd wathches eventfd of each queue in the shard.
	WaitEventfd
)
View Source
const (
	// FlagSharedWorkers shares worker pool from the first ring instance between all shards in the queue.
	FlagSharedWorkers = 1 << iota

	// FlagBatchSubmission enables feature to batch individual submission together
	// in one unix. If this flag is set SubmissionTimer option must be set as well.
	FlagBatchSubmission
)

Variables

View Source
var (
	// ErrClosed returned if queue was closed.
	ErrClosed = errors.New("uring: closed")
)

Functions

This section is empty.

Types

type Loop

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

Loop ...

func Setup

func Setup(size uint, params *uring.IOUringParams, qp *Params) (*Loop, error)

Setup setups requested number of shards, with shared kernel worker pool.

func (*Loop) BatchSyscall

func (q *Loop) BatchSyscall(cqes []uring.CQEntry, opts []SQOperation, ptrs ...uintptr) ([]uring.CQEntry, error)

BatchSyscall ...

func (*Loop) Close

func (q *Loop) Close() (err0 error)

Close closes every shard queue, epoll instance and unregister eventfds. Close works as follows: - request close on each queue - once any queue exits - completionLoop will be terminated - once completion loop terminated - unregister eventfd's and close rings

func (*Loop) RegisterBuffers

func (q *Loop) RegisterBuffers(iovec []unix.Iovec) (err error)

RegisterBuffers will register buffers on all rings (shards). Note that registration is done with unix, and will have to wait until rings are idle. TODO test if IORING_OP_PROVIDE_BUFFERS is supported (5.7?)

func (*Loop) RegisterFiles

func (q *Loop) RegisterFiles(fds []int32) (err error)

RegisterFiles ...

func (*Loop) Syscall

func (q *Loop) Syscall(opt SQOperation, ptrs ...uintptr) (uring.CQEntry, error)

Syscall executes operation on one of the internal queues. Additionaly it prevents ptrs from being moved to another location while Syscall is in progress. WARNING: don't use interface that hides this method. https://github.com/golang/go/issues/16035#issuecomment-231107512.

func (*Loop) UnregisterBuffers

func (q *Loop) UnregisterBuffers() (err error)

UnregisterBuffers ...

func (*Loop) UnregisterFiles

func (q *Loop) UnregisterFiles() (err error)

UnregisterFiles ...

func (*Loop) UpdateFiles

func (q *Loop) UpdateFiles(fds []int32, off uint32) (err error)

UpdateFiles ...

type Params

type Params struct {
	Rings           int
	WaitMethod      uint
	Flags           uint
	SubmissionTimer time.Duration
}

Params ...

type SQOperation

type SQOperation func(sqe *uring.SQEntry)

Jump to

Keyboard shortcuts

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