amino-os / Amino.Run

Amino Distributed OS - Runtime Manager
Apache License 2.0
29 stars 12 forks source link

[Doc] Sapphire Core: Warning side effects of Sapphire objects #124

Open dhzhuo opened 6 years ago

dhzhuo commented 6 years ago

We should document clearly that some DMs may not work properly if operations on Sapphire objects have side effects.

From my perspective, side effects are updates to states outside of a Sapphire object. For example, when we call a method on a Sapphire object, this method may make updates on external databases, make updates on other Sapphire objects, or make updates to third party web services. All these updates (either on external databases, on other Sapphire objects, or on third party web services) modify states outside of the original Sapphire object are counted as side effects.

Side effects cause trouble to our DMs. For example, our Transaction DM can rollback the state of a Sapphire object, but it cannot rollback the changes it made to external states (e.g. in databases or other sapphire objects). Similarly, if an operation in a Sapphire object has side effect (e.g. insert one row in database), it will be unsafe for us to inject a Master/Slave DM into this object. Because the replication logic in Master/Slave DM may cause multiple rows being inserted into the database.

prostil commented 5 years ago

@quinton-hoole-2 What needs to be done with one?

quinton-hoole commented 5 years ago

As described, docs need to be improved.

quinton-hoole commented 5 years ago

Urgency and importance are low, as per labels.