solid-resp-ractor 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +16 -1
- data/lib/solid_resp_ractor/reader.rb +3 -1
- data/lib/solid_resp_ractor/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dd4e364890b8cab1baeeb04fe13d2004c17be84661a4f6c4668e640b8d58f741
|
|
4
|
+
data.tar.gz: 286b643b1ef850800bd39ef5c61368b86d19e12b1afb15ea4b69bc3d113494d4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d7eb44bb5526de649fdec95b5ac2cf67e4e86d41da988abcd10ce2d79e881fe1298c3c100d0f66407fb4bcfed6e7c72ff09c5ff5ed81e467d0fce233b1b2d350
|
|
7
|
+
data.tar.gz: ffad02feae72244c364300b73c805819f516d8b29b9313d0b0e62bc70c2ae2d7e0db5a164d26b6b2145f36c43ffc6bf47c18b6f48c6d5910cfeea38bc5cb81c8
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.1.1] - 2026-09-29
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Compact partially consumed buffers only after 16 KiB and when the consumed
|
|
10
|
+
prefix occupies at least half of the buffer.
|
|
11
|
+
- Clarify that decoded response contents are not automatically deeply frozen
|
|
12
|
+
or Ractor-shareable.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- Adversarial coverage for every frame split and EOF position, truncated
|
|
17
|
+
streamed values, resource limits, excessive nesting, and deterministic
|
|
18
|
+
generated RESP values under random fragmentation.
|
|
19
|
+
|
|
5
20
|
## [0.1.0] - 2026-09-29
|
|
6
21
|
|
|
7
22
|
### Added
|
|
@@ -17,4 +32,5 @@ All notable changes to this project are documented in this file.
|
|
|
17
32
|
input, and parallel Ractors.
|
|
18
33
|
- Ractor-shareable default encoder with no global mutable state.
|
|
19
34
|
|
|
35
|
+
[0.1.1]: https://github.com/nicolasva/solid-resp-ractor/compare/v0.1.0...v0.1.1
|
|
20
36
|
[0.1.0]: https://github.com/nicolasva/solid-resp-ractor/releases/tag/v0.1.0
|
data/README.md
CHANGED
|
@@ -76,6 +76,12 @@ reader = codec.reader(socket, read_timeout: 1.0)
|
|
|
76
76
|
`SolidRespRactor::DEFAULT_CODEC` is Ractor-shareable. A custom codec is also
|
|
77
77
|
shareable when all injected collaborators are shareable.
|
|
78
78
|
|
|
79
|
+
Decoded responses are not automatically Ractor-shareable. Typed wrappers are
|
|
80
|
+
frozen, but mutable strings, arrays, hashes, and nested values they contain are
|
|
81
|
+
not deeply frozen. Transform a response explicitly with
|
|
82
|
+
`Ractor.make_shareable` (copying it first when mutation must remain possible)
|
|
83
|
+
before sending it to another Ractor.
|
|
84
|
+
|
|
79
85
|
## Reading RESP streams
|
|
80
86
|
|
|
81
87
|
The default reader accepts blocking IO objects such as `StringIO`, as well as
|
|
@@ -250,7 +256,16 @@ ractor.take
|
|
|
250
256
|
|
|
251
257
|
Create sockets and readers inside their owning Ractor. Custom handlers,
|
|
252
258
|
encoders, selectors, and clocks must themselves be Ractor-shareable if they
|
|
253
|
-
are passed between Ractors.
|
|
259
|
+
are passed between Ractors. Responses remain local to the reader's Ractor
|
|
260
|
+
unless the application explicitly transforms them into shareable values.
|
|
261
|
+
|
|
262
|
+
## Buffer management
|
|
263
|
+
|
|
264
|
+
The reader advances a virtual cursor through buffered bytes. It clears a fully
|
|
265
|
+
consumed buffer immediately and compacts a partially consumed buffer only
|
|
266
|
+
after at least 16 KiB have been consumed and that prefix occupies at least half
|
|
267
|
+
of the buffer. This avoids copying a large unread suffix after small fragmented
|
|
268
|
+
reads while still releasing consumed data during long-lived streams.
|
|
254
269
|
|
|
255
270
|
## Development
|
|
256
271
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
module SolidRespRactor
|
|
4
4
|
class Reader
|
|
5
5
|
CRLF = "\r\n"
|
|
6
|
+
COMPACT_THRESHOLD = 16 * 1024
|
|
6
7
|
|
|
7
8
|
attr_reader :source
|
|
8
9
|
|
|
@@ -312,7 +313,8 @@ module SolidRespRactor
|
|
|
312
313
|
end
|
|
313
314
|
|
|
314
315
|
def compact_buffer
|
|
315
|
-
return if @offset
|
|
316
|
+
return if @offset < COMPACT_THRESHOLD
|
|
317
|
+
return if @offset < @buffer.bytesize / 2
|
|
316
318
|
|
|
317
319
|
@buffer = @buffer.byteslice(@offset..) || +""
|
|
318
320
|
@offset = 0
|