lundi 18 novembre 2019

How to design processing pipelines when working with files

Hello i have the following problem: I have a ASP NET Core application that has to be able to receive files and process them.The catch is that this processing is done in multiple stages and the client might want the file in any transitory stage:

Original File -> P0(Original File) -> P1(...)-> ....PN(...)-> Full Converted file

PN is the processing stage one the file at some point.

I do not know how to design interfaces for this kind of process.Should i save on the disk the result of each processing stage ,and feed this location to the next stage ( it would greatly reduce interface complexity) or should i just load the file at every stage (pass it as argument):

public interface LocationInterface
{
   Task<FullConvertedFile>  EndToEndAsync(Stream stream); //this step is end to end
   Task<string>  ProcessStage_0(string location); // new location
   Task<string>  ProcessStage_1(string location);  //
  ...............
   Task<FullConvertedFile>  PrcoessFinal(string finalLocation);

}   
public interface ExplicitFileInterface
{
   Task<FullConvertedFile> EndToEndAsync(Stream stream);  //This step is end to end
   Task<Xdocument> ProcessStage_0(Stream stream);
   Task<string>    ProcessStage_1(Xdocument doc);
   ......
   Task<FullConvertedFile> ProcessStage_N(SomeType arg);

}     

I do not know how to design the interface to for someone to be able to test every step but also to not get bogged down with interface parameters.

Aucun commentaire:

Enregistrer un commentaire