Skip to content

Support in-memory writer #14

@wenkokke

Description

@wenkokke

Support a writer that streams the eventlog to an in-memory buffer. This is somewhat complicated, and should perhaps be migrated into its own package. @dcoutts sketched out the following possible design:

The problem will be blocking. To stream the eventlog to the same process you need non-blocking writes. If the RTS blocks trying to write data then it cannot wake up to run the Haskell code and thus you deadlock. You cannot use a pipe since that's bounded, and hence blocking.

You can write C code that uses the RTS functions to allocate an MVar pointing to a byte array and the next entry, and make a MVar based linked list as a queue. Use an empty MVar as the end of the queue. There are RTS C API functions for allocating and for writing to an MVar in a non-blocking way from C code.

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