golemcloud / golem

Golem is an open source durable computing platform that makes it easy to build and deploy highly reliable distributed systems.
https://learn.golem.cloud/
Apache License 2.0
530 stars 59 forks source link

Move out `AuthCtx` type parameter from service layers, and have only `Namespace` #1023

Open afsalthaj opened 1 month ago

afsalthaj commented 1 month ago

AuthCtx is the context required to create a Namespace (project-id, account-id). In other words, authorise if the context can access Namespace.

In many places the service traits takes this type parameter of AuthCtx which doesn't make much sense.

Service layer is simply concerned with working with the entities in the namespace, and not exactly the access to the namespace.

I think happens either due to the suboptimal usage or abuse of the idea of AuthCtx type parameterization in favor of some simplicity, or not understanding the whole idea. Or, may be it was a mistake from the beginning.

This ticket can also be used to review the code, and fix things across. If the idea of AuthCtx is suboptimal, may be we revisit.

I can also see Namespace being String in certain places with an argument that it largely simplifies the code. If this was done, then the decision of making it String should be applied to the whole in favor of consistency. In either ways, consistency should be maintained. In my strong opinion, this String approach is deceivingly simple, and practically complex!