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

overwrite default Options from SuperFlag string #1663

Merged
merged 10 commits into from
Feb 9, 2021
Merged

Conversation

karlmcguire
Copy link
Contributor

@karlmcguire karlmcguire commented Feb 5, 2021

(This relates to DGRAPH-3003 and is blocked by dgraph-io/ristretto#247.)

  1. I don't think there's a good way to include slices in a SuperFlag, so in overwriteOptions I only look at scalar, non-interface fields. I figured people could just use WithLogger and WithEncryptionKey instead of trying to accommodate it in SuperFlag.
  2. How should we handle Dir and ValueDir which previously didn't really have a default value?

This change is Reviewable

@karlmcguire karlmcguire changed the title overwrite default Options from SuperFlag string [breaking] overwrite default Options from SuperFlag string Feb 5, 2021
Copy link
Contributor

@manishrjain manishrjain left a comment

Choose a reason for hiding this comment

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

:lgtm: Got a comment about adding a test with a legit value for super flag.

Reviewed 4 of 4 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @jarifibrahim and @karlmcguire)


options_test.go, line 12 at r1 (raw file):

func TestOptions(t *testing.T) {
	// copy all the default options over to a big SuperFlag string
	defaultSuperFlag := generateSuperFlag(DefaultOptions(""))

would be good to try to overwrite some option, to capture the most common use case.

@karlmcguire karlmcguire changed the title [breaking] overwrite default Options from SuperFlag string overwrite default Options from SuperFlag string Feb 5, 2021
Copy link
Contributor

@manishrjain manishrjain left a comment

Choose a reason for hiding this comment

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

@aman-bansal -- Can you resolve this and get it merged today?

Reviewable status: 2 of 4 files reviewed, 3 unresolved discussions (waiting on @jarifibrahim, @karlmcguire, and @manishrjain)


options.go, line 192 at r2 (raw file):

//
// Unsupported: Options.Logger, Options.EncryptionKey
func SetSuperFlag(superflag string, options Options) Options {
(Options) WithSuperFlag(superflag string) Options {
 ...
}

options_test.go, line 1 at r2 (raw file):

package badger

license here.

options.go Outdated Show resolved Hide resolved
@aman-bansal aman-bansal merged commit 80f42be into master Feb 9, 2021
@aman-bansal aman-bansal deleted the karl/flags branch February 9, 2021 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants