Commit Graph

285 Commits

Author SHA1 Message Date
Chris Vest
ef714c90d9 Hide Rc.countBorrows
The state that people really care about is whether or not an Rc has ownership.
Exposing the reference count will probably just confuse people.
The reference count is still exposed on RcSupport because it may be (and is, in the case of ByteBufAdaptor) needed to support implementation details.
2021-05-07 11:25:42 +02:00
Chris Vest
556d0acc89 Add splitComponentsFloor and splitComponentsCeil
These methods make it possible to accurately split composite buffers at component boundaries, either by rounding the offset down or up to the nearest component boundary, respectively.

Composite buffers already support the split method, but it is hard for client code to predict precisely where component boundaries are placed inside composite buffers.
When split is used with an offset that does not land exactly on a component boundary, then the internal component that the offset lands on will also be split.
This may make it harder to precisely reason about memory life cycles and reuse.
2021-05-07 10:41:46 +02:00
Chris Vest
83643a5dc9
Merge pull request #60 from netty/build-fixes
Make the build use less space on the CI host
2021-05-07 08:40:35 +02:00
Chris Vest
24b78e4a6b Invalidate existing cache keys 2021-05-06 23:26:16 +02:00
Chris Vest
0cd09f5f8b Make the build use less space on the CI host
High space usage could cause the docker layer cache to fail while packaging the layers.
2021-05-06 17:31:01 +02:00
Chris Vest
3b8aabbd10
Merge pull request #57 from netty/docker-image-reduction
Make the docker image layers take up less space
2021-05-06 10:49:51 +02:00
Chris Vest
14a0f56660 Make the docker image layers take up less space
This should make the docker layer cache in our CI build more effective, and faster.
2021-05-05 22:01:04 +02:00
Chris Vest
e4ea1d7806
Merge pull request #30 from netty/readme
Writeup of rationale behind the buffer API design
2021-05-05 18:53:34 +02:00
Chris Vest
86cc19bd76
Merge pull request #55 from netty/alloc-close
Clarify what it means to close an allocator
2021-05-05 16:39:17 +02:00
Chris Vest
5a0bf8de97 Update RATIONALE.adoc with CompositeBuffer updates and bifurcate/split rename 2021-05-05 16:20:11 +02:00
Chris Vest
2ac10d8e09 Update README after rebase 2021-05-05 16:09:53 +02:00
Chris Vest
385fb1ac27 Update section on composite buffers 2021-05-05 16:09:53 +02:00
Chris Vest
86f2326e0c Writeup of rationale behind the buffer API design 2021-05-05 16:09:53 +02:00
Chris Vest
7b48263184 Re-enable the cleaner tests and make them run faster 2021-05-05 16:09:11 +02:00
Chris Vest
2ab8dd65eb Remove unused imports 2021-05-05 16:09:11 +02:00
Chris Vest
44c476c461 Clarify what it means to close a BufferAllocator 2021-05-05 16:09:11 +02:00
Chris Vest
928f0bbb14
Merge pull request #54 from netty/const-bufs
Buffers as constants
2021-05-05 16:08:38 +02:00
Chris Vest
599c01b762 Make the buffer read-only state irreversible
This greatly simplifies the semantics around the const buffers.
When they can no longer be made writable, there is no longer any need for "deconstification".

I decided to call the method "makeReadOnly" to distinguish it from "asReadOnly" that is seen in ByteBuf and ByteBuffer. The latter two return read-only _views_ of the buffer, while makeReadOnly changes the state of the buffer in-place.
2021-05-05 12:30:52 +02:00
Chris Vest
51cc1e7cf4 More efficient const buffer implementations
The const buffers of the various implementations are now able to share the underlying memory.
At least until they are forced not to.
Const buffers will behave ust like normal buffers, except they start out as read-only.
When they are made writable, or sliced, then they will allocate their own independent copy of the memory.
That way, const buffers can have their contents changed, and behave just like normal buffers.
The const-ness is a pure optimisation that should not have any externally observable behaviour.
2021-05-03 15:00:49 +02:00
Chris Vest
d247ddeae3 Try speeding up the build some more
The number of tests we run is increasing
2021-05-02 17:07:58 +02:00
Chris Vest
3281f72369 First draft of const buffers and how to have buffers as constants
Currently only has a strawman implementation.
2021-04-30 15:35:40 +02:00
Chris Vest
8d05092c36
Merge pull request #53 from netty/split
Rename bifurcate to split
2021-04-29 16:23:05 +02:00
Chris Vest
66c2bf4e2c Rename bifurcate to split 2021-04-29 15:34:04 +02:00
Chris Vest
c665db6ec7
Merge pull request #51 from netty/composite-buffer
Composite buffer API updates
2021-04-29 11:33:53 +02:00
Chris Vest
e5d55e2a8e Use covariant return types in CompositeBuffer 2021-04-28 12:46:58 +02:00
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
ec0dbb6b5e
Merge pull request #44 from netty/slice-bifurcate
More docs and examples of slice() and bifurcate()
2021-04-27 16:10:55 +02:00
Chris Vest
0db6a745dc Always attach test results to PR builds
Previously the test results were only attached to passing builds, which is, like, the opposite of useful.

