Skip to content

Commit

Permalink
Re-add flag and deprecate
Browse files Browse the repository at this point in the history
  • Loading branch information
tstirrat15 committed Oct 28, 2024
1 parent 357741b commit 83e0448
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
11 changes: 11 additions & 0 deletions pkg/cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/fatih/color"
"github.com/jzelinskie/cobrautil/v2"
"github.com/jzelinskie/cobrautil/v2/cobraotel"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"

"github.com/authzed/spicedb/internal/telemetry"
Expand Down Expand Up @@ -158,6 +159,16 @@ func RegisterServeFlags(cmd *cobra.Command, config *server.Config) error {

experimentalFlags := nfs.FlagSet(BoldBlue("Experimental"))
// Flags for experimental features
experimentalFlags.BoolVar(&config.EnableExperimentalLookupResources, "enable-experimental-lookup-resources", true, "enables the experimental version of the lookup resources API")
if err := experimentalFlags.MarkDeprecated("enable-experimental-lookup-resources", "The old implementation of LookupResources has been removed and this flag is a no-op. This flag will be removed in the future."); err != nil {
return fmt.Errorf("failed to mark flag as deprecated: %w", err)
}
if !config.EnableExperimentalLookupResources {
log.Warn().
Bool("value", false).
Msg("The old implementation of LookupResources is no longer available, and a `false` value is no longer valid. Please remove this flag.")
}

experimentalFlags.BoolVar(&config.EnableExperimentalWatchableSchemaCache, "enable-experimental-watchable-schema-cache", false, "enables the experimental schema cache which makes use of the Watch API for automatic updates")
// TODO: these two could reasonably be put in either the Dispatch group or the Experimental group. Is there a preference?
experimentalFlags.StringToStringVar(&config.DispatchSecondaryUpstreamAddrs, "experimental-dispatch-secondary-upstream-addrs", nil, "secondary upstream addresses for dispatches, each with a name")
Expand Down
23 changes: 12 additions & 11 deletions pkg/cmd/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,18 @@ type Config struct {
ClusterDispatchCacheConfig CacheConfig `debugmap:"visible"`

// API Behavior
DisableV1SchemaAPI bool `debugmap:"visible"`
V1SchemaAdditiveOnly bool `debugmap:"visible"`
MaximumUpdatesPerWrite uint16 `debugmap:"visible"`
MaximumPreconditionCount uint16 `debugmap:"visible"`
MaxDatastoreReadPageSize uint64 `debugmap:"visible"`
StreamingAPITimeout time.Duration `debugmap:"visible"`
WatchHeartbeat time.Duration `debugmap:"visible"`
MaxReadRelationshipsLimit uint32 `debugmap:"visible"`
MaxDeleteRelationshipsLimit uint32 `debugmap:"visible"`
MaxLookupResourcesLimit uint32 `debugmap:"visible"`
MaxBulkExportRelationshipsLimit uint32 `debugmap:"visible"`
DisableV1SchemaAPI bool `debugmap:"visible"`
V1SchemaAdditiveOnly bool `debugmap:"visible"`
MaximumUpdatesPerWrite uint16 `debugmap:"visible"`
MaximumPreconditionCount uint16 `debugmap:"visible"`
MaxDatastoreReadPageSize uint64 `debugmap:"visible"`
StreamingAPITimeout time.Duration `debugmap:"visible"`
WatchHeartbeat time.Duration `debugmap:"visible"`
MaxReadRelationshipsLimit uint32 `debugmap:"visible"`
MaxDeleteRelationshipsLimit uint32 `debugmap:"visible"`
MaxLookupResourcesLimit uint32 `debugmap:"visible"`
MaxBulkExportRelationshipsLimit uint32 `debugmap:"visible"`
EnableExperimentalLookupResources bool `debugmap:"visible"`

// Additional Services
MetricsAPI util.HTTPServerConfig `debugmap:"visible"`
Expand Down

0 comments on commit 83e0448

Please sign in to comment.