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

[cms] Replace DCC cache usage with direct gitbe implementation #1300

Merged
merged 5 commits into from
Sep 1, 2020

Conversation

alexlyp
Copy link
Member

@alexlyp alexlyp commented Aug 31, 2020

This diff removes the remaining DCC references to the cache and now directly requests the
vote information from the gitbe. This clears the way for easier implementation of tlog
since it will no longer be using the cache as we have it now.

@alexlyp alexlyp changed the title [cms] Repalce DCC cache usage with direct gitbe implementation [cms] Replace DCC cache usage with direct gitbe implementation Aug 31, 2020
way for tlog implementation.  We also add a testrun check for
vote summary to back sure that the votes are being tabulated
correctly.
@alexlyp alexlyp requested a review from lukebp August 31, 2020 16:51

// pluginLoadDCCVoteResults is a pass through function. CmdLoadDCCVoteResults does
// not require any work to be performed in gitBackEnd.
func (g *gitBackEnd) pluginLoadDCCVoteResults() (string, error) {
Copy link
Member

Choose a reason for hiding this comment

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

This function doesn't do anything. Why?

payload, err := g.pluginLoadDCCVoteResults()
return cmsplugin.CmdLoadVoteResults, payload, err
case cmsplugin.CmdDCCVotes:
payload, err := g.pluginDCCVotes(payload)
Copy link
Member

Choose a reason for hiding this comment

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

The command name is dccvotes, the function name is pluginDCCVotes, but the corresponding plugin struct is named VoteResults. This is confusing. The naming should be consistent.

}

// git checkout master
err = g.gitCheckout(g.vetted, "master")
Copy link
Member

Choose a reason for hiding this comment

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

Plugins should use the Backend api when possible instead of interacting with git and the filesystem directly. For metadata streams like in this function you should be able retrieve the full record with GetVetted and then pull out the mdstreams that you need from Record.Metadata. The same applies to the DCCVoteDetails function.

The only time a plugin should interact with the filesystem directly is when it needs journal data, since there aren't any Backend methods for interacting with the journals.

@alexlyp alexlyp requested a review from lukebp August 31, 2020 20:21
Copy link
Member

@lukebp lukebp left a comment

Choose a reason for hiding this comment

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

ACK

@lukebp lukebp merged commit 35427a6 into decred:master Sep 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants