Skip to content

Simplify store by moving code to base / other classes #290

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

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

quantumagi
Copy link
Contributor

@quantumagi quantumagi commented Dec 16, 2018

See #281

@quantumagi quantumagi changed the title Simplify store by moving code to base class and classes Simplify store by moving code to base / other classes Dec 16, 2018
@bokobza
Copy link
Contributor

bokobza commented Dec 17, 2018

Is this to go in before the release?

@quantumagi
Copy link
Contributor Author

quantumagi commented Dec 17, 2018

It's not critical but it could speed up writing test cases. It's really hard to say.

@bokobza
Copy link
Contributor

bokobza commented Dec 17, 2018

I think this change does a lot more than just simplifying the store and adds a bit of functionality so I'm keen to wait with it.

@quantumagi
Copy link
Contributor Author

quantumagi commented Dec 18, 2018

No functionality was added - i.e. the code is doing nothing that it was not doing before. The PR splits the code up into digestible pieces (into new classes) which means code is also being moved around. However we can certainly wait with this.

For instance, much complexity exists in the code relating to maintaining transactional integrity and leaving the store in a predictable state when errors occur. This is tricky due to the use of in-memory lookups that need to reflect the store state. To simplify things all of that code was moved into the CrossChainDBTransaction and ICrossChainDB classes. Serialization was restricted to the former class.

Copy link
Contributor

@bokobza bokobza left a comment

Choose a reason for hiding this comment

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

Blocking this until after the release.

@bokobza bokobza added the discussion Where a discussion is needed label Dec 20, 2018
@quantumagi
Copy link
Contributor Author

@bokobza , can we take another look at this now?

Copy link
Contributor

@monsieurleberre monsieurleberre left a comment

Choose a reason for hiding this comment

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

I think that the new CrossChainDBTransaction class is what I had in mind for the "store" component back in the early days, I am happy to see it here.
I am going to check test coverage etc, but it looks good I think

/// <summary>
/// The purpose of this class is to restrict the operations that can be performed on the underlying
/// database - i.e. it provides a "higher level" layer to the underlying DBreeze transaction.
/// As such it provides a guarantees that any transient lookups will be kept in step with changes
Copy link
Contributor

Choose a reason for hiding this comment

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

kept in sync ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

namespace Stratis.FederatedPeg.Features.FederationGateway.TargetChain
{
/// <summary>Supported DBreeze transaction modes.</summary>
public enum CrossChainTransactionMode
Copy link
Contributor

Choose a reason for hiding this comment

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

If I correctly understand and we are only talking about transaction in the DB sense of the term, I think the name is a bit ambiguous here: CrossChainTransactionMode could be easily interpreted as different modes of performing a Cross chain transfer no?

Copy link
Contributor Author

@quantumagi quantumagi Jan 23, 2019

Choose a reason for hiding this comment

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

Changed to CrossChainDBTransactionMode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Where a discussion is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants