Uploaded image for project: 'Apache Cassandra'
  1. Apache Cassandra
  2. CASSANDRA-17544

Add EnableFlag to guardrails API

    XMLWordPrintableJSON

Details

    Description

      Currently we only have a DisableFlag which, for guardrails where we're enabling or disabling a feature, leads to some pretty odd ergonomics in the code. For example:

       

      public static final DisableFlag compactTablesEnabled =
      new DisableFlag("compact_tables",
                      state -> !CONFIG_PROVIDER.getOrCreate(state).getCompactTablesEnabled(),
                      "Creation of new COMPACT STORAGE tables"); 

      So far, the usage of these toggle flags appears to be skewed heavily towards the inverse, or an EnableFlag that'd look something like this:

      public static final EnableFlag featureEnabled = new EnableFlag("feature_name", state -> CONFIG_PROVIDER.getOrCreate(state).getCompactTablesEnabled(), "Text for feature"); 

      While it's a relatively small change it'll help tidy up some of the guardrails framework and make the logic clearer.

      Attachments

        Activity

          People

            bernardo.botella Bernardo Botella Corbi
            jmckenzie Josh McKenzie
            Bernardo Botella Corbi
            Andres de la Peña, Josh McKenzie, Yifan Cai
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h
                1h