Commit Graph

13 Commits

Author SHA1 Message Date
Chris Vest
6506e29569 Make tests on composite buffers pass again 2021-04-28 12:33:40 +02:00
Chris Vest
e1cc445d11 The CompositeBuffer.compose methods must return CompositeBuffer instead of Buffer 2021-04-28 12:27:03 +02:00
Chris Vest
f2033263dd Replace CompositeBuffer.extendComposite with extendWith 2021-04-27 16:11:30 +02:00
Chris Vest
2f12455fa9 Make CompositeBuffer part of the public API
And move the composite buffer related methods to it.
2021-04-27 16:11:30 +02:00
Chris Vest
86c929dd5a Remove Deref
This abstraction was only used to allow composing over both buffers and sends of buffers, but we can also do that with method overloads.

The Deref had weird semantics and consequences that didn't make much sense.
In other words, it did not pay a return on its complexity cost.
2021-04-27 16:11:30 +02:00
Chris Vest
7775460984 Make bifurcate and ensureWritable more flexible
This supports more use cases.
The ensureWritable method can now amortise its allocation cost by allocating more than what is strictly necessary to satisfy the immediate call.
The bifurcate method can now split at a given offset.
2021-04-27 10:00:27 +02:00
Chris Vest
95709828bf Add a ByteBuffer based implementation of Buffer
Motivation:
We need a new implementation of our new API that supports Java 11, since that is what Netty 5 will most likely baseline on.
We also need an implementation that does not rely on Unsafe.
This leaves us with ByteBuffer as the underlying currency of memory.

Modification:
- Add a NioBuffer implementation and associated supporting classes.
- The entry-point for this is a new MemoryManagers API, which is used to pick the implementation and provide the on-/off-heap MemoryManager implementations.
- Add a mechanism to configure/override which MemoryManagers implementation to use.
- The MemoryManagers implementations are service-loadable, so new ones can be discovered at runtime.
- The existing MemorySegment based implementation also get a MemoryManagers implementation.
- Expand the BufferTest to include all combinations of all implementations. We now run 360.000 tests in BufferTest.
- Some common infrastructure, like ArcDrop, is moved to its own package.
- Add a module-info.java to control the service loading, and the visibility in the various packages.
- Some pom.xml file updates to support our now module based project.

Result:
We have an implementation that should work on Java 11, but we currently don't build or test on 11.
More work needs to happen before that is a reality.
2021-03-18 15:18:22 +01:00
Chris Vest
de305bd6b9 Align slice sendability of composite buffers with that of non-composite buffers
This means we no longer need to have tests that are parameterised over non-sliced buffers.
2021-03-16 17:22:41 +01:00
Chris Vest
d40989da78 Add toString implementations to all Drop implementations
This is helpful when debugging.
2021-03-16 17:20:35 +01:00
Chris Vest
2dee6f8516 Fix bounds checking bugs when setting bytes
These should not take the read offset into account.
2021-03-09 16:16:38 +01:00
Chris Vest
56bfa22d4a Align Buffer.get* bounds checks with their documented behaviour
The get* methods bounds checking accesses between 0 and the write offset, and the tests were confirming this behaviour.

This was wrong because it is not symmetric with the set* methods, which bounds check between 0 and the capacity, and does not modify the write offset.

The tests and methods have been updated so the get* methods now bounds check between 0 and the capacity.
2021-03-09 12:02:46 +01:00
Chris Vest
5434fa88b4 Explode ComponentProcessor into its contained interfaces 2021-02-12 18:28:29 +01:00
Chris Vest
eef97dd1fd Rename Buf to Buffer and Allocator to BufferAllocator 2021-02-12 18:22:07 +01:00