This repository has been archived by the owner on Jan 4, 2020. It is now read-only.
Separation of the client and store concerns (major change) #40
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduce an important separation of concerns between the client and the store part. The two sides have now distinct models. The main (mid-term) objective is to allow a client model to interact with multiple (heterogeneous) stores.
Because the models differ on the client and store sides,
Resource
s attribute values have to be converted when passing from one side to the other (e.g. during theget()
andsave()
operations). These conversions are made byModelConverter
s that are defined for each pair client/store models.The available converters only deal with direct mapping. The current client models are usually imported from the store models. In the future, more complex converters should be introduced for supporting better data integration scenarii.
See https://github.com/oldm/OldMan/blob/master/examples/quickstart.py for an example of the new API.
Main changes:
Model
s andModelManager
ResourceManager
is now aClientResourceManager
and only concerns the client part. Some of its code have been delegated to theModelManager
.ModelConversionManager
andModelConverter
introduced.Resource
has now two sub-classes:StoreResource
andClientResource
.Model
is extended by theClientModel
subclass. Models are now independent of the data store.ModelManager
(used by theDataStore
and theClientResourceManager
) is extended by theClientModelManager
sub-class.