vendredi 27 octobre 2023

Design pattern for supporting transferring data from multiple sources to destinations

I am working on a small program - the main feature of the program it to 'transfer' 'data' from one 'place' to another, and also record stats (like timestamps, success or not, etc.) to sqlite db. Besides, the program should be able to retry for a few times if transfer fails.

Currently, the assumptions for 'data', 'place' and 'transfer' is simple:

  • the data can only be a file in the host machine
  • the destination can be a location in the host machine or a remote server
  • the methods for transferring the data can only be 'rsync' (which uses rsync command in the host machine)

I have 2 main questions:

  1. What is an appropiate design pattern for this program, if the program may scale in the future. There could be more methods for transferring data such as ftp, cloud server command line tools, etc. The program may need to handle if the the data is a directory (in which case, it will transfer the entire directory to the destination). The database it records stats to could be other types like mysql or postgres.
  2. How should 'record stats to sqlite db' be related to the transfer feature? Is it better to separate them?

Aucun commentaire:

Enregistrer un commentaire