Page tree
Skip to end of metadata
Go to start of metadata

MAGNOLIA-6451 - Getting issue details... STATUS

Background

With the current implementation, when one modifies a observed configuration resource file (in this case YAML) on any origin, we will end up having the modified file updated in the registry, so far so good, however, 

We have a problem in here, simply because these files may contain including files as such;

IncludesList.yaml ->

name: MyDummy
title: Let's go
enabled: true
level: 4
modelClass: info.magnolia.config.dummy.DummyModel
foo: bar
qux: lol
theList: !include /info/magnolia/config/source/yaml/samples/includingList.yaml

 

IncludingList.yaml ->

- 12

Following scenario will happen;

given(yamlFiles).registered();
when(includingList.yaml).modifiedWithDifferentValue("13");
then(includesList.yaml).containsStaleInformation();
 

Ideal Solution

We currently do not have the information of which configuration has inclusion of another configuration. In ideal world, we would like to update the only registry which updated configuration file is touching to such as would be;

given(IncludingList.yaml).isPresent();
given(includesList.yaml).isPresent();
when(IncludingList.yaml).isModified();


then(includingList.yaml).shouldBeUpdated();
then(registryWhichContainsThoseProviders).shouldBeUpdatedAccordingly();
 

However, we currently cannot do this, because we simply do not know which resources includes what, therefore only possible solution is as follows;

Solution

We currently watch for resource changes and thus, may know when a resource configuration file is updated (addition, deletion, modification). Ideally we should be updating the exact resource in registry however, currently, we do not know this information of which file includes other. Therefore, we currently may update the whole registry when we detect a change in a configuration file (FY(info) just like JCR config source) . One possible way to do that is via;

given(LayeredResourceOrigin).watchesForChanges();
given(configurationResource).isUpdated();


when(LayeredResourceOrigin).isInformedByAnyOtherOrigin();
// so far we already have the logic and these  then statements should be added.

then(RelayerResourceVisitor).isCalledBack();
then(AbstractFileResourceConfigurationSource).updatesTheRegistry();

 

 

Drawbacks of the proposed solution

  • We may end up updating the whole registry for just one configuration file change.
  • We may update the whole registry n times for n file changes, therefore, one possible workaround would be for that is to, callback with a collection of resources from the ResourceOrigin s.

This may mean that, adding a visitFiles(Collection<Resource> resources); to  ResourceVisitor interface and then update the registry when those resources are delegated to other ResourceVisitor s

or, another proposal would be to not use ResourceVisitor for origin.watchForChanges();

 

  • No labels