Skip to content

derive(Serialize) state: Fsm vs AsyncSeek #99

Open
@dishmaker

Description

Any async io function over trait AsyncSeek can be turned into a sans-io FSM.

I think that's a fact - just calling future.poll(..) on a clever object that pauses on seek and read calls is enough to simulate an ArchiveFsm.
So for example async_zip::ZipFileReader can be made into a sync sans-io interface with a wrapper.

Therefore, my open questions are:

  • Which paradigm is easier to write in Rust? sans-io or async?1
  • Which paradigm is faster to execute? sans-io or async?
  • Can we clone the EntryFsm state to remember decompressor state in the middle of 100 GB file with sans-io? 2
  • Can we serialize/save the EntryFsm state into JSON and resume it later with sans-io?3

Some answers are already in video fasterthanlime: The case for sans-io

Footnotes

  1. async fn is actually an FSM https://users.rust-lang.org/t/serde-async-state-machine/99648

  2. DecompressorOxide implements Clone

  3. async_zip ZipFileReader implements Clone, but not Serialize

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