ApeWorX / ApeWorX/pyrlp

RLP StreamReader

Đang mở
#148 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
103
Fork
69
Merge trung bình
54 phút
Pull request đã merge (30 ngày)
1

Mô tả

### What feature should we add?

While messages from a stream might normally need delineation, the length prefix of RLP makes delimiters redundant. Also, no delimiter can be valid for RLP. I am requesting a way to read complete rlp-encoded messages from a stream (eg `sys.stdin`).

Essentially it should work similar to [`asyncio.StreamReader.readline()`](https://docs.python.org/3/library/asyncio-stream.html#asyncio.StreamReader.readline) but read an entire RLP message rather than a utf-8 line.

## Usage
```
reader = rlp.StreamReader()
pipe_protocol = asyncio.StreamReaderProtocol(reader)
loop = asyncio.get_event_loop()
await loop.connect_read_pipe(
lambda: pipe_protocol, sys.stdin
)
message = await reader.read()
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.