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

feat: Generate default pairs #710

Merged
merged 3 commits into from
Aug 19, 2021
Merged

feat: Generate default pairs #710

merged 3 commits into from
Aug 19, 2021

Conversation

JinnyYi
Copy link
Contributor

@JinnyYi JinnyYi commented Aug 18, 2021

ref: #704

@codecov
Copy link

codecov bot commented Aug 18, 2021

Codecov Report

Merging #710 (5691aaf) into master (cf8c0ed) will decrease coverage by 0.05%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #710      +/-   ##
==========================================
- Coverage   12.25%   12.20%   -0.06%     
==========================================
  Files          22       22              
  Lines        1453     1459       +6     
==========================================
  Hits          178      178              
- Misses       1268     1274       +6     
  Partials        7        7              
Flag Coverage Δ
unittests 12.20% <0.00%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
tests/generated.go 1.41% <0.00%> (-0.02%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cf8c0ed...5691aaf. Read the comment docs.

for k := range n.defaultable {
keys = append(keys, k)
}
sort.Strings(keys)
Copy link
Contributor

Choose a reason for hiding this comment

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

How about using sort.Slice on []*Pair instead?

@@ -593,6 +628,35 @@ func (d *Data) ValidateNamespace(srv *Service, n *Namespace) {
log.Fatalf("Operation [%s] requires Pair [%s] support, please add virtual implementation for this pair.", v.Name, ps)
}
}

// Check if defaultable pairs are included in functions pairs.
for defaultablePairName := range n.defaultable {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain a bit more about this validate logic?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The intention is to check whether the default pairs belongs to the pairs of functions under namespace. For example, if location belongs to service.op.create, and no function in storage has this pair, then we can't add location as the defaultable pair for storage.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's no so harmful that we need to check so strictly. How about adding a new issue to record this problem and remove the check logic in this PR.

From my side, I think the best way is we maintain a pairs map in namespace and we only need to check is this pair exist in it. But we only have srv.pairs now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it.

@JinnyYi JinnyYi mentioned this pull request Aug 19, 2021
@Xuanwo
Copy link
Contributor

Xuanwo commented Aug 19, 2021

So nice!

@Xuanwo Xuanwo merged commit 13de902 into master Aug 19, 2021
@Xuanwo Xuanwo deleted the gsp-700 branch August 19, 2021 08:36
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.

2 participants