Skip to content

impl futures::Stream<Event> for Subscriber #1368

@vi

Description

@vi

For some reason, sled::Subscriber implements Iterator and Future - a strange combination.

Instead of Future, futures::Stream would seem to be a more reasonable choice. How do I keep watching on more events asynchronously otherwise?

Use Case:

Watching multiple operations happening to a Sled database (like with Iterator impl), but asynchronously.

Proposed Change:

impl futures::Stream for Subscriber {
    type Item = Event;
    ....
}

Who Benefits From The Change(s)?

Async Sled users.

Alternative Approaches

  • Spawning blocking task to reach the Iterator impl
  • Repeat watch_prefix after each received event. Assign sequence number to each entry in the database and explicitly retrieve entries that were added to the database while we were not "on the watch".

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions