infinispan / infinispan/js-client

Implement Hot Rod 4.1 streaming operations

Open
#143 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
17
Forks
28
Avg merge
4m
Merged PRs (30d)
1

Description

## Summary

Implement the chunked streaming operations introduced in Hot Rod protocol 4.1. These allow transferring large values in chunks rather than as a single message, avoiding memory pressure for large entries.

There are two sets of operations:

### Legacy (single-message) streaming
- `GET_STREAM_REQUEST` (0x37) / `GET_STREAM_RESPONSE` (0x38)
- `PUT_STREAM_REQUEST` (0x39) / `PUT_STREAM_RESPONSE` (0x3A)

### Chunked streaming (4.1)
| Operation | Request | Response |
|-----------|---------|----------|
| StartPutStream | 0xEF | 0xEE |
| NextPutStream | 0xED | 0xEC |
| EndPutStream | 0xEB | 0xEA |
| StartGetStream | 0xE9 | 0xE8 |
| NextGetStream | 0xE7 | 0xE6 |
| EndGetStream | 0xE5 | 0xE4 |

## Proposed API

```javascript
// Write a large value in chunks via a writable stream
var stream = client.putStream('key');
stream.write(chunk1);
stream.write(chunk2);
stream.end();

// Read a large value in chunks via a readable stream
var stream = client.getStream('key');
stream.on('data', function(chunk) { /* process chunk */ });
stream.on('end', function() { /* done */ });
```

The API should integrate with Node.js streams (`Readable`/`Writable`) for idiomatic usage.

## Notes

There is already a TODO in `lib/protocols.js` at the Protocol41 definition:
```
// TODO 4.1 new ops: chunked streaming (GetStreamStart/Next/End, PutStreamStart/Next/End)
```

There is also an older TODO for legacy streaming at Protocol 2.6:
```
// TODO 2.6 new ops: getStream and putStream
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in lib/protocols.js at the Protocol41 TODO and review the existing protocol definitions, then compare the legacy Protocol 2.6 TODO. Trace the client entry points for adding putStream and getStream and determine how Node.js Readable/Writable streams should map to the six chunked operations. Done means both streaming APIs support the listed Hot Rod 4.1 operations and transfer values in chunks without requiring the full value in memory.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.