d382017dc6
Motivation: It's desirable to be able to access the contents of a Buf via an array or a ByteBuffer. However, we would also like to have a unified API that works for both composite and non-composite buffers. Even for nested composite buffers. Modification: Add a forEachReadable method, which uses internal iteration to process all buffer components. The internal iteration allows us to hide any nesting of composite buffers. The consumer in the internal iteration is presented with a Component object, which exposes the contents in various ways. The data is exposed from the Component via methods, such that anything that is expensive to create, will not have to be paid for unless it is used. This mechanism also let us avoid any allocation unnecessary allocation; the ByteBuffers and arrays will necessarily have to be allocated, but the consumer may or may not need allocation depending on how it's implemented, and the component objects do not need to be allocated, because the non-composite buffers can directly implement the Component interface. Result: It's now possible to access the contents of Buf instances as arrays or ByteBuffers, without having to copy the data. |
||
---|---|---|
.github/workflows | ||
src | ||
.dockerignore | ||
.gitignore | ||
Dockerfile | ||
Makefile | ||
pom.xml | ||
README.md |
Netty Incubator Buffer API
This repository is incubating a new buffer API proposed for Netty 5.
Building and Testing
Short version: just run make
.
The project currently relies on snapshot versions of the Panama Foreign fork of OpenJDK.
This allows us to test out the most recent version of the jdk.incubator.foreign
APIs, but also make building, and local development more involved.
To simplify things, we have a Docker based build, controlled via a Makefile with the following commands:
image
– build the docker image. This includes building a snapshot of OpenJDK, and download all relevant Maven dependencies.test
– run all tests in a docker container. This impliesimage
. The container is automatically deleted afterwards.dbg
– drop into a shell in the build container, without running the build itself. The debugging container is not deleted afterwards.clean
– remove the leftover containers created bydbg
,test
, andbuild
.build
– build binaries and run all tests in a container, and copy thetarget
directory out of the container afterwards. This is the default build target.