Also finally figured out how to nerf the local docker layer cache.
Recorded this new knowledge as make commands.
2021-04-27 15:06:43 +02:00
Chris Vest
49deb77fd3 Allow running AlternativeMessageDecoderTest from Maven 2021-04-27 14:09:27 +02:00
Chris Vest
25b234acd2 Make the BufferBulkAccessTest.writeBytesMustTransferDataAndUpdateOffsets test run faster
Only run a sample of 10% of the possible combinations, and then run them in parallel.
2021-04-27 13:33:28 +02:00
Chris Vest
2fc3666077 Remove deprecated maven build option from docker build 2021-04-27 10:09:40 +02:00
Chris Vest
60954394a5 Use Send.isSendOf to simplify code 2021-04-27 10:03:24 +02:00
Chris Vest
926a1807b4 Clean up code and remove the BufferAdaptor
Instead use Mockito to implement the throwing behaviour on the buffers in those tests.
Sadly Mockito cannot spy or mock our Buffer implementation classes, and does not allow mocking an interface while spying on an implementation, so we have to do a more complicated dance with our mocking.
2021-04-27 10:00:27 +02:00
Chris Vest
c09276373e Fix prose errors 2021-04-27 10:00:27 +02:00
Chris Vest
8c2987a824 Add a Buffer.writeBytes bulk transfer method
This simplifies some of the ByteToMessageDecoder example code.
2021-04-27 10:00:27 +02:00
Chris Vest
d72982a5ef Fix checkstyle issue 2021-04-27 10:00:27 +02:00
Chris Vest
0748d206d2 Add an alternative message decoder implementation
This one is a rewrite, making use of the new APIs where possible.
The test uses bifurcate to cut buffers into segments.
2021-04-27 10:00:27 +02:00
Chris Vest
c081c73885 Port over the ByteToMessageDecoder as an example 2021-04-27 10:00:27 +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
a2d49fed3e Bring slice and bifurcate methods together
They are conceptually related.
2021-04-27 10:00:27 +02:00
Chris Vest
7ac7655e87
Merge pull request #49 from netty/send-instanceof
Rename Deref.isInstanceOf to referentIsInstanceOf
2021-04-27 09:59:27 +02:00
Chris Vest
2decac081a Rename Deref.isInstanceOf to referentIsInstanceOf
Motivation:
Derefs are not necessarily their referents.
This is the case for Send, for instance.

Modification:
The Deref.isInstanceOf method is renamed to referentIsInstanceOf.
And a Send.isSendOf method has been added, that simplifies the check for sends, since it could be the case that one also needs to check if the object in question is also a Send instance.

Result:
Cleaner code that is easier to read, when working with Sends.

This fixes https://github.com/netty/netty-incubator-buffer-api/issues/46
2021-04-26 18:33:52 +02:00
Chris Vest
b541a20b4c
Merge pull request #50 from netty/panama-update
Update APIs with the latest project-panama changes
2021-04-26 18:33:14 +02:00
Chris Vest
ca864c9af4 Only upload the artifacts in the target directory
This makes failed builds complete a lot faster, but we won't have the OpenJDK or Netty files for failed builds.
2021-04-26 17:27:31 +02:00
Chris Vest
b396252682 Update APIs with the latest project-panama changes 2021-04-26 17:08:40 +02:00
Chris Vest
9c87dc8208
Merge pull request #43 from netty/build-test-reports
Add a build step that uploads surefire test reports
2021-04-14 13:42:45 +02:00