Resource

pollable

An object supporting generic async operations.

Can be a http-body.body, http-req.pending-response, http-req.pending-request, cache.pending-entry. kv-store.pending-lookup, kv-store.pending-insert, kv-store.pending-delete, or kv-store.pending-list.

Each async item has an associated I/O action:

  • Pending requests: awaiting the response headers / response object
  • Normal bodies: reading bytes from the body
  • Streaming bodies: writing bytes to the body

For writing bytes, there is a large buffer associated with the handle that bytes can eagerly be written into, even before the origin itself consumes that data.

resource pollable;

F is-ready

is-ready: func() -> bool;

Make a nonblocking attempt to complete the I/O operation.

Returns true if the given async item is “ready” for its associated I/O action, false otherwise.

If an object is ready, the I/O action is guaranteed to complete without blocking.

Valid object handles includes bodies and pending requests. See the async-io.pollable definition for more details, including what I/O actions are associated with each handle type.

F new-ready

new-ready: func() -> pollable;

Create a new trivial pollable which reports being immediately ready.