examples

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package examples contains small, runnable snippets that demonstrate how to use iox's non-blocking semantics in typical copy-style flows.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyWithErrMore

func CopyWithErrMore() (
	firstN int64, firstErr error,
	secondN int64, secondErr error,
	thirdN int64, thirdErr error,
	out string,
)

CopyWithErrMore demonstrates handling of ErrMore across repeated calls.

Contract for this scripted source:

  • First attempt: progress + ErrMore (more completions will follow).
  • Second attempt: progress + ErrMore (still ongoing).
  • Third attempt: progress + nil (final completion of the logical op).

Caller must treat ErrMore as: "process this completion and keep the operation active; retry after the next poll/CQE".

func CopyWithPolicy added in v0.2.0

func CopyWithPolicy() (n int64, err error, out string)

CopyWithPolicy shows how to specify a SemanticPolicy for Copy.

In most cases you don't pass a policy (nil keeps the default non-blocking behavior), but if you want the helper to yield/retry on ErrWouldBlock, pass a policy that returns PolicyRetry and provides a Yield hook.

func CopyWithWouldBlock

func CopyWithWouldBlock() (firstN int64, firstErr error, secondN int64, secondErr error, out string)

CopyWithWouldBlock demonstrates that ErrWouldBlock means "stop now and retry after readiness". The first copy returns (0, ErrWouldBlock); the second copy makes progress and completes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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