Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/172 create assetloader #199

Conversation

paullatzelsperger
Copy link
Member

@paullatzelsperger paullatzelsperger commented Nov 1, 2021

This PR implements an AssetIndexLoader plus an in-memory implementation for that.
Since the loader must guarantee consistency between an Asset and the corresponding DataAddress, the in-mem implementation also implements the AssetIndex and DataAddressResolver interfaces.

Fixes issue #172

@paullatzelsperger paullatzelsperger marked this pull request as ready for review November 1, 2021 09:30
@ndr-brt ndr-brt mentioned this pull request Nov 2, 2021
private final CriterionToPredicateConverter predicateFactory;
private final ReentrantLock lock;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this lock in addition to ConcurrentHashMaps? Just to ensure both Maps stay consistent?
If so maybe a ReentrantReadWriteLock would be better... but just a minor-minor improvement for an extension that shouldn't be used in production...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you after the supposed added performance since we're expecting much more read operations than write operations?

Copy link
Contributor

@MoritzKeppler MoritzKeppler Nov 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. but more than that I wanted to ensure I understood why we need the lock at all? Is it for consistency over those two maps?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If so my next question would be: why is DataAddress not just an attribute at Asset? From a DDD perspective: does a DataAddress has it's own identity? Don't think so - but maybe I'm wrong...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually looking from a DDD perspective the Asset is an entity, it has an identity, it has an history and, why not, their attributes could be modified without changing its identity.
Seems like DataAddress in this context is more of a value object, because it is just related to the Asset, and in fact it does not own an identity so I agree with your reasoning @MoritzKeppler .
Don't remember why we extracted DataAddress from Asset...

Copy link
Member Author

@paullatzelsperger paullatzelsperger Nov 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not model the DataAddress as a property of the Asset, because the DataAddress will probably private information - we wouldn't want to expose where our data is stored. Thus, if the DataAddress is a property on the Asset, we would have to prevent exposing it during serialization, which I find dangerous.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What we offer to outside is e.g. an IDS Resource or something similar. In my eyes it would be an antipattern to provide the internal model 1:1 to the world outside.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But a DataAdress can also be used in the information passed to others: it that case it would be the address under which the other participant can retrieve the data.
As soon as a consumer retrieved an asset it will be added to an internal catalog (as it now needs to be managed) and will get a DataAddress pointing to the local copy of the asset.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But a DataAdress can also be used in the information passed to others: it that case it would be the address under which the other participant can retrieve the data.

that would imply giving consumers direct access to, say, a database, right? Because I think the DataAddress would contain database name, etc...

As soon as a consumer retrieved an ...

sure, but then there will also be a different instance of the Asset within the consumer's realm, even if that may contain the same metadata.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

started a discussion, maybe we can copy over the different views.
#214

@MoritzKeppler MoritzKeppler merged commit bb9c49e into eclipse-edc:main Nov 4, 2021
@juliapampus juliapampus added this to In progress in Connector via automation Feb 23, 2022
@juliapampus juliapampus moved this from In progress to Done in Connector Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Connector
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants