github.com/muhammadn/cortex@v1.9.1-0.20220510110439-46bb7000d03d/pkg/chunk/purger/table_provisioning.go (about)

     1  package purger
     2  
     3  import (
     4  	"flag"
     5  
     6  	"github.com/cortexproject/cortex/pkg/chunk"
     7  )
     8  
     9  // TableProvisioningConfig holds config for table throuput and autoscaling. Currently only used by DynamoDB.
    10  type TableProvisioningConfig struct {
    11  	chunk.ActiveTableProvisionConfig `yaml:",inline"`
    12  	TableTags                        chunk.Tags `yaml:"tags"`
    13  }
    14  
    15  // RegisterFlags adds the flags required to config this to the given FlagSet.
    16  // Adding a separate RegisterFlags here instead of using it from embedded chunk.ActiveTableProvisionConfig to be able to manage defaults separately.
    17  // Defaults for WriteScale and ReadScale are shared for now to avoid adding further complexity since autoscaling is disabled anyways by default.
    18  func (cfg *TableProvisioningConfig) RegisterFlags(argPrefix string, f *flag.FlagSet) {
    19  	// default values ActiveTableProvisionConfig
    20  	cfg.ProvisionedWriteThroughput = 1
    21  	cfg.ProvisionedReadThroughput = 300
    22  	cfg.ProvisionedThroughputOnDemandMode = false
    23  
    24  	cfg.ActiveTableProvisionConfig.RegisterFlags(argPrefix, f)
    25  	f.Var(&cfg.TableTags, argPrefix+".tags", "Tag (of the form key=value) to be added to the tables. Supported by DynamoDB")
    26  }
    27  
    28  func (cfg DeleteStoreConfig) GetTables() []chunk.TableDesc {
    29  	return []chunk.TableDesc{cfg.ProvisionConfig.BuildTableDesc(cfg.RequestsTableName, cfg.ProvisionConfig.TableTags)}
    30  }