You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the routers, presenting the API to the users, and containing the business logic
the dbs, also containing some business logic and dealing with the dbs through an ORM
Context:
For now it's fine, but in the near future we are going to include:
Agents: as they are hosted in the backend, they could be allowed to bypass routers and directly call the source code to avoid going through the network if it's not necessary
Similarly, we will have services depending on other services, such as the production manager depending on the transformation manager depending on the job manager. To go faster, they could be allowed to bypass networking and call directly the source code.
Problem
In the good old Dirac, it seems like we implicitly made the choice to merge the business logic with the data access layer, which creates tremendous DB interfaces, not always easy to follow. Also, as this is - it seems to me at least - implicit, we sometimes find some logic in both the Services and the DB interfaces (we can even see that in the only service we imported to DiracX).
Potential solution
In order to have a clear separation of concerns and a clear organization of the code, given our requirements, I would go towards a new layer, so that we would have:
Presentation layer: diracx-routers and FastAPI, that would be in charge of the API and the presentation of the information returned (e.g. HTTP Exceptions)
Business Logic layer: diracx-business (?) that would simply contain Dirac business logic (potentially allowing us to move from whatever framework we find in the future in an "easier" way). This layer would call the DAL to store information.
Data Access layer: diracx-dbs, which would only contain operations with the DBs and nothing else.
After discussing with @chaen and @chrisburr, we decided that for now, the business logic could live in the diracx-dbs package to avoid over-designing diracx, but might be subject to changes in next releases.
Current state
In the backend, we have 2 layers:
Context:
For now it's fine, but in the near future we are going to include:
production manager
depending on thetransformation manager
depending on thejob manager
. To go faster, they could be allowed to bypass networking and call directly the source code.Problem
In the good old Dirac, it seems like we implicitly made the choice to merge the business logic with the data access layer, which creates tremendous DB interfaces, not always easy to follow. Also, as this is - it seems to me at least - implicit, we sometimes find some logic in both the Services and the DB interfaces (we can even see that in the only service we imported to DiracX).
Potential solution
In order to have a clear separation of concerns and a clear organization of the code, given our requirements, I would go towards a new layer, so that we would have:
diracx-routers
and FastAPI, that would be in charge of the API and the presentation of the information returned (e.g. HTTP Exceptions)diracx-business
(?) that would simply contain Dirac business logic (potentially allowing us to move from whatever framework we find in the future in an "easier" way). This layer would call the DAL to store information.diracx-dbs
, which would only contain operations with the DBs and nothing else.What do you think?
The text was updated successfully, but these errors were encountered: