Skip to content

RLP StreamReader #148

Description

@wjmelements

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() 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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions