kaitai_struct_csharp_runtime icon indicating copy to clipboard operation
kaitai_struct_csharp_runtime copied to clipboard

C# Async with .NET Core Kaitai.Struct.Runtime.Async

Open pluskal opened this issue 5 years ago • 0 comments

Relates to https://github.com/kaitai-io/kaitai_struct/issues/640 and https://github.com/kaitai-io/kaitai_struct_compiler/pull/189

This PR adds an additional unit tests that ensures correct behavior of the runtime itself that is not dependent on the compiled KSY files.

An abstraction formed by IKaitaiStreamBase, IKaitaiAsyncStream is introduced to decouple code and implementation to allow reimplementation of the Stream if needed. (I was unable to update the compiler to accept interface instead of direct type due to my lack of Scala knowledge and coupling in the compiler and translator code.)

The ultimate goal is to introduce Asynchronous implementation that allows usage in massively parallel applications that consumes data in async streams. To achieve that, IReaderContext is introduced to abstract multiple implementations of the "Stream".

  • Implementation of standard stream is provided by the StreamReaderContext that suffers from a lack of asynchronicity due to the .NET's Stream API that does not support asynchronous seek operation.
  • The true asynchronous implementation is provided by PipeReaderContext.

The folder structure, project naming is changed to reflect C#/.NET conventions.

pluskal avatar Jan 03 '20 15:01 pluskal