engine
engine copied to clipboard
Separate hash from data structure
Separate the hash from the structure of data.
For example, the service's hash should not be inside the Service
struct.
The list APIs should be updated to both return the hash alongside the resource.
What is motivation for that?
The motivation is that this is data calculated and is not necessary for the raw data. We should only store raw data, this way we can recompute the hash simply by processing all the attributes and not having to select which attributes are needed for that.
We could implement this when https://github.com/mesg-foundation/engine/issues/1714 is implemented, so clients could calculate the hash themselves. But I'm not sure about this feature. It feels too complex and too complicated for clients to calculate the hash all the time. @antho1404 what do you think?
I like the idea of having the client that calculates the hash based on the data. It might be a bit complicated to calculate the hash (and the address based on this hash) of the resource but once it's done I think it will actually make everything easier. One thing that will be immediately impacted by that is the process compilation. For now, for each task of a process we need to compile/create the service and create the associated runner in order to have the instance hash. If we can calculate the hash it means that we don't need to deploy anything and we can compile a process totally "offline".