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

store, daemon, client, cmd/snap: expose "scope", default to wide #5479

Merged
merged 3 commits into from Jul 6, 2018

Conversation

chipaca
Copy link
Contributor

@chipaca chipaca commented Jul 5, 2018

This adds support for the store's new scope query parameter, exposed
directly to clients, and defaults the snap find to use scope=wide
(i.e. get results for any architecture and branch unless it's devmode).

Use snap find --narrow <query> to get back the old behaviour.

This adds support for the store's new `scope` query parameter, exposed
directly to clients, and defaults the `snap find` to use `scope=wide`
(i.e. get results for any architecture and branch unless it's `devmode`).

Use `snap find --narrow <query>` to get back the old behaviour.

s.rsnaps = []*snap.Info{}

req, err := http.NewRequest("GET", "/v2/find?q=foo&scope=creep", nil)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Heh 👍

@@ -127,6 +127,7 @@ type FindOptions struct {
Prefix bool
Query string
Section string
Scope string
Copy link
Collaborator

Choose a reason for hiding this comment

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

What can effectively be passed as scope here aside from wide?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"".

Copy link
Collaborator

Choose a reason for hiding this comment

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

Fair enough 👍

@mvo5 mvo5 added this to the 2.34 milestone Jul 6, 2018
Copy link
Collaborator

@pedronis pedronis left a comment

Choose a reason for hiding this comment

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

looks good, couple of open points Qs

@@ -160,6 +161,7 @@ func init() {
return &cmdFind{}
}, map[string]string{
"private": i18n.G("Search private snaps"),
"narrow": i18n.G("Only search for snaps in 'stable' and for the current architecture"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

are we sure wide find other archs, it doesn't seem to be the case. I expect some potential bikeshedding on the name of this option

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm sure we don't, now. I'll fix.

@@ -622,6 +622,7 @@ func searchStore(c *Command, r *http.Request, user *auth.UserState) Response {
q := query.Get("q")
section := query.Get("section")
name := query.Get("name")
scope := query.Get("scope")
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we check whether scope is only "wide" or empty ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

or from another POV, do we get a sane enough error if it's set to something else?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see no harm in passing it through, as long as it's not exposed to the end-user directly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we get no error if it's set to something weird

Copy link
Contributor

@mvo5 mvo5 left a comment

Choose a reason for hiding this comment

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

LGTM

@mvo5 mvo5 merged commit f901208 into snapcore:master Jul 6, 2018
@chipaca chipaca deleted the find-scope branch June 4, 2019 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